changed to not load gamecode from quake paths, to avoid issues with buggy quakeworld clients that will freely download stuff from anywhere (not sure what to do about ktx, but it can be reenabled with a cvar).

image_width is now only set by a single function.
tweaked scancode inputs slightly. added support for printscreen binds.
changed the way gamma works. glsl gamma now used when running windows, or hardware gamma is not available. removed gl_contrast+gl_brightness.
q2 gamecode support no longer has a system componant. this means that ports only need the generic stuff.
misc tweaks to the d3d11 renderer.
added brief descriptions to many builtins. need to add comments to constants, globals, and fields too, somehow.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4355 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-05-11 14:02:55 +00:00
parent 39705786bd
commit 9dbf5b5837
73 changed files with 1031 additions and 1153 deletions

View File

@ -7,9 +7,10 @@ STRIPFLAGS=--strip-unneeded --remove-section=.comment
CPUOPTIMIZATIONS=
#canonicalize the source path. except emscripten warns about that like crazy. *sigh*
BASE_DIR:=$(realpath .)
ifeq ($(FTE_TARGET),web)
BASE_DIR:=.
else
BASE_DIR:=$(realpath .)
endif
SVNREVISION:=-DSVNREVISION=$(shell test -d .svn && svnversion || echo -)
@ -304,7 +305,8 @@ ifeq ($(shell echo $(FTE_TARGET)|grep -v win),)
MINGW_LIBS_DIR=$(LIBS_DIR)/mingw-libs
ifeq ($(shell echo $(FTE_TARGET)|grep -v win64),)
MINGW_LIBS_DIR=$(LIBS_DIR)/mingw64-libs
MINGW_LIBS_DIR=$(BASE_DIR)/libs-x86_64-w64-mingw32
#$(LIBS_DIR)/mingw64-libs
endif
IMAGELDFLAGS=$(MINGW_LIBS_DIR)/libpng.a $(MINGW_LIBS_DIR)/libz.a $(MINGW_LIBS_DIR)/libjpeg.a
@ -1248,7 +1250,7 @@ PRECOMPHEADERS ?= $(OUT_DIR)/quakedef.h.gch
#god knows how gcc loads the list properly.
#or at least I hope he does. It makes no sence to mortals.
DO_LD ?=$(DO_ECHO) $(CC) -o $@ $(LTO_LD) $(WCFLAGS) $(CFLAGS)
DO_LD ?= $(CC) -o $@ $(LTO_LD) $(WCFLAGS) $(CFLAGS)
$(OUT_DIR)/$(EXE_NAME): $(PRECOMPHEADERS) $(foreach fn, $(CUSTOMOBJS) $(foreach ol, $(OBJS), $($(ol))),$(if $(findstring ltox,$(fn)),,$(OUT_DIR)/$(fn)))
$(DO_LD) $(foreach fn, $(CUSTOMOBJS) $(foreach ol, $(OBJS) $(LTO_END), $($(ol))),$(if $(findstring ltox,$(fn)),$(subst ltox,-x ,$(fn)),$(OUT_DIR)/$(fn)) ) $(LDFLAGS)
@ -1566,3 +1568,27 @@ droid-help:
@-echo "JARSIGNARGS: Additional optional arguments to java's jarsigner program. You may want to put -storepass FOO in here, but what ever you do - keep it secure. Avoid bash history snooping, etc. If its not present, you will safely be prompted as required."
@-echo
@-echo "Note that 'make droid-rel' will automatically generate a keystore. If you forget the password, just do a 'make dist-clean'."
makelibs:
ifndef ARCH
$(MAKE) makelibs ARCH=$(shell $(CC) -dumpmachine)
else
mkdir -p libs-$(ARCH)
test -f jpegsrc.v9.tar.gz || wget http://www.ijg.org/files/jpegsrc.v9.tar.gz
test -f libs-$(ARCH)/libjpeg.a || (cd libs-$(ARCH) && tar -xvzf ../jpegsrc.v9.tar.gz && cd jpeg-9 && ./configure -host=$(ARCH) && $(MAKE) && cp .libs/libjpeg.a ../ && $(ARCH)-ar -s ../libjpeg.a )
test -f zlib-1.2.8.tar.gz || wget http://zlib.net/zlib-1.2.8.tar.gz
test -f libs-$(ARCH)/libz.a || (cd libs-$(ARCH) && tar -xvzf ../zlib-1.2.8.tar.gz && cd zlib-1.2.8 && CC="$(CC) $(W32_CFLAGS)" ./configure --static && $(MAKE) libz.a CC="$(CC) $(W32_CFLAGS)" && cp libz.a ../ && $(ARCH)-ar -s ../libz.a )
test -f libpng-1.6.2.tar.gz || wget http://prdownloads.sourceforge.net/libpng/libpng-1.6.2.tar.gz?download -O libpng-1.6.2.tar.gz
test -f libs-$(ARCH)/libpng.a || (cd libs-$(ARCH) && tar -xvzf ../libpng-1.6.2.tar.gz && cd libpng-1.6.2 && ./configure -host=$(ARCH) && $(MAKE) && cp .libs/libpng16.a ../libpng.a )
test -f libogg-1.3.0.tar.gz || wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
test -f libs-$(ARCH)/libogg.a || (cd libs-$(ARCH) && tar -xvzf ../libogg-1.3.0.tar.gz && cd libogg-1.3.0 && ./configure -host=$(ARCH) && $(MAKE) && cp src/.libs/libogg.a ../ && $(ARCH)-ar -s ../libogg.a)
test -f libvorbis-1.3.3.tar.gz || wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz
test -f libs-$(ARCH)/libvorbisfile.a || (cd libs-$(ARCH) && tar -xvzf ../libvorbis-1.3.3.tar.gz && cd libvorbis-1.3.3 && ./configure -host=$(ARCH) --disable-oggtest --with-ogg-libraries=.. --with-ogg-includes=$(realpath libs-$(ARCH)/libogg-1.3.0/include) && $(MAKE) && cp lib/.libs/libvorbis.a ../ && cp lib/.libs/libvorbisfile.a ../ )
endif

View File

@ -1136,7 +1136,7 @@ void CG_Start (void)
Z_FreeTags(CGTAGNUM);
SCR_BeginLoadingPlaque();
cgvm = VM_Create(NULL, "vm/cgame", CG_SystemCallsNative, CG_SystemCallsVM);
cgvm = VM_Create("vm/cgame", com_nogamedirnativecode.ival?NULL:CG_SystemCallsNative, CG_SystemCallsVM);
if (cgvm)
{ //hu... cgame doesn't appear to have a query version call!
SCR_EndLoadingPlaque();

View File

@ -3937,10 +3937,7 @@ void CL_ExecInitialConfigs(void)
Cbuf_AddText ("exec frontend.cfg\n", RESTRICT_LOCAL);
Cbuf_AddText ("cl_warncmd 1\n", RESTRICT_LOCAL); //and then it's allowed to start moaning.
{
extern cvar_t com_parseutf8;
com_parseutf8.ival = com_parseutf8.value;
}
com_parseutf8.ival = com_parseutf8.value;
Cbuf_Execute (); //if the server initialisation causes a problem, give it a place to abort to
@ -3990,7 +3987,6 @@ Host_Init
void Host_Init (quakeparms_t *parms)
{
qboolean downloading = false;
extern cvar_t com_parseutf8;
com_parseutf8.ival = 1; //enable utf8 parsing even before cvars are registered.
COM_InitArgv (parms->argc, parms->argv);
@ -4136,7 +4132,7 @@ void Host_Shutdown(void)
}
host_initialized = false;
Plug_Shutdown();
Plug_Shutdown(false);
//disconnect server/client/etc
CL_Disconnect_f();
@ -4168,6 +4164,11 @@ void Host_Shutdown(void)
Cmd_Shutdown();
Key_Unbindall_f();
FS_Shutdown();
Plug_Shutdown(true);
Con_Shutdown();
Memory_DeInit();
@ -4176,8 +4177,6 @@ void Host_Shutdown(void)
memset(&svs, 0, sizeof(svs));
#endif
Sys_Shutdown();
FS_Shutdown();
}
#ifdef CLIENTONLY

View File

@ -2231,7 +2231,6 @@ void SCR_BringDownConsole (void)
SCR_UpdateScreen ();
cl.cshifts[CSHIFT_CONTENTS].percent = 0; // no area contents palette on next frame
VID_SetPalette (host_basepal);
}
void SCR_TileClear (void)

View File

@ -1536,7 +1536,7 @@ void UI_Start (void)
UI_Stop();
uivm = VM_Create(NULL, "vm/ui", UI_SystemCallsNative, UI_SystemCallsVM);
uivm = VM_Create("vm/ui", com_nogamedirnativecode.ival?NULL:UI_SystemCallsNative, UI_SystemCallsVM);
if (uivm)
{
apiversion = VM_Call(uivm, UI_GETAPIVERSION, 6);

View File

@ -1243,7 +1243,6 @@ void Con_PrintToSys(void)
int i;
conchar_t *t;
char buf[16];
extern cvar_t com_parseutf8;
for (l = curcon->oldest; l; l = l->newer)
{
@ -1454,6 +1453,7 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
conchar_t *s;
int i;
int x;
int prev;
//deactivate the selection if the start and end is outside
if (
@ -1528,7 +1528,7 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
}
l->lines = linecount;
while (linecount-- > 0)
while(linecount-- > 0)
{
s = starts[linecount];
linelength = ends[linecount] - s;
@ -1571,8 +1571,6 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
selendoffset = (s+i+1) - (conchar_t*)(l+1);
else
selendoffset = 0;
if (selendoffset > linelength)
selendoffset = linelength;
}
if (y <= selsy)
{

View File

@ -2405,13 +2405,21 @@ texid_t R_LoadHiResTexture(char *name, char *subpath, unsigned int flags)
{
tex = R_FindTexture(fname, flags);
if (TEXVALID(tex)) //don't bother if it already exists.
{
image_width = tex.ref->width;
image_height = tex.ref->height;
return tex;
}
}
if (!(flags & IF_SUBDIRONLY) && !(flags & IF_REPLACE))
{
tex = R_FindTexture(name, flags);
if (TEXVALID(tex)) //don't bother if it already exists.
{
image_width = tex.ref->width;
image_height = tex.ref->height;
return tex;
}
}
if ((flags & IF_TEXTYPE) == IF_CUBEMAP)
@ -2656,7 +2664,11 @@ texid_t R_LoadBumpmapTexture(char *name, char *subpath)
tex = R_FindTexture(name, 0);
if (TEXVALID(tex)) //don't bother if it already exists.
{
image_width = tex.ref->width;
image_height = tex.ref->height;
return tex;
}
tex = R_LoadCompressed(name);
if (TEXVALID(tex))

View File

@ -1979,50 +1979,65 @@ void INS_JoyMove (float *movements, int pnum)
CL_ClampPitch(pnum);
}
static qbyte scantokey[128] =
{
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0 , 27, '1', '2', '3', '4', '5', '6',
'7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i',
'o', 'p', '[', ']', 13 , K_CTRL, 'a', 's', // 1
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';',
'\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2
'b', 'n', 'm', ',', '.', '/', K_SHIFT, '*',
K_LALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCRLCK, K_HOME,
K_UPARROW, K_PGUP, '-', K_LEFTARROW,'5', K_RIGHTARROW,'+', K_END, // 4
K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11,
K_F12, 0, 0, 0, 0, 0, 0, 0, // 5
0, 0, 0, 0, 0, '\\', 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0 // 7
};
/*
static qbyte shiftscantokey[128] =
{
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0 , 27, '!', '@', '#', '$', '%', '^',
'&', '*', '(', ')', '_', '+', K_BACKSPACE, 9, // 0
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
'O', 'P', '{', '}', 13 , K_CTRL,'A', 'S', // 1
'D', 'F', 'G', 'H', 'J', 'K', 'L', ':',
'"' , '~', K_SHIFT,'|', 'Z', 'X', 'C', 'V', // 2
'B', 'N', 'M', '<', '>', '?', K_SHIFT,'*',
K_ALT,' ', K_CAPSLOCK , K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE , K_SCRLCK , K_HOME,
K_UPARROW,K_PGUP,'_',K_LEFTARROW,'%',K_RIGHTARROW,'+',K_END, //4
K_DOWNARROW,K_PGDN,K_INS,K_DEL,0,0, 0, K_F11,
K_F12, 0 , 0 , 0 , 0 , 0 , 0 , 0, // 5
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0, // 6
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0,
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 // 7
};
*/
static qbyte scantokey[] =
{
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0, 27, '1', '2', '3', '4', '5', '6', // 0
'7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', // 1
'o', 'p', '[', ']', K_ENTER, K_LCTRL, 'a', 's', // 1
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', // 2
'\'', '`', K_LSHIFT, '\\', 'z', 'x', 'c', 'v', // 2
'b', 'n', 'm', ',', '.', '/', K_RSHIFT, K_KP_STAR, // 3
K_LALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_F6, K_F7, K_F8, K_F9, K_F10, K_PAUSE, K_SCRLCK, K_KP_HOME, // 4
K_KP_UPARROW,K_KP_PGUP, K_KP_MINUS, K_KP_LEFTARROW,K_KP_5, K_KP_RIGHTARROW,K_KP_PLUS, K_KP_END, // 4
K_KP_DOWNARROW,K_KP_PGDN,K_KP_INS, K_KP_DEL, 0, 0, 0, K_F11, // 5
K_F12, 0, 0, 0, 0, 0, 0, 0, // 5
0, 0, 0, 0, 0, '\\', 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, // 7
0, 0, 0, 0, 0, 0, 0, 0, // 7
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0, 0, 0, 0, 0, 0, 0, 0, // 8
0, 0, 0, 0, 0, 0, 0, 0, // 8
0, 0, 0, 0, 0, 0, 0, 0, // 9
0, 0, 0, 0, 0, 0, 0, 0, // 9
0, 0, 0, 0, 0, 0, 0, 0, // a
0, 0, 0, 0, 0, 0, 0, 0, // a
0, 0, 0, 0, 0, 0, 0, 0, // b
0, 0, 0, 0, 0, 0, 0, 0, // b
0, 0, 0, 0, 0, 0, 0, 0, // c
0, 0, 0, 0, 0, 0, 0, 0, // c
0, 0, 0, 0, 0, 0, 0, 0, // d
0, 0, 0, 0, 0, 0, 0, 0, // d
0, 0, 0, 0, 0, 0, 0, 0, // e
0, 0, 0, 0, 0, 0, 0, 0, // e
0, 0, 0, 0, 0, 0, 0, 0, // f
0, 0, 0, 0, 0, 0, 0, 0, // f
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
0, 27, '1', '2', '3', '4', '5', '6', // 0
'7', '8', '9', '0', '-', '=', K_BACKSPACE, 9, // 0
'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', // 1
'o', 'p', '[', ']', K_KP_ENTER, K_RCTRL, 'a', 's', // 1
'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', // 2
'\'', '`', K_SHIFT, '\\', 'z', 'x', 'c', 'v', // 2
'b', 'n', 'm', ',', '.', K_KP_SLASH, K_SHIFT, K_PRINTSCREEN,// 3
K_RALT, ' ', K_CAPSLOCK, K_F1, K_F2, K_F3, K_F4, K_F5, // 3
K_F6, K_F7, K_F8, K_F9, K_F10, K_KP_NUMLOCK,K_SCRLCK, K_HOME, // 4
K_UPARROW, K_PGUP, '-', K_LEFTARROW,0, K_RIGHTARROW,'+', K_END, // 4
K_DOWNARROW,K_PGDN, K_INS, K_DEL, 0, 0, 0, K_F11, // 5
K_F12, 0, 0, 0, 0, 0, 0, 0, // 5
0, 0, 0, 0, 0, '\\', 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, // 6
0, 0, 0, 0, 0, 0, 0, 0, // 7
0, 0, 0, 0, 0, 0, 0, 0 // 7
// 0 1 2 3 4 5 6 7
// 8 9 A B C D E F
};
/*
=======
@ -2034,83 +2049,38 @@ Map from windows to quake keynums
static int MapKey (int vkey)
{
int key;
key = (vkey>>16)&255;
key = (vkey>>16)&511;
if (((vkey>>16)&511) == (0x138))
return K_RALT;
if (cl_keypad.value)
if (key < sizeof(scantokey) / sizeof(scantokey[0]))
key = scantokey[key];
else
key = 0;
if (!cl_keypad.ival)
{
switch (key)
switch(scantokey[key])
{
case 0x1c:
if ((vkey>>24)&1) //not compleatly seperate
return K_KP_ENTER;
break;
case 0x47:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_HOME;
break;
case 0x48:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_UPARROW;
break;
case 0x49:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_PGUP;
break;
case 0x4b:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_LEFTARROW;
break;
case 0x4c:
return K_KP_5;
case 0x4d:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_RIGHTARROW;
break;
case 0x4f:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_END;
break;
case 0x50:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_DOWNARROW;
break;
case 0x51:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_PGDN;
break;
case 0x52:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_INS;
break;
case 0x53:
if (!((vkey>>24)&1)) //not compleatly seperate
return K_KP_DEL;
break;
case 0x35:
if ((vkey>>24)&1) //not compleatly seperate
return K_KP_SLASH;
break;
case 0x4a:
return K_KP_MINUS;
case 0x4e:
return K_KP_PLUS;
case 0x45:
if ((vkey>>24)&1) //not compleatly seperate
return K_KP_NUMLOCK;
break;
case 0x37:
return K_KP_STAR;
// case 0x
// return K_KP_EQUALS;
case K_KP_HOME: return '7';
case K_KP_UPARROW: return '8';
case K_KP_PGUP: return '9';
case K_KP_LEFTARROW: return '4';
case K_KP_5: return '5';
case K_KP_RIGHTARROW: return '6';
case K_KP_END: return '1';
case K_KP_DOWNARROW: return '2';
case K_KP_PGDN: return '3';
case K_KP_ENTER: return K_ENTER;
case K_KP_INS: return '0';
case K_KP_DEL: return '.';
case K_KP_SLASH: return '/';
case K_KP_MINUS: return '-';
case K_KP_PLUS: return '+';
case K_KP_STAR: return '*';
case K_KP_EQUALS: return '=';
}
}
if (key > 127)
return 0;
if (scantokey[key] == 0)
if (key == 0)
Con_DPrintf("key 0x%02x has no translation\n", key);
return scantokey[key];
return key;
}
void INS_TranslateKeyEvent(WPARAM wParam, LPARAM lParam, qboolean down, int qdeviceid)

View File

@ -95,9 +95,13 @@ keyname_t keynames[] =
{"LALT", K_LALT},
{"RALT", K_RALT},
{"LCTRL", K_LCTRL},
{"RCTRL", K_RCTRL},
{"LSHIFT", K_LSHIFT},
{"RSHIFT", K_RSHIFT},
{"ALT", K_LALT}, //depricated name
{"CTRL", K_CTRL},
{"SHIFT", K_SHIFT},
{"CTRL", K_CTRL}, //depricated name
{"SHIFT", K_SHIFT}, //depricated name
{"F1", K_F1},
{"F2", K_F2},
@ -213,6 +217,7 @@ keyname_t keynames[] =
{"MWHEELUP", K_MWHEELUP},
{"MWHEELDOWN", K_MWHEELDOWN},
{"PRINTSCREEN", K_PRINTSCREEN},
{"CAPSLOCK", K_CAPSLOCK},
{"SCROLLLOCK", K_SCRLCK},
@ -360,7 +365,6 @@ void Con_ExecuteLine(console_t *con, char *line)
{
qboolean waschat = false;
char deutf8[8192];
extern cvar_t com_parseutf8;
if (com_parseutf8.ival <= 0)
{
unsigned int unicode;
@ -809,7 +813,6 @@ static qboolean utf_specialchevron(unsigned char *start, unsigned char *chev)
//move the cursor one char to the left. cursor must be within the 'start' string.
static unsigned char *utf_left(unsigned char *start, unsigned char *cursor)
{
// extern cvar_t com_parseutf8;
if (cursor == start)
return cursor;
if (1)//com_parseutf8.ival>0)
@ -842,8 +845,6 @@ static unsigned char *utf_left(unsigned char *start, unsigned char *cursor)
//move the cursor one char to the right.
static unsigned char *utf_right(unsigned char *start, unsigned char *cursor)
{
// extern cvar_t com_parseutf8;
//FIXME: should make sure this is not doubled.
if (utf_specialchevron(start, cursor) && cursor[1] == '[')
{
@ -901,7 +902,8 @@ Interactive line editing and console scrollback
*/
void Key_Console (unsigned int unicode, int key)
{
extern cvar_t com_parseutf8;
qboolean ctrl = keydown[K_LCTRL] || keydown[K_RCTRL];
qboolean shift = keydown[K_LSHIFT] || keydown[K_RSHIFT];
char *clipText;
char utf8[8];
@ -913,7 +915,7 @@ void Key_Console (unsigned int unicode, int key)
{
if (key == K_TAB)
{ // command completion
if (keydown[K_CTRL] || keydown[K_SHIFT])
if (ctrl || shift)
{
Con_CycleConsole();
return;
@ -977,7 +979,7 @@ void Key_Console (unsigned int unicode, int key)
return;
}
if (key == K_SPACE && keydown[K_CTRL] && con_current->commandcompletion)
if (key == K_SPACE && ctrl && con_current->commandcompletion)
{
char *txt = key_lines[edit_line]+1;
if (*txt == '/')
@ -991,14 +993,14 @@ void Key_Console (unsigned int unicode, int key)
if (key == K_TAB)
{ // command completion
if (keydown[K_SHIFT])
if (shift)
{
Con_CycleConsole();
return;
}
if (con_current->commandcompletion)
CompleteCommand (keydown[K_CTRL]);
CompleteCommand (ctrl);
return;
}
if (key != K_CTRL && key != K_SHIFT && con_commandmatch)
@ -1006,7 +1008,17 @@ void Key_Console (unsigned int unicode, int key)
if (key == K_LEFTARROW || key == K_KP_LEFTARROW)
{
key_linepos = utf_left(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
if (ctrl)
{
//ignore whitespace if we're at the end of the word
while (key_linepos > 0 && key_lines[edit_line][key_linepos-1] == ' ')
key_linepos = utf_left(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
//keep skipping until we find the start of that word
while (ctrl && key_linepos > 1 && key_lines[edit_line][key_linepos-1] != ' ')
key_linepos = utf_left(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
}
else
key_linepos = utf_left(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
return;
}
if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW)
@ -1014,6 +1026,15 @@ void Key_Console (unsigned int unicode, int key)
if (key_lines[edit_line][key_linepos])
{
key_linepos = utf_right(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
if (ctrl)
{
//skip over the word
while (key_lines[edit_line][key_linepos] && key_lines[edit_line][key_linepos] != ' ')
key_linepos = utf_right(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
//as well as any trailing whitespace
while (key_lines[edit_line][key_linepos] == ' ')
key_linepos = utf_right(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
}
return;
}
else
@ -1098,7 +1119,7 @@ void Key_Console (unsigned int unicode, int key)
if (key == K_PGUP || key == K_KP_PGUP || key==K_MWHEELUP)
{
int i = 2;
if (keydown[K_CTRL])
if (ctrl)
i = 8;
if (!con_current->display)
return;
@ -1115,7 +1136,7 @@ void Key_Console (unsigned int unicode, int key)
if (key == K_PGDN || key == K_KP_PGDN || key==K_MWHEELDOWN)
{
int i = 2;
if (keydown[K_CTRL])
if (ctrl)
i = 8;
if (!con_current->display)
return;
@ -1132,7 +1153,7 @@ void Key_Console (unsigned int unicode, int key)
if (key == K_HOME || key == K_KP_HOME)
{
if (keydown[K_CTRL])
if (ctrl)
con_current->display = con_current->oldest;
else
key_linepos = 1;
@ -1141,7 +1162,7 @@ void Key_Console (unsigned int unicode, int key)
if (key == K_END || key == K_KP_END)
{
if (keydown[K_CTRL])
if (ctrl)
con_current->display = con_current->current;
else
key_linepos = strlen(key_lines[edit_line]);
@ -1149,13 +1170,13 @@ void Key_Console (unsigned int unicode, int key)
}
//beware that windows translates ctrl+c and ctrl+v to a control char
if (((unicode=='C' || unicode=='c' || unicode==3) && keydown[K_CTRL]) || (keydown[K_CTRL] && key == K_INS))
if (((unicode=='C' || unicode=='c' || unicode==3) && ctrl) || (ctrl && key == K_INS))
{
Sys_SaveClipboard(key_lines[edit_line]+1);
return;
}
if (((unicode=='V' || unicode=='v' || unicode==22) && keydown[K_CTRL]) || (keydown[K_SHIFT] && key == K_INS))
if (((unicode=='V' || unicode=='v' || unicode==22) && ctrl) || (shift && key == K_INS))
{
clipText = Sys_GetClipboard();
if (clipText)
@ -1197,7 +1218,7 @@ void Key_Console (unsigned int unicode, int key)
}
else if (com_parseutf8.ival >= 0) //don't do this for iso8859-1. the major user of that is hexen2 which doesn't have these chars.
{
if (keydown[K_CTRL] && !keydown[K_RALT])
if (ctrl && !keydown[K_RALT])
{
if (unicode >= '0' && unicode <= '9')
unicode = unicode - '0' + 0xe012; // yellow number
@ -1678,10 +1699,12 @@ void Key_Init (void)
consolekeys[K_KP_PGUP] = true;
consolekeys[K_PGDN] = true;
consolekeys[K_KP_PGDN] = true;
consolekeys[K_SHIFT] = true;
consolekeys[K_LSHIFT] = true;
consolekeys[K_RSHIFT] = true;
consolekeys[K_MWHEELUP] = true;
consolekeys[K_MWHEELDOWN] = true;
consolekeys[K_CTRL] = true;
consolekeys[K_LCTRL] = true;
consolekeys[K_RCTRL] = true;
consolekeys[K_LALT] = true;
consolekeys[K_RALT] = true;
consolekeys['`'] = false;
@ -1789,20 +1812,20 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
// Con_Printf ("%i : %i : %i\n", key, unicode, down); //@@@
oldstate = KeyModifier(keydown[K_SHIFT], keydown[K_LALT]|keydown[K_RALT], keydown[K_CTRL]);
oldstate = KeyModifier(keydown[K_LSHIFT]|keydown[K_RSHIFT], keydown[K_LALT]|keydown[K_RALT], keydown[K_LCTRL]|keydown[K_RCTRL]);
keydown[key] = down;
if (key == K_SHIFT || key == K_LALT || key == K_RALT || key == K_CTRL)
if (key == K_LSHIFT || key == K_RSHIFT || key == K_LALT || key == K_RALT || key == K_LCTRL || key == K_RCTRL)
{
int k;
keystate = KeyModifier(keydown[K_SHIFT], keydown[K_LALT]|keydown[K_RALT], keydown[K_CTRL]);
keystate = KeyModifier(keydown[K_LSHIFT]|keydown[K_RSHIFT], keydown[K_LALT]|keydown[K_RALT], keydown[K_LCTRL]|keydown[K_RCTRL]);
for (k = 0; k < K_MAX; k++)
{ //go through the old state removing all depressed keys. they are all up now.
if (k == K_SHIFT || k == K_LALT || key == K_RALT || k == K_CTRL)
if (k == K_LSHIFT || k == K_RSHIFT || k == K_LALT || k == K_RALT || k == K_LCTRL || k == K_RCTRL)
continue;
if (deltaused[k][oldstate])
@ -1882,9 +1905,9 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
// Con_Printf ("%s is unbound, hit F4 to set.\n", Key_KeynumToString (key) );
}
if (key == K_SHIFT)
if (key == K_LSHIFT || key == K_RSHIFT)
{
shift_down = down;
shift_down = keydown[K_LSHIFT]|keydown[K_RSHIFT];
}
if (key == K_ESCAPE)
@ -2001,6 +2024,13 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
return;
deltaused[key][keystate] = false;
if (key == K_RALT) //simulate a singular alt for binds. really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
key = K_ALT;
if (key == K_RCTRL) //simulate a singular alt for binds. really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
key = K_CTRL;
if (key == K_RSHIFT)//simulate a singular alt for binds. really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
key = K_SHIFT;
if (devid)
Q_snprintfz (p, sizeof(p), "p %i ", devid+1);
else
@ -2061,6 +2091,10 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
if (key == K_RALT) //simulate a singular alt for binds. really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
key = K_ALT;
if (key == K_RCTRL) //simulate a singular alt for binds. really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
key = K_CTRL;
if (key == K_RSHIFT)//simulate a singular alt for binds. really though, this code should translate to csqc/menu keycodes and back to resolve the weirdness instead.
key = K_SHIFT;
kb = keybindings[key][keystate];
if (kb)

View File

@ -159,14 +159,15 @@ K_SEARCH = 242,
K_VOLUP = 243,
K_VOLDOWN = 244,
K_RALT = 245,
K_RCTRL = 246,
K_RSHIFT = 247,
K_PRINTSCREEN = 248,
K_MAX = 256
};
#define K_SHIFT K_LSHIFT
#define K_RSHIFT K_LSHIFT
#define K_CTRL K_LCTRL
#define K_RCTRL K_LCTRL
#define K_ALT K_LALT
typedef enum {key_game, key_console, key_message, key_menu, key_editor} keydest_t;

View File

@ -1901,10 +1901,12 @@ void Media_Gecko_KeyPress (struct cin_s *cin, int code, int unicode, int event)
case K_ENTER:
code = OSGKKey_Return;
break;
case K_SHIFT:
case K_LSHIFT:
case K_RSHIFT:
code = OSGKKey_Shift;
break;
case K_CTRL:
case K_LCTRL:
case K_RCTRL:
code = OSGKKey_Control;
break;
case K_LALT:

View File

@ -93,8 +93,6 @@ extern void (*R_LessenStains) (void);
extern qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
extern void (*VID_DeInit) (void);
extern void (*VID_SetPalette) (unsigned char *palette);
extern void (*VID_ShiftPalette) (unsigned char *palette);
extern char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
extern void (*VID_SetWindowCaption) (char *msg);
@ -160,6 +158,8 @@ extern int r_regsequence;
typedef struct
{
int regsequence;
int width;
int height;
} texcom_t;
struct texid_s
{
@ -313,8 +313,7 @@ typedef struct rendererinfo_s {
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
void (*VID_DeInit) (void);
void (*VID_SetPalette) (unsigned char *palette);
void (*VID_ShiftPalette) (unsigned char *palette);
qboolean (*VID_ApplyGammaRamps) (unsigned short *ramps);
char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
void (*VID_SetWindowCaption) (char *msg);

View File

@ -23,8 +23,10 @@ int MP_TranslateFTEtoQCCodes(int code)
case K_RIGHTARROW: return 131;
case K_LALT: return 132;
case K_RALT: return 132;
case K_CTRL: return 133;
case K_SHIFT: return 134;
case K_LCTRL: return 133;
case K_RCTRL: return 133;
case K_LSHIFT: return 134;
case K_RSHIFT: return 134;
case K_F1: return 135;
case K_F2: return 136;
case K_F3: return 137;
@ -125,8 +127,8 @@ int MP_TranslateQCtoFTECodes(int code)
case 130: return K_LEFTARROW;
case 131: return K_RIGHTARROW;
case 132: return K_LALT;
case 133: return K_CTRL;
case 134: return K_SHIFT;
case 133: return K_LCTRL;
case 134: return K_LSHIFT;
case 135: return K_F1;
case 136: return K_F2;
case 137: return K_F3;

View File

@ -2150,24 +2150,24 @@ static void QCBUILTIN PF_cs_getinputstate (pubprogfuncs_t *prinst, struct global
extern usercmd_t independantphysics[MAX_SPLITS];
f = G_FLOAT(OFS_PARM0);
if (cl.paused && f >= cls.netchan.incoming_sequence)
if (cl.paused && f >= cl.ackedmovesequence)
{
G_FLOAT(OFS_RETURN) = false;
return;
}
if (f > cls.netchan.outgoing_sequence)
if (f > cl.movesequence)
{
G_FLOAT(OFS_RETURN) = false;
return;
}
if (f < cls.netchan.outgoing_sequence - UPDATE_MASK || f < 0)
if (f < cl.movesequence - UPDATE_MASK || f < 0)
{
G_FLOAT(OFS_RETURN) = false;
return;
}
/*outgoing_sequence says how many packets have actually been sent, but there's an extra pending packet which has not been sent yet - be warned though, its data will change in the coming frames*/
if (f == cls.netchan.outgoing_sequence)
if (f == cl.movesequence)
{
cmd = &independantphysics[csqc_lplayernum];
for (f=0 ; f<3 ; f++)

View File

@ -434,7 +434,7 @@ void QCBUILTIN PF_CL_drawcharacter (pubprogfuncs_t *prinst, struct globalvars_s
float *size = G_VECTOR(OFS_PARM2);
float *rgb = G_VECTOR(OFS_PARM3);
float alpha = G_FLOAT(OFS_PARM4);
// float flag = G_FLOAT(OFS_PARM5);
int flag = G_FLOAT(OFS_PARM5);
float x, y;
@ -445,14 +445,17 @@ void QCBUILTIN PF_CL_drawcharacter (pubprogfuncs_t *prinst, struct globalvars_s
}
//no control chars. use quake ones if so
if (chara < 32 && chara != '\t')
chara |= 0xe000;
if (!(flag & 4))
if (chara < 32 && chara != '\t')
chara |= 0xe000;
r2d_be_flags = PF_SelectDPDrawFlag(flag);
PR_CL_BeginString(prinst, pos[0], pos[1], size[0], size[1], &x, &y);
Font_ForceColour(rgb[0], rgb[1], rgb[2], alpha);
Font_DrawScaleChar(x, y, CON_WHITEMASK | chara);
Font_InvalidateColour();
Font_EndString(NULL);
r2d_be_flags = 0;
G_FLOAT(OFS_RETURN) = 1;
}
@ -1810,7 +1813,7 @@ void MP_Keydown(int key, int unicode)
if (key == 'c')
{
if (keydown[K_CTRL])
if (keydown[K_LCTRL] || keydown[K_RCTRL])
{
MP_Shutdown();
M_Init_Internal();
@ -1819,7 +1822,7 @@ void MP_Keydown(int key, int unicode)
}
if (key == K_ESCAPE)
{
if (keydown[K_SHIFT])
if (keydown[K_LSHIFT] || keydown[K_RSHIFT])
{
Con_ToggleConsole_f();
return;

View File

@ -1515,15 +1515,15 @@ void QCBUILTIN PF_skel_ragedit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
if (*ragname)
{
int idx;
char *cmd;
ragname = Cmd_TokenizeString(ragname, false, false);
cmd = Cmd_Argv(0);
if (!stricmp(cmd, "enablejoint"))
{
idx = rag_finddolljoint(sko->doll, Cmd_Argv(1));
World_ODE_RagEnableJoint(&sko->joint[idx], atoi(Cmd_Argv(2)));
int idx = rag_finddolljoint(sko->doll, Cmd_Argv(1));
int enable = atoi(Cmd_Argv(2));
World_ODE_RagEnableJoint(&sko->joint[idx], enable);
G_FLOAT(OFS_RETURN) = 1;
return;
}

View File

@ -251,6 +251,8 @@ extern cvar_t fs_gamename;
extern cvar_t fs_gamedownload;
extern cvar_t com_protocolname;
extern cvar_t com_modname;
extern cvar_t com_nogamedirnativecode;
extern cvar_t com_parseutf8;
extern cvar_t sys_ticrate;
extern cvar_t sys_nostdout;
extern cvar_t developer;

View File

@ -3,6 +3,7 @@
#include "shader.h"
#include "gl_draw.h"
qboolean r2d_noshadergamma; //says the video code has successfully activated hardware gamma
texid_t missing_texture;
texid_t missing_texture_gloss;
@ -21,6 +22,7 @@ mpic_t *draw_disc;
shader_t *shader_contrastup;
shader_t *shader_contrastdown;
shader_t *shader_brightness;
shader_t *shader_gammacb;
shader_t *shader_polyblend;
shader_t *shader_menutint;
@ -34,7 +36,6 @@ unsigned int r2d_be_flags;
extern cvar_t scr_conalpha;
extern cvar_t gl_conback;
extern cvar_t gl_font;
extern cvar_t gl_contrast, gl_brightness;
extern cvar_t gl_screenangle;
extern cvar_t vid_conautoscale;
extern cvar_t vid_conheight;
@ -232,6 +233,16 @@ void R2D_Init(void)
"}\n"
"}\n"
);
shader_gammacb = R_RegisterShader("gammacbshader",
"{\n"
"program defaultgammacb\n"
"cull back\n"
"{\n"
"map $currentrender\n"
"nodepthtest\n"
"}\n"
"}\n"
);
shader_polyblend = R_RegisterShader("polyblendshader",
"{\n"
"program defaultfill\n"
@ -801,43 +812,55 @@ void R2D_BrightenScreen (void)
RSpeedMark();
if (gl_contrast.value == 1.0 && gl_brightness.value == 0)
if (v_contrast.value == 1.0 && v_brightness.value == 0 && v_gamma.value == 1)
return;
if (r_refdef.flags & Q2RDF_NOWORLDMODEL)
return;
f = gl_contrast.value;
f = min (f, 3);
if (r2d_noshadergamma)
return;
while (f > 1)
if (v_gamma.value != 1 && shader_gammacb->prog)
{
if (f >= 2)
{
R2D_ImageColours (1, 1, 1, 1);
f *= 0.5;
}
else
{
R2D_ImageColours (f - 1, f - 1, f - 1, 1);
f = 1;
}
R2D_ScalePic(0, 0, vid.width, vid.height, shader_contrastup);
//this should really be done properly, with render-to-texture
R2D_ImageColours (v_gamma.value, v_contrast.value, v_brightness.value, 1);
R2D_ScalePic(0, vid.height, vid.width, -(int)vid.height, shader_gammacb);
}
if (f < 1)
else
{
R2D_ImageColours (f, f, f, 1);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_contrastdown);
}
f = v_contrast.value;
f = min (f, 3);
if (gl_brightness.value)
{
R2D_ImageColours (gl_brightness.value, gl_brightness.value, gl_brightness.value, 1);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_brightness);
while (f > 1)
{
if (f >= 2)
{
R2D_ImageColours (1, 1, 1, 1);
f *= 0.5;
}
else
{
R2D_ImageColours (f - 1, f - 1, f - 1, 1);
f = 1;
}
R2D_ScalePic(0, 0, vid.width, vid.height, shader_contrastup);
}
if (f < 1)
{
R2D_ImageColours (f, f, f, 1);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_contrastdown);
}
if (v_brightness.value)
{
R2D_ImageColours (v_brightness.value, v_brightness.value, v_brightness.value, 1);
R2D_ScalePic(0, 0, vid.width, vid.height, shader_brightness);
}
}
R2D_ImageColours (1, 1, 1, 1);
/*make sure the hud is drawn if needed*/
/*make sure the hud is redrawn after if needed*/
Sbar_Changed();
RSpeedEnd(RSPEED_PALETTEFLASHES);

View File

@ -261,8 +261,6 @@ cvar_t gl_compress = CVARF ("gl_compress", "0",
CVAR_ARCHIVE);
cvar_t gl_conback = CVARFC ("gl_conback", "",
CVAR_RENDERERCALLBACK, R2D_Conback_Callback);
cvar_t gl_contrast = CVAR ("gl_contrast", "1");
cvar_t gl_brightness = CVAR ("gl_brightness", "0");
cvar_t gl_detail = CVARF ("gl_detail", "0",
CVAR_ARCHIVE);
cvar_t gl_detailscale = CVAR ("gl_detailscale", "5");
@ -372,8 +370,8 @@ cvar_t r_lavastyle = CVARFD ("r_lavastyle", "1", CVAR_ARCHIVE|CVAR_SHADERS
cvar_t r_vertexdlights = SCVAR ("r_vertexdlights", "0");
cvar_t vid_preservegamma = SCVAR ("vid_preservegamma", "0");
cvar_t vid_hardwaregamma = SCVARF ("vid_hardwaregamma", "1",
CVAR_ARCHIVE | CVAR_RENDERERLATCH);
cvar_t vid_hardwaregamma = CVARFD ("vid_hardwaregamma", "1",
CVAR_ARCHIVE | CVAR_RENDERERLATCH, "Use hardware gamma ramps. 0=loadtime-gamma, 1=glsl(windowed) or hardware(fullscreen), 2=always glsl, 3=always hardware gamma.");
cvar_t vid_desktopgamma = CVARFD ("vid_desktopgamma", "0",
CVAR_ARCHIVE | CVAR_RENDERERLATCH, "Apply gamma ramps upon the desktop rather than the window.");
@ -676,8 +674,6 @@ void Renderer_Init(void)
Cvar_Register(&r_fullbrightSkins, GRAPHICALNICETIES);
Cvar_Register (&mod_md3flags, GRAPHICALNICETIES);
Cvar_Register (&gl_contrast, GLRENDEREROPTIONS);
Cvar_Register (&gl_brightness, GLRENDEREROPTIONS);
//renderer
@ -790,8 +786,6 @@ float (*Mod_GetFrameDuration) (struct model_s *model, int framenum);
qboolean (*VID_Init) (rendererstate_t *info, unsigned char *palette);
void (*VID_DeInit) (void);
void (*VID_SetPalette) (unsigned char *palette);
void (*VID_ShiftPalette) (unsigned char *palette);
char *(*VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight);
void (*VID_SetWindowCaption) (char *msg);
@ -860,8 +854,7 @@ rendererinfo_t dedicatedrendererinfo = {
NULL, //VID_Init,
NULL, //VID_DeInit,
NULL, //VID_SetPalette,
NULL, //VID_ShiftPalette,
NULL, //VID_ApplyGammaRamps,
NULL, //VID_GetRGBInfo,
@ -946,8 +939,6 @@ void R_SetRenderer(rendererinfo_t *ri)
VID_Init = ri->VID_Init;
VID_DeInit = ri->VID_DeInit;
VID_SetPalette = ri->VID_SetPalette;
VID_ShiftPalette = ri->VID_ShiftPalette;
VID_GetRGBInfo = ri->VID_GetRGBInfo;
VID_SetWindowCaption = ri->VID_SetWindowCaption;

View File

@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern cvar_t hud_tracking_show;
extern cvar_t com_parseutf8;
#define CON_ALTMASK (CON_2NDCHARSETTEXT|CON_WHITEMASK)
cvar_t scr_scoreboard_drawtitle = SCVAR("scr_scoreboard_drawtitle", "1");

View File

@ -386,14 +386,6 @@ void *Sys_GetAddressForName(dllhandle_t *module, const char *exportname)
{
return dlsym(module, exportname);
}
void *Sys_GetGameAPI (void *parms)
{
//don't implement - fix q2 code instead
return NULL;
}
void Sys_UnloadGame(void)
{
}
char *Sys_ConsoleInput (void)
{
return NULL;

View File

@ -492,61 +492,6 @@ unsigned int Sys_Milliseconds (void)
return Sys_DoubleTime() * 1000;
}
static void *game_library;
void Sys_UnloadGame(void)
{
if (game_library)
{
dlclose(game_library);
game_library = 0;
}
}
void *Sys_GetGameAPI(void *parms)
{
void *(*GetGameAPI)(void *);
char name[MAX_OSPATH];
char curpath[MAX_OSPATH];
char *searchpath;
const char *agamename = "gamei386.so";
const char *ggamename = "game.so";
void *ret;
getcwd(curpath, sizeof(curpath)); // do something with result?
#ifdef warningmsg
#pragma warningmsg("Search for both gamei386.so and game.so")
#endif
Con_DPrintf("Searching for %s but not %s\n", agamename, ggamename);
searchpath = 0;
while((searchpath = COM_NextPath(searchpath)))
{
if (searchpath[0] == '/')
snprintf(name, sizeof(name), "%s/%s", searchpath, agamename);
else
snprintf(name, sizeof(name), "%s/%s/%s", curpath, searchpath, agamename);
game_library = dlopen (name, RTLD_NOW | RTLD_LOCAL);
if (game_library)
{
GetGameAPI = (void *)dlsym (game_library, "GetGameAPI");
if (GetGameAPI && (ret = GetGameAPI(parms)))
{
return ret;
}
dlclose(game_library);
game_library = 0;
}
}
return 0;
}
void Sys_CloseLibrary(dllhandle_t *lib)
{
dlclose((void*)lib);

View File

@ -295,64 +295,6 @@ qboolean Sys_Rename (char *oldfname, char *newfname)
return !rename(oldfname, newfname);
}
/* Quake 2 stuff */
static void *gamefile;
void *Sys_GetGameAPI(void *parms)
{
int (*q2_so_init)(void);
void (*q2_so_deinit)(void);
void *(*GetGameAPI)(void *);
void *ret;
char *searchpath;
char path[256];
searchpath = 0;
while((searchpath = COM_NextPath(searchpath)))
{
snprintf(path, sizeof(path), "%s%sgameppc.so", searchpath[0]!='.'?searchpath:"", searchpath[0]&&searchpath[0]!='.'?"/":"");
gamefile = dlopen(path, RTLD_NOW);
if (gamefile)
{
q2_so_init = dlsym(gamefile, "q2_so_init");
q2_so_deinit = dlsym(gamefile, "q2_so_deinit");
if (q2_so_init && q2_so_init())
{
GetGameAPI = dlsym(gamefile, "GetGameAPI");
if (GetGameAPI && (ret = GetGameAPI(parms)))
{
return ret;
}
if (q2_so_deinit)
q2_so_deinit();
}
dlclose(gamefile);
gamefile = 0;
}
}
return 0;
}
void Sys_UnloadGame(void)
{
void (*q2_so_deinit)(void);
if (gamefile)
{
q2_so_deinit = dlsym(gamefile, "q2_so_deinit");
if (q2_so_deinit)
q2_so_deinit();
dlclose(gamefile);
gamefile = 0;
}
}
void Sys_CloseLibrary(dllhandle_t *lib)
{
dlclose((void*)lib);

View File

@ -341,56 +341,7 @@ void *Sys_GetAddressForName(dllhandle_t *module, const char *exportname)
return SDL_LoadFunction((void *)module, exportname);
}
//Without these two we cannot run Q2 gamecode.
dllhandle_t *q2gamedll;
void Sys_UnloadGame (void)
{
if (q2gamedll)
Sys_CloseLibrary(q2gamedll);
q2gamedll = NULL;
}
void *Sys_GetGameAPI (void *parms)
{
void *(*GetGameAPI)(void *);
dllfunction_t funcs[] =
{
{(void**)&GetGameAPI, "GetGameAPI"},
{NULL,NULL}
};
char name[MAX_OSPATH];
char curpath[MAX_OSPATH];
char *searchpath;
const char *gamename = "gamesdl.so";
void *ret;
Con_DPrintf("Searching for %s\n", gamename);
searchpath = 0;
while((searchpath = COM_NextPath(searchpath)))
{
if (searchpath[0] == '/')
snprintf(name, sizeof(name), "%s/%s", searchpath, gamename);
else
snprintf(name, sizeof(name), "./%s/%s", searchpath, gamename);
q2gamedll = Sys_LoadLibrary(name, funcs);
if (q2gamedll && gamename)
{
ret = GetGameAPI(parms);
if (ret)
{
return ret;
}
Sys_CloseLibrary(q2gamedll);
q2gamedll = 0;
}
}
return NULL;
}

View File

@ -197,121 +197,6 @@ char *Sys_GetNameForAddress(dllhandle_t *module, void *address)
}
#endif
#ifdef Q2SERVER
static HINSTANCE game_library;
/*
=================
Sys_UnloadGame
=================
*/
void Sys_UnloadGame (void)
{
if (!FreeLibrary (game_library))
Sys_Error ("FreeLibrary failed for game library");
game_library = NULL;
}
/*
=================
Sys_GetGameAPI
Loads the game dll
=================
*/
void *Sys_GetGameAPI (void *parms)
{
void *(VARGS *GetGameAPI) (void *);
char name[MAX_OSPATH];
char *path;
char cwd[MAX_OSPATH];
#if defined _M_IX86
const char *gamename = "gamex86.dll";
#ifdef NDEBUG
const char *debugdir = "release";
#else
const char *debugdir = "debug";
#endif
#elif defined(__amd64__) || defined(__AMD64__) || defined(_AMD64_)
const char *gamename = "gameamd.dll";
#ifdef NDEBUG
const char *debugdir = "release";
#else
const char *debugdir = "debug";
#endif
#elif defined _M_ALPHA
const char *gamename = "gameaxp.dll";
#ifdef NDEBUG
const char *debugdir = "releaseaxp";
#else
const char *debugdir = "debugaxp";
#endif
#endif
if (game_library)
Sys_Error ("Sys_GetGameAPI without Sys_UnloadingGame");
// check the current debug directory first for development purposes
#ifdef _WIN32
GetCurrentDirectory(sizeof(cwd), cwd);
#else
_getcwd (cwd, sizeof(cwd));
#endif
snprintf (name, sizeof(name), "%s/%s/%s", cwd, debugdir, gamename);
game_library = LoadLibrary ( name );
if (game_library)
{
Con_DPrintf ("LoadLibrary (%s)\n", name);
}
else
{
#ifdef DEBUG
// check the current directory for other development purposes
_snprintf (name, sizeof(name), "%s/%s", cwd, gamename);
game_library = LoadLibrary ( name );
if (game_library)
{
Con_DPrintf ("LoadLibrary (%s)\n", name);
}
else
#endif
{
// now run through the search paths
path = NULL;
while (1)
{
path = COM_NextPath (path);
if (!path)
return NULL; // couldn't find one anywhere
snprintf (name, sizeof(name), "%s/%s", path, gamename);
game_library = LoadLibrary (name);
if (game_library)
{
Con_DPrintf ("LoadLibrary (%s)\n",name);
break;
}
}
}
}
GetGameAPI = (void *)GetProcAddress (game_library, "GetGameAPI");
if (!GetGameAPI)
{
Sys_UnloadGame ();
return NULL;
}
return GetGameAPI (parms);
}
#endif
#define MINIMUM_WIN_MEMORY MINIMUM_MEMORY
#define MAXIMUM_WIN_MEMORY 0x8000000
@ -731,22 +616,30 @@ LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam)
case HC_ACTION:
{
//Trap the Left Windowskey
if (pkbhs->vkCode == VK_LWIN)
if (pkbhs->vkCode == VK_SNAPSHOT)
{
Key_Event (0, K_LWIN, 0, !(pkbhs->flags & LLKHF_UP));
IN_KeyEvent (0, !(pkbhs->flags & LLKHF_UP), K_PRINTSCREEN, 0);
return 1;
}
//Trap the Right Windowskey
if (pkbhs->vkCode == VK_RWIN)
if (sys_disableWinKeys.ival)
{
Key_Event (0, K_RWIN, 0, !(pkbhs->flags & LLKHF_UP));
return 1;
}
//Trap the Application Key (what a pointless key)
if (pkbhs->vkCode == VK_APPS)
{
Key_Event (0, K_APP, 0, !(pkbhs->flags & LLKHF_UP));
return 1;
if (pkbhs->vkCode == VK_LWIN)
{
IN_KeyEvent (0, !(pkbhs->flags & LLKHF_UP), K_LWIN, 0);
return 1;
}
//Trap the Right Windowskey
if (pkbhs->vkCode == VK_RWIN)
{
IN_KeyEvent(0, !(pkbhs->flags & LLKHF_UP), K_RWIN, 0);
return 1;
}
//Trap the Application Key (what a pointless key)
if (pkbhs->vkCode == VK_APPS)
{
IN_KeyEvent (0, !(pkbhs->flags & LLKHF_UP), K_APP, 0);
return 1;
}
}
// Disable CTRL+ESC
@ -1292,7 +1185,6 @@ char *Sys_GetClipboard(void)
unsigned short *clipWText;
if (OpenClipboard(NULL))
{
extern cvar_t com_parseutf8;
//windows programs interpret CF_TEXT as ansi (aka: gibberish)
//so grab utf-16 text and convert it to utf-8 if our console parsing is set to accept that.
if (com_parseutf8.ival > 0)
@ -1360,7 +1252,6 @@ void Sys_SaveClipboard(char *text)
HANDLE glob;
char *temp;
unsigned short *tempw;
extern cvar_t com_parseutf8;
if (!OpenClipboard(NULL))
return;
EmptyClipboard();
@ -1760,22 +1651,8 @@ HWND hwnd_dialog;
#define COBJMACROS
#ifndef MINGW
#if _MSC_VER > 1200
#include <shobjidl.h>
#endif
#endif
#if _MSC_VER > 1200
#include <shlguid.h>
#endif
#include <shlobj.h>
//#include <Propsys.h>
#ifdef _MSC_VER
#include "ntverp.h"
#endif
// SDK version 7600 = v7.0a & v7.1
typedef struct qSHARDAPPIDINFOLINK {
IShellLinkW *psl;
PCWSTR pszAppID;
@ -3007,7 +2884,7 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
sleeptime = Host_Frame (time);
oldtime = newtime;
SetHookState(sys_disableWinKeys.ival);
SetHookState(ActiveApp);
/*sleep if its not yet time for a frame*/
Sys_Sleep(sleeptime);

View File

@ -500,12 +500,14 @@ void Editor_Key(int key, int unicode)
*/
switch (key)
{
case K_SHIFT:
case K_LSHIFT:
case K_RSHIFT:
break;
case K_LALT:
case K_RALT:
break;
case K_CTRL:
case K_LCTRL:
case K_RCTRL:
break;
case K_MWHEELUP:
case K_UPARROW:
@ -695,7 +697,7 @@ void Editor_Key(int key, int unicode)
case K_LEFTARROW:
cursorx--;
if (keydown[K_CTRL])
if (keydown[K_LCTRL] || keydown[K_RCTRL])
{
//skip additional whitespace
while(cursorx > 0 && (cursorblock->data[cursorx-1] == ' ' || cursorblock->data[cursorx-1] <= '\t'))
@ -711,7 +713,7 @@ void Editor_Key(int key, int unicode)
break;
case K_RIGHTARROW:
if (keydown[K_CTRL])
if (keydown[K_LCTRL] || keydown[K_RCTRL])
{
while(cursorx+1 < cursorblock->datalength && ((cursorblock->data[cursorx] >= 'a' && cursorblock->data[cursorx] <= 'z') ||
(cursorblock->data[cursorx] >= 'A' && cursorblock->data[cursorx] <= 'Z') ||

View File

@ -69,11 +69,8 @@ extern viddef_t vid; // global video state
extern unsigned int d_8to24rgbtable[256];
#ifdef GLQUAKE
void GLVID_SetPalette (unsigned char *palette);
// called at startup and after any gamma correction
void GLVID_ShiftPalette (unsigned char *palette);
// called for bonus and pain flashes, and for underwater color changes
//called when gamma ramps need to be reapplied
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps);
qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette);
// Called at startup to set up translation tables, takes 256 8 bit RGB values

View File

@ -45,8 +45,6 @@ cvar_t vsec_scaley[SIDEVIEWS] = {SCVAR("v2_scaley", "0.25"), SCVAR("v3_scaley",
cvar_t vsec_yaw[SIDEVIEWS] = {SCVAR("v2_yaw", "180"), SCVAR("v3_yaw", "90"), SCVAR("v4_yaw", "270"), SCVAR("v5_yaw", "0")};
#endif
cvar_t lcd_x = SCVAR("lcd_x", "0"); // FIXME: make this work sometime...
cvar_t cl_rollspeed = SCVAR("cl_rollspeed", "200");
cvar_t cl_rollangle = SCVAR("cl_rollangle", "2.0");
cvar_t v_deathtilt = SCVAR("v_deathtilt", "1");
@ -301,7 +299,8 @@ cshift_t cshift_lava = { {255,80,0}, 150 };
cshift_t cshift_server = { {130,80,50}, 0 };
cvar_t v_gamma = SCVARF("gamma", "0.8", CVAR_ARCHIVE|CVAR_RENDERERCALLBACK);
cvar_t v_contrast = SCVARF("contrast", "1.4", CVAR_ARCHIVE);
cvar_t v_contrast = SCVARF("contrast", "1.3", CVAR_ARCHIVE);
cvar_t v_brightness = SCVARF("brightness", "0.0", CVAR_ARCHIVE);
qbyte gammatable[256]; // palette is sent through this
@ -332,7 +331,7 @@ void BuildGammaTable (float g)
gammatable[i] = inf;
}
}*/
void BuildGammaTable (float g, float c)
void BuildGammaTable (float g, float c, float b)
{
int i, inf;
@ -348,7 +347,8 @@ void BuildGammaTable (float g, float c)
for (i = 0; i < 256; i++)
{
inf = 255 * pow ((i + 0.5) / 255.5 * c, g) + 0.5;
//the 0.5s are for rounding.
inf = 255 * (pow ((i + 0.5) / 255.5 * c, g) + b) + 0.5;
if (inf < 0)
inf = 0;
else if (inf > 255)
@ -365,7 +365,7 @@ V_CheckGamma
#if defined(GLQUAKE) || defined(D3DQUAKE)
void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue)
{
BuildGammaTable (v_gamma.value, v_contrast.value);
BuildGammaTable (v_gamma.value, v_contrast.value, v_brightness.value);
vid.recalc_refdef = 1; // force a surface cache flush
V_UpdatePalette (true);
}
@ -639,6 +639,7 @@ V_CalcBlend
*/
void V_CalcBlend (float *hw_blend)
{
extern qboolean r2d_noshadergamma;
float a2;
int j;
float *blend;
@ -671,7 +672,7 @@ void V_CalcBlend (float *hw_blend)
}
else
{
if (j == CSHIFT_BONUS || j == CSHIFT_DAMAGE || gl_nohwblend.ival)
if (j == CSHIFT_BONUS || j == CSHIFT_DAMAGE || gl_nohwblend.ival || r2d_noshadergamma)
blend = sw_blend;
else //powerup or contents?
blend = hw_blend;
@ -701,10 +702,12 @@ V_UpdatePalette
*/
void V_UpdatePalette (qboolean force)
{
extern qboolean r2d_noshadergamma;
int i;
float newhw_blend[4];
int ir, ig, ib;
float ftime;
qboolean applied;
static double oldtime;
RSpeedMark();
@ -755,7 +758,10 @@ void V_UpdatePalette (qboolean force)
ramps[2][i] = gammatable[ib]<<8;
}
VID_ShiftPalette (NULL);
applied = rf->VID_ApplyGammaRamps ((unsigned short*)ramps);
if (!applied && r2d_noshadergamma)
rf->VID_ApplyGammaRamps (NULL);
r2d_noshadergamma = applied;
}
RSpeedEnd(RSPEED_PALETTEFLASHES);
@ -1589,7 +1595,8 @@ void V_Init (void)
Cvar_Register (&ffov, VIEWVARS);
BuildGammaTable (1.0, 1.0); // no gamma yet
BuildGammaTable (1.0, 1.0, 0.0); // no gamma yet
Cvar_Register (&v_gamma, VIEWVARS);
Cvar_Register (&v_contrast, VIEWVARS);
Cvar_Register (&v_brightness, VIEWVARS);
}

View File

@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// view.h
extern cvar_t v_gamma;
extern cvar_t v_contrast;
extern cvar_t lcd_x;
extern cvar_t v_contrast;
extern cvar_t v_brightness;
extern float sw_blend[4];
extern float hw_blend[4];

View File

@ -255,6 +255,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define VOICECHAT
#if defined(_WIN32) && !defined(MULTITHREAD) //always thread on win32 non-minimal builds
#define MULTITHREAD
#endif
//these things were moved to plugins.
#endif

View File

@ -1970,7 +1970,7 @@ void Cmd_ExecuteString (char *text, int level)
#ifndef SERVERONLY //an emergency escape mechansim, to avoid infinatly recursing aliases.
extern qboolean keydown[];
if (keydown[K_SHIFT] && keydown[K_CTRL] && (keydown[K_LALT]||keydown[K_RALT]))
if (keydown[K_SHIFT] && (keydown[K_LCTRL]||keydown[K_RCTRL]) && (keydown[K_LALT]||keydown[K_RALT]))
return;
#endif

View File

@ -99,6 +99,7 @@ cvar_t com_protocolname = CVARD("com_gamename", "", "The game name used for dpma
cvar_t com_modname = CVARD("com_modname", "", "dpmaster information");
cvar_t com_parseutf8 = CVARD("com_parseutf8", "0", "Interpret console messages/playernames/etc as UTF-8. Requires special fonts. -1=iso 8859-1. 0=quakeascii(chat uses high chars). 1=utf8, revert to ascii on decode errors. 2=utf8 ignoring errors"); //1 parse. 2 parse, but stop parsing that string if a char was malformed.
cvar_t com_highlightcolor = CVARD("com_highlightcolor", STRINGIFY(COLOR_RED), "ANSI colour to be used for highlighted text, used when com_parseutf8 is active.");
cvar_t com_nogamedirnativecode = CVARFD("com_nogamedirnativecode", "1", CVAR_NOTFROMSERVER, FULLENGINENAME" blocks all downloads of files with a .dll or .so extension, however other engines (eg: ezquake and fodquake) do not - this omission can be used to trigger remote exploits in any engine (including "FULLENGINENAME"which is later run from the same gamedir.\nQuake2, Quake3(when debugging), and KTX typically run native gamecode from within gamedirs, so if you wish to run any of these games you will need to ensure this cvar is changed to 0, as well as ensure that you don't run unsafe clients.\n");
qboolean com_modified; // set true if using non-id files
@ -3963,6 +3964,7 @@ void COM_Init (void)
Cvar_Register (&gameversion, "Gamecode");
Cvar_Register (&gameversion_min, "Gamecode");
Cvar_Register (&gameversion_max, "Gamecode");
Cvar_Register (&com_nogamedirnativecode, "Gamecode");
Cvar_Register (&com_parseutf8, "Internationalisation");
Cvar_Register (&com_highlightcolor, "Internationalisation");
com_parseutf8.ival = 1;

View File

@ -1705,7 +1705,9 @@ void COM_Gamedir (const char *dir)
searchpath_t *next;
qboolean isbase;
if (!*dir || !strcmp(dir, ".") || strstr(dir, "..") || strstr(dir, "/")
//don't allow leading dots, hidden files are evil.
//don't allow complex paths. those are evil too.
if (!*dir || *dir == '.' || !strcmp(dir, ".") || strstr(dir, "..") || strstr(dir, "/")
|| strstr(dir, "\\") || strstr(dir, ":") )
{
Con_TPrintf (TL_GAMEDIRAINTPATH);
@ -1828,9 +1830,9 @@ void COM_Gamedir (const char *dir)
/*set some stuff so our regular qw client appears more like hexen2*/
#define HEX2CFG "set com_parseutf8 -1\nset gl_font gfx/hexen2\nset in_builtinkeymap 0\nset_calc cl_playerclass int (random * 5) + 1\nset sv_maxspeed 640\nset watervis 1\nset r_wateralpha 0.5\nset sv_pupglow 1\nset cl_model_bobbing 1\nsv_sound_land \"fx/thngland.wav\"\n"
/*yay q2!*/
#define Q2CFG "gl_font \":?col=0.44 1 0.2\"\n"
#define Q2CFG "gl_font \":?col=0.44 1 0.2\"\ncom_nogamedirnativecode 0\n"
/*Q3's ui doesn't like empty model/headmodel/handicap cvars, even if the gamecode copes*/
#define Q3CFG "gl_overbright 2\nseta model sarge\nseta headmodel sarge\nseta handicap 100\n"
#define Q3CFG "gl_overbright 2\nseta model sarge\nseta headmodel sarge\nseta handicap 100\ncom_nogamedirnativecode 0\n"
#define RMQCFG "sv_bigcoords 1\n"
typedef struct {

View File

@ -5043,7 +5043,7 @@ void NET_InitClient(void)
cls.sockets = FTENET_CreateCollection(false);
#ifndef CLIENTONLY
FTENET_AddToCollection(cls.sockets, "CLLoopback", port, NA_LOOPBACK, true);
FTENET_AddToCollection(cls.sockets, "CLLoopback", "1", NA_LOOPBACK, true);
#endif
#ifdef HAVE_IPV4
FTENET_AddToCollection(cls.sockets, "CLUDP4", port, NA_IP, true);
@ -5292,7 +5292,7 @@ int QDECL VFSTCP_ReadBytes (struct vfsfile_s *file, void *buffer, int bytestorea
switch(e)
{
case ECONNABORTED:
Sys_Printf("conenction aborted\n");
Sys_Printf("connection aborted\n", e);
break;
default:
Sys_Printf("socket error %i\n", e);

View File

@ -5,6 +5,11 @@
#include "quakedef.h"
#include "fs.h"
#define PLUG_NONE 0
#define PLUG_NATIVE 1
#define PLUG_QVM 2
#define PLUG_EITHER 3
#ifdef PLUGINS
//#define GNUTLS
#ifdef GNUTLS
@ -161,7 +166,6 @@ void Plug_Close(plugin_t *plug);
void Plug_Tick(void);
qboolean Plugin_ExecuteString(void);
void Plug_Shutdown(void);
static plugin_t *plugs;
@ -301,7 +305,7 @@ static qintptr_t EXPORT_FN Plug_SystemCallsNative(qintptr_t arg, ...)
}
plugin_t *Plug_Load(char *file)
plugin_t *Plug_Load(char *file, int type)
{
plugin_t *newplug;
@ -315,10 +319,11 @@ plugin_t *Plug_Load(char *file)
newplug->name = (char*)(newplug+1);
strcpy(newplug->name, file);
if (!strncmp(file, "fteplug_", 8))
newplug->vm = VM_Create(NULL, file, Plug_SystemCallsNative, NULL);
else
newplug->vm = VM_Create(NULL, file, Plug_SystemCallsNative, Plug_SystemCallsVM);
if (!newplug->vm && (type & PLUG_NATIVE))
newplug->vm = VM_Create(va("fteplug_%s", file), Plug_SystemCallsNative, NULL);
if (!newplug->vm && (type & PLUG_QVM))
newplug->vm = VM_Create(file, NULL, Plug_SystemCallsVM);
currentplug = newplug;
if (newplug->vm)
{
@ -353,7 +358,7 @@ static int QDECL Plug_Emumerated (const char *name, int size, void *param, void
char vmname[MAX_QPATH];
Q_strncpyz(vmname, name, sizeof(vmname));
vmname[strlen(vmname) - strlen(param)] = '\0';
if (!Plug_Load(vmname))
if (!Plug_Load(vmname, PLUG_QVM))
Con_Printf("Couldn't load plugin %s\n", vmname);
return true;
@ -363,6 +368,8 @@ static int QDECL Plug_EnumeratedRoot (const char *name, int size, void *param, v
char vmname[MAX_QPATH];
int len;
char *dot;
if (!strncmp(name, "fteplug_", 8))
name += 8;
Q_strncpyz(vmname, name, sizeof(vmname));
len = strlen(vmname);
len -= strlen(ARCH_CPU_POSTFIX ARCH_DL_POSTFIX);
@ -374,7 +381,7 @@ static int QDECL Plug_EnumeratedRoot (const char *name, int size, void *param, v
if (dot)
*dot = 0;
}
if (!Plug_Load(vmname))
if (!Plug_Load(vmname, PLUG_NATIVE))
Con_Printf("Couldn't load plugin %s\n", vmname);
return true;
@ -1404,9 +1411,9 @@ void Plug_Load_f(void)
Con_Printf("will load blahx86.dll or blah.so\n");
return;
}
if (!Plug_Load(plugin))
if (!Plug_Load(plugin, PLUG_EITHER))
{
if (!Plug_Load(va("plugins/%s", plugin)))
if (!Plug_Load(va("plugins/%s", plugin), PLUG_EITHER))
Con_Printf("Couldn't load plugin %s\n", Cmd_Argv(1));
}
}
@ -1430,7 +1437,7 @@ static int EXPORT_FN Test_SysCalls(int arg, ...)
void VM_Test_f(void)
{
vm_t *vm;
vm = VM_Create(NULL, "vm/test", Test_SysCalls, Test_SysCalls_Ex);
vm = VM_Create(NULL, "vm/test", com_nogamedirnativecode.ival?NULL:Test_SysCalls, Test_SysCalls_Ex);
if (vm)
{
VM_Call(vm, 0, "");
@ -1520,7 +1527,6 @@ void Plug_Initialise(qboolean fromgamedir)
{
if (plug_loaddefault.value)
{
COM_EnumerateFiles("plugins/*"ARCH_CPU_POSTFIX ARCH_DL_POSTFIX, Plug_Emumerated, ARCH_CPU_POSTFIX ARCH_DL_POSTFIX);
COM_EnumerateFiles("plugins/*.qvm", Plug_Emumerated, ".qvm");
}
}
@ -1889,33 +1895,49 @@ void Plug_List_f(void)
}
}
void Plug_Shutdown(void)
void Plug_Shutdown(qboolean preliminary)
{
while(plugs)
plugin_t **p;
if (preliminary)
{
plugs->blockcloses = 0;
Plug_Close(plugs);
//close the non-block-closes plugins first, before most of the rest of the subsystems are down
for (p = &plugs; *p; )
{
if ((*p)->blockcloses)
p = &(*p)->next;
else
Plug_Close(plugs);
}
}
else
{
//now that our various handles etc are closed, its safe to terminate the various driver plugins.
while(plugs)
{
plugs->blockcloses = 0;
Plug_Close(plugs);
}
BZ_Free(pluginstreamarray);
pluginstreamarray = NULL;
pluginstreamarraylen = 0;
BZ_Free(pluginstreamarray);
pluginstreamarray = NULL;
pluginstreamarraylen = 0;
numplugbuiltins = 0;
BZ_Free(plugbuiltins);
plugbuiltins = NULL;
numplugbuiltins = 0;
BZ_Free(plugbuiltins);
plugbuiltins = NULL;
plugincvararraylen = 0;
BZ_Free(plugincvararray);
plugincvararray = NULL;
plugincvararraylen = 0;
BZ_Free(plugincvararray);
plugincvararray = NULL;
plugincommandarraylen = 0;
BZ_Free(plugincommandarray);
plugincommandarray = NULL;
plugincommandarraylen = 0;
BZ_Free(plugincommandarray);
plugincommandarray = NULL;
#ifndef SERVERONLY
Plug_Client_Shutdown();
Plug_Client_Shutdown();
#endif
}
}
#endif

View File

@ -3240,7 +3240,7 @@ void QCBUILTIN PF_random (pubprogfuncs_t *prinst, struct globalvars_s *pr_global
{
float num;
num = (rand ()&0x7fff) / ((float)0x7fff);
num = (rand ()&0x7fff) / ((float)0x8000);
G_FLOAT(OFS_RETURN) = num;
}

View File

@ -66,7 +66,9 @@ struct vm_s {
qintptr_t (EXPORT_FN *vmMain)(qintptr_t command, qintptr_t arg0, qintptr_t arg1, qintptr_t arg2, qintptr_t arg3, qintptr_t arg4, qintptr_t arg5, qintptr_t arg6);
};
//plugins come from the quake root dir, not game dirs.
//this is a bit weird. qvm plugins always come from $basedir/$mod/plugins/$foo.qvm
//but native plugins never come from $basedir/$mod/ - too many other engines blindly allow dll downloads etc. Its simply far too insecure if people use other engines.
//q3 gamecode allows it however. yes you could probably get fte to connect via q3 instead and get such a dll.
dllhandle_t *QVM_LoadDLL(const char *name, qboolean binroot, void **vmMain, sys_calldll_t syscall)
{
void (EXPORT_FN *dllEntry)(sys_calldll_t syscall);
@ -927,13 +929,13 @@ void VM_PrintInfo(vm_t *vm)
/*
** VM_Create
*/
vm_t *VM_Create(vm_t *vm, const char *name, sys_calldll_t syscalldll, sys_callqvm_t syscallqvm)
vm_t *VM_Create(const char *name, sys_calldll_t syscalldll, sys_callqvm_t syscallqvm)
{
vm_t *vm;
if(!name || !*name)
Sys_Error("VM_Create: bad parms");
if (!vm)
vm = Z_Malloc(sizeof(vm_t));
vm = Z_Malloc(sizeof(vm_t));
// prepare vm struct
memset(vm, 0, sizeof(vm_t));
@ -998,7 +1000,7 @@ void VM_Destroy(vm_t *vm)
/*
** VM_Restart
*/
qboolean VM_Restart(vm_t *vm)
/*qboolean VM_Restart(vm_t *vm)
{
char name[MAX_QPATH];
sys_calldll_t syscalldll;
@ -1027,7 +1029,7 @@ qboolean VM_Restart(vm_t *vm)
}
return VM_Create(vm, name, syscalldll, syscallqvm)!=NULL;
}
}*/
void *VM_MemoryBase(vm_t *vm)
{

View File

@ -53,9 +53,9 @@ typedef struct vm_s vm_t;
// ------------------------- * interface * -------------------------
void VM_PrintInfo(vm_t *vm);
vm_t *VM_Create(vm_t *vm, const char *name, sys_calldll_t syscalldll, sys_callqvm_t syscallqvm);
vm_t *VM_Create(const char *name, sys_calldll_t syscalldll, sys_callqvm_t syscallqvm);
void VM_Destroy(vm_t *vm);
qboolean VM_Restart(vm_t *vm);
//qboolean VM_Restart(vm_t *vm);
qintptr_t VARGS VM_Call(vm_t *vm, qintptr_t instruction, ...);
qboolean VM_NonNative(vm_t *vm);
void *VM_MemoryBase(vm_t *vm);
@ -71,7 +71,7 @@ void Plug_Command_f(void);
int Plug_ConnectionlessClientPacket(char *buffer, int size);
void Plug_DrawReloadImages(void);
void Plug_Initialise(qboolean fromgamedir);
void Plug_Shutdown(void);
void Plug_Shutdown(qboolean preliminary);
qboolean Plug_Menu_Event(int eventtype, int param);
void Plug_ResChanged(void);
void Plug_SBar(void);

View File

@ -653,6 +653,7 @@ static void BindTexture(unsigned int tu, const texid_t *id)
static void SelectPassTexture(unsigned int tu, shaderpass_t *pass)
{
extern texid_t r_whiteimage;
texid_t foo;
switch(pass->texgen)
{
@ -697,7 +698,7 @@ static void SelectPassTexture(unsigned int tu, shaderpass_t *pass)
{
int lmi = shaderstate.curbatch->lightmap[0];
if (lmi < 0)
BindTexture(tu, &r_nulltex);
BindTexture(tu, &r_whiteimage);
else
BindTexture(tu, &lightmap[lmi]->lightmap_texture);
}

View File

@ -200,6 +200,8 @@ texid_t D3D11_AllocNewTexture(char *ident, int width, int height, unsigned int f
if (t->tex2d)
return ToTexID(t);
t->tex2d = D3D11_AllocNewTextureData(NULL, width, height, flags);
t->com.width = width;
t->com.height = height;
id = ToTexID(t);
if (!t->tex2d)
@ -328,7 +330,7 @@ static void Upload_Texture_32(ID3D11Texture2D *tex, unsigned int *data, int widt
//create a basic shader from a 32bit image
static void D3D11_LoadTexture_32(d3d11texture_t *tex, unsigned int *data, int width, int height, int flags)
{
int nwidth, nheight;
// int nwidth, nheight;
/*
if (!(flags & TF_MANDATORY))
@ -338,10 +340,12 @@ static void D3D11_LoadTexture_32(d3d11texture_t *tex, unsigned int *data, int wi
}
*/
nwidth = width;
nheight = height;
D3D11_RoundDimensions(&nwidth, &nheight, !(flags & IF_NOMIPMAP));
// nwidth = width;
// nheight = height;
// D3D11_RoundDimensions(&nwidth, &nheight, !(flags & IF_NOMIPMAP));
tex->com.width = width;
tex->com.height = height;
if (!tex->tex2d)
{
tex->tex2d = D3D11_AllocNewTextureData(data, width, height, flags);
@ -364,12 +368,22 @@ static void D3D11_LoadTexture_8(d3d11texture_t *tex, unsigned char *data, unsign
s = width*height;
// if there are no transparent pixels, make it a 3 component
// texture even if it was specified as otherwise
if (fmt == TF_TRANS8_FULLBRIGHT)
if (fmt == TF_8PAL24)
{
unsigned char *pal24 = (void*)pal32;
//strictly bgr little endian.
for (i=0 ; i<s ; i++)
{
p = data[i];
trans[i] = (pal24[p*3+0] << 0) | (pal24[p*3+1] << 8) | (pal24[p*3+2] << 16) | (255<<24);
}
}
else if (fmt == TF_TRANS8_FULLBRIGHT)
{
noalpha = true;
for (i=0 ; i<s ; i++)
{
p = data[i];
noalpha = true;
if (p > 255-vid.fullbright)
trans[i] = pal32[p];
else
@ -474,6 +488,15 @@ void D3D11_Upload (texid_t id, char *name, enum uploadfmt fmt, void *data, vo
}
ToTexID(tex);
break;
case TF_8PAL24:
D3D11_LoadTexture_8(tex, data, palette, width, height, flags, fmt);
if (tex->view)
{
tex->view->lpVtbl->Release(tex->view);
tex->view = NULL;
}
ToTexID(tex);
break;
case TF_TRANS8:
OutputDebugString(va("D3D11_LoadTextureFmt doesn't support fmt TF_TRANS8 (%s)\n", fmt, name));
break;
@ -506,6 +529,8 @@ void D3D11_UploadLightmap(lightmapinfo_t *lm)
}
Upload_Texture_32(tex->tex2d, (void*)lm->lightmaps, lm->width, lm->height, 0);
}
tex->com.width = lm->width;
tex->com.height = lm->height;
lm->lightmap_texture = ToTexID(tex);
}
@ -601,10 +626,10 @@ texid_t D3D11_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte
int i;
for (i = 0; i < 256; i++)
{
pal32[i] = 0x00000000 |
(palette24[i*3+2]<<24) |
(palette24[i*3+1]<<8) |
(palette24[i*3+0]<<0);
pal32[i] = (255<<24) |
(palette24[i*3+2]<<16) |
(palette24[i*3+1]<<8) |
(palette24[i*3+0]<<0);
}
return D3D11_LoadTexture8Pal32(identifier, width, height, data, (qbyte*)pal32, flags);
}

View File

@ -235,6 +235,8 @@ static void D3D9_LoadTexture_32(d3dtexture_t *tex, unsigned int *data, int width
tex->tex.ptr = newsurf;
}
tex->com.width = width;
tex->com.height = height;
Upload_Texture_32(tex->tex.ptr, data, width, height, flags);
}
@ -352,6 +354,8 @@ void D3D9_Upload (texid_t tex, char *name, enum uploadfmt fmt, void *data, vo
flags |= IF_NOALPHA;
//fall through
case TF_RGBA32:
tex.ref->width = width;
tex.ref->height = height;
Upload_Texture_32(tex.ptr, data, width, height, flags);
break;
default:

View File

@ -727,14 +727,6 @@ static qboolean D3D9_VID_Init(rendererstate_t *info, unsigned char *palette)
mouseactive = false;
}
{
void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue);
Cvar_Hook(&v_gamma, GLV_Gamma_Callback);
Cvar_Hook(&v_contrast, GLV_Gamma_Callback);
Cvar_ForceCallback(&v_gamma);
}
return true;
}
@ -806,15 +798,16 @@ static void (D3D9_VID_DeInit) (void)
Cvar_Unhook(&v_gamma);
Cvar_Unhook(&v_contrast);
Cvar_Unhook(&v_brightness);
}
static void (D3D9_VID_SetPalette) (unsigned char *palette)
qboolean D3D9_VID_ApplyGammaRamps (unsigned short *ramps)
{
D3D9_VID_GenPaletteTables(palette);
}
static void (D3D9_VID_ShiftPalette) (unsigned char *palette)
{
D3D9_VID_GenPaletteTables(palette);
if (d3dpp.Windowed)
return false;
if (pD3DDev9 && ramps)
IDirect3DDevice9_SetGammaRamp(pD3DDev9, 0, D3DSGR_NO_CALIBRATION, (D3DGAMMARAMP *)ramps);
return true;
}
static char *(D3D9_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight)
{
@ -958,7 +951,7 @@ static void (D3D9_SCR_UpdateScreen) (void)
}
D3D9BE_Reset(false);
VID_ShiftPalette (NULL);
Cvar_ForceCallback(&v_gamma);
break;
default:
break;
@ -1103,8 +1096,6 @@ static void (D3D9_SCR_UpdateScreen) (void)
INS_UpdateGrabs(modestate != MS_WINDOWED, ActiveApp);
VID_ShiftPalette (NULL);
}
@ -1290,8 +1281,7 @@ rendererinfo_t d3d9rendererinfo =
D3D9_VID_Init,
D3D9_VID_DeInit,
D3D9_VID_SetPalette,
D3D9_VID_ShiftPalette,
D3D9_VID_ApplyGammaRamps,
D3D9_VID_GetRGBInfo,
D3D9_VID_SetWindowCaption,

View File

@ -792,6 +792,7 @@ static qboolean D3D11_VID_Init(rendererstate_t *info, unsigned char *palette)
void GLV_Gamma_Callback(struct cvar_s *var, char *oldvalue);
Cvar_Hook(&v_gamma, GLV_Gamma_Callback);
Cvar_Hook(&v_contrast, GLV_Gamma_Callback);
Cvar_Hook(&v_brightness, GLV_Gamma_Callback);
Cvar_ForceCallback(&v_gamma);
}
@ -866,18 +867,11 @@ static void (D3D11_VID_DeInit) (void)
DestroyWindow(mainwindow);
mainwindow = NULL;
}
Cvar_Unhook(&v_gamma);
Cvar_Unhook(&v_contrast);
}
static void (D3D11_VID_SetPalette) (unsigned char *palette)
static qboolean D3D11_VID_ApplyGammaRamps(unsigned short *ramps)
{
D3D11_VID_GenPaletteTables(palette);
}
static void (D3D11_VID_ShiftPalette) (unsigned char *palette)
{
D3D11_VID_GenPaletteTables(palette);
return false;
}
static char *(D3D11_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight)
{
@ -1176,8 +1170,6 @@ static void (D3D11_SCR_UpdateScreen) (void)
INS_UpdateGrabs(modestate != MS_WINDOWED, ActiveApp);
VID_ShiftPalette (NULL);
}
@ -1365,8 +1357,7 @@ rendererinfo_t d3d11rendererinfo =
D3D11_VID_Init,
D3D11_VID_DeInit,
D3D11_VID_SetPalette,
D3D11_VID_ShiftPalette,
D3D11_VID_ApplyGammaRamps,
D3D11_VID_GetRGBInfo,
D3D11_VID_SetWindowCaption,

View File

@ -35,6 +35,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{8CED
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jabbercl", "..\..\plugins\jabber\jabbercl.vcproj", "{9767E236-8454-44E9-8999-CD5BDAFBE9BA}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fs_mpq", "..\..\plugins\mpq\fs_mpq.vcproj", "{72269FEE-293D-40BC-A7AE-E429F4496869}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
D3DDebug|Win32 = D3DDebug|Win32
@ -475,6 +477,42 @@ Global
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.Release|Win32.ActiveCfg = Release|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.Release|Win32.Build.0 = Release|Win32
{9767E236-8454-44E9-8999-CD5BDAFBE9BA}.Release|x64.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.D3DDebug|Win32.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.D3DDebug|Win32.Build.0 = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.D3DDebug|x64.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.D3DRelease|Win32.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.D3DRelease|Win32.Build.0 = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.D3DRelease|x64.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Debug Dedicated Server|Win32.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Debug Dedicated Server|Win32.Build.0 = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Debug Dedicated Server|x64.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Debug|Win32.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Debug|Win32.Build.0 = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Debug|x64.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.GLDebug|Win32.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.GLDebug|Win32.Build.0 = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.GLDebug|x64.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.GLRelease|Win32.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.GLRelease|Win32.Build.0 = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.GLRelease|x64.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MDebug|Win32.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MDebug|Win32.Build.0 = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MDebug|x64.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MinGLDebug|Win32.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MinGLDebug|Win32.Build.0 = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MinGLDebug|x64.ActiveCfg = Debug|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MinGLRelease|Win32.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MinGLRelease|Win32.Build.0 = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MinGLRelease|x64.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MRelease|Win32.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MRelease|Win32.Build.0 = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.MRelease|x64.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Release Dedicated Server|Win32.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Release Dedicated Server|Win32.Build.0 = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Release Dedicated Server|x64.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Release|Win32.ActiveCfg = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Release|Win32.Build.0 = Release|Win32
{72269FEE-293D-40BC-A7AE-E429F4496869}.Release|x64.ActiveCfg = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -484,6 +522,7 @@ Global
{32B12987-DF8C-4E40-B07C-B18586A4CA65} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
{873CCE24-3549-49D4-A4B4-653F91B1532A} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
{9767E236-8454-44E9-8999-CD5BDAFBE9BA} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
{72269FEE-293D-40BC-A7AE-E429F4496869} = {8CED01C6-2C61-4EC5-90B6-574D9756D773}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
AMDCaProjectFile = C:\Games\Quake\wip\engine\dotnet2005\CodeAnalyst\ftequake.caw

View File

@ -4622,9 +4622,9 @@ void GLBE_VBO_Data(vbobctx_t *ctx, void *data, unsigned int size, vboarray_t *va
{
if (ctx->fallback)
{
memcpy(ctx->fallback + ctx->pos, data, size);
memcpy((char*)ctx->fallback + ctx->pos, data, size);
varray->gl.vbo = 0;
varray->gl.addr = ctx->fallback + ctx->pos;
varray->gl.addr = (char*)ctx->fallback + ctx->pos;
}
else
{

View File

@ -167,7 +167,7 @@ typedef struct gltexture_s
texcom_t com;
texid_t texnum;
char identifier[64];
int width, height, bpp;
int bpp;
unsigned int flags;
struct gltexture_s *next;
} gltexture_t;
@ -184,8 +184,8 @@ static gltexture_t *GL_AllocNewGLTexture(char *ident, int w, int h, unsigned int
glt->texnum.ref = &glt->com;
Q_strncpyz (glt->identifier, ident, sizeof(glt->identifier));
glt->flags = flags;
glt->width = w;
glt->height = h;
glt->com.width = w;
glt->com.height = h;
glt->bpp = 0;
glt->com.regsequence = r_regsequence;
@ -408,8 +408,8 @@ void GLDraw_ImageList_f(void)
for (glt=gltextures ; glt ; glt=glt->next)
{
count++;
mem += glt->width * glt->height * 4;
Con_Printf("%s (%i*%i, seq=%i)\n", glt->identifier, glt->width, glt->height, glt->com.regsequence);
mem += glt->com.width * glt->com.height * 4;
Con_Printf("%s (%i*%i, seq=%i)\n", glt->identifier, glt->com.width, glt->com.height, glt->com.regsequence);
}
Con_Printf("%i images, %i bytes\n", count, mem);
}
@ -636,9 +636,6 @@ texid_t GL_FindTexture (char *identifier, unsigned int flags)
glt = Hash_GetNext(&gltexturetable, identifier, glt);
continue;
}
image_width = glt->width;
image_height = glt->height;
return glt->texnum;
}
@ -652,7 +649,7 @@ gltexture_t *GL_MatchTexture (char *identifier, unsigned int flags, int bits, in
glt = Hash_Get(&gltexturetable, identifier);
while(glt)
{
if (glt->bpp == bits && width == glt->width && height == glt->height && !((glt->flags ^ flags) & IF_CLAMP))
if (glt->bpp == bits && width == glt->com.width && height == glt->com.height && !((glt->flags ^ flags) & IF_CLAMP))
return glt;
glt = Hash_GetNext(&gltexturetable, identifier, glt);
@ -2308,7 +2305,7 @@ texid_t GL_LoadCompressed(char *name)
GL_MTBind(0, GL_TEXTURE_2D, glt->texnum);
if (!GL_UploadCompressed(file, &glt->width, &glt->height, (unsigned int *)&glt->flags))
if (!GL_UploadCompressed(file, &glt->com.width, &glt->com.height, (unsigned int *)&glt->flags))
return r_nulltex;
return glt->texnum;

View File

@ -1613,6 +1613,11 @@ float Font_DrawScaleChar(float px, float py, unsigned int charcode)
int v;
struct font_s *font = curfont;
float cw, ch;
#ifdef D3D11QUAKE
float dxbias = (qrenderer == QR_DIRECT3D11)?0.5:0;
#else
#define dxbias 0
#endif
// if (!curfont_scaled)
// return Font_DrawChar(px, py, charcode);
@ -1731,6 +1736,9 @@ float Font_DrawScaleChar(float px, float py, unsigned int charcode)
v = Font_BeginChar(fontplanes.texnum[c->texplane]);
}
sx += dxbias;
sy += dxbias;
sx *= (int)vid.width / (float)vid.rotpixelwidth;
sy *= (int)vid.height / (float)vid.rotpixelheight;
sw *= (int)vid.width / (float)vid.rotpixelwidth;

View File

@ -456,6 +456,7 @@ void GLR_DeInit (void)
Cvar_Unhook(&r_drawflat);
Cvar_Unhook(&v_gamma);
Cvar_Unhook(&v_contrast);
Cvar_Unhook(&v_brightness);
Surf_DeInit();
@ -473,6 +474,7 @@ void GLR_Init (void)
// Cvar_Hook(&r_drawflat, GLR_Drawflat_Callback);
Cvar_Hook(&v_gamma, GLV_Gamma_Callback);
Cvar_Hook(&v_contrast, GLV_Gamma_Callback);
Cvar_Hook(&v_brightness, GLV_Gamma_Callback);
GLR_ReInit();
}

View File

@ -2973,6 +2973,8 @@ void Shader_Free (shader_t *shader)
shader->genargs = NULL;
}
shader->uses = 0;
memset(&shader->defaulttextures, 0, sizeof(shader->defaulttextures));
}
@ -3131,11 +3133,15 @@ void Shader_Reset(shader_t *s)
shader_gen_t *defaultgen = s->generator;
char *genargs = s->genargs;
texnums_t dt = s->defaulttextures;
int w = s->width;
int h = s->height;
Q_strncpyz(name, s->name, sizeof(name));
s->genargs = NULL;
Shader_Free(s);
memset(s, 0, sizeof(*s));
s->width = w;
s->height = h;
s->defaulttextures = dt;
s->generator = defaultgen;
s->genargs = genargs;
@ -4201,6 +4207,7 @@ void Shader_DefaultCinematic(char *shortname, shader_t *s, const void *args)
Shader_DefaultScript(shortname, s,
va(
"{\n"
"program default2d\n"
"{\n"
"videomap %s\n"
"}\n"

View File

@ -1710,8 +1710,7 @@ rendererinfo_t openglrendererinfo = {
GLVID_Init,
GLVID_DeInit,
GLVID_SetPalette,
GLVID_ShiftPalette,
GLVID_ApplyGammaRamps,
GLVID_GetRGBInfo,
GLVID_SetCaption, //setcaption

View File

@ -948,7 +948,6 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
// ourselves at the top of the z order, then grab the foreground again,
// Who knows if it helps, but it probably doesn't hurt
SetForegroundWindow (mainwindow);
VID_SetPalette (palette);
#ifndef NPFTE
/*I don't like this, but if we */
@ -969,8 +968,6 @@ int GLVID_SetMode (rendererstate_t *info, unsigned char *palette)
// fix the leftover Alt from any Alt-Tab or the like that switched us away
ClearAllStates ();
GLVID_SetPalette (palette);
vid.recalc_refdef = 1;
if (vid_desktopgamma.value)
@ -1473,26 +1470,54 @@ void GLVID_SetPalette (unsigned char *palette)
}
}
void GLVID_ShiftPalette (unsigned char *palette)
qboolean GLVID_ApplyGammaRamps (unsigned short *ramps)
{
extern unsigned short ramps[3][256];
if (ActiveApp && vid_hardwaregamma.value) //this is needed because ATI drivers don't work properly (or when task-switched out).
if (ramps)
{
if (gammaworks)
{ //we have hardware gamma applied - if we're doing a BF, we don't want to reset to the default gamma (yuck)
if (!gammaworks)
return false;
if (vid_hardwaregamma.value == 1 && modestate == MS_WINDOWED)
return false; //don't do hardware gamma in windowed mode
if (ActiveApp && vid_hardwaregamma.value) //this is needed because ATI drivers don't work properly (or when task-switched out).
{
if (gammaworks)
{ //we have hardware gamma applied - if we're doing a BF, we don't want to reset to the default gamma (yuck)
if (vid_desktopgamma.value)
{
HDC hDC = GetDC(GetDesktopWindow());
qSetDeviceGammaRamp (hDC, ramps);
ReleaseDC(GetDesktopWindow(), hDC);
}
else
{
qSetDeviceGammaRamp (maindc, ramps);
}
}
return true;
}
return false;
}
else
{
//revert to default
if (qSetDeviceGammaRamp)
{
OblitterateOldGamma();
if (vid_desktopgamma.value)
{
HDC hDC = GetDC(GetDesktopWindow());
qSetDeviceGammaRamp (hDC, ramps);
qSetDeviceGammaRamp (hDC, originalgammaramps);
ReleaseDC(GetDesktopWindow(), hDC);
}
else
{
qSetDeviceGammaRamp (maindc, ramps);
qSetDeviceGammaRamp(maindc, originalgammaramps);
}
return;
}
return true;
}
}
@ -1813,7 +1838,8 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize)
{
if (modestate != MS_WINDOWED)
{
if (vid_canalttab && vid_wassuspended) {
if (vid_canalttab && vid_wassuspended)
{
vid_wassuspended = false;
ChangeDisplaySettings (&gdevmode, CDS_FULLSCREEN);
ShowWindow(mainwindow, SW_SHOWNORMAL);
@ -1837,23 +1863,7 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize)
}
}
// Cvar_ForceCallback(&v_gamma); //wham bam thanks.
if (qSetDeviceGammaRamp)
{
OblitterateOldGamma();
if (vid_desktopgamma.value)
{
HDC hDC = GetDC(GetDesktopWindow());
qSetDeviceGammaRamp (hDC, originalgammaramps);
ReleaseDC(GetDesktopWindow(), hDC);
}
else
{
qSetDeviceGammaRamp(maindc, originalgammaramps);
}
}
Cvar_ForceCallback(&v_gamma); //wham bam thanks.
}
return true;
@ -2157,8 +2167,6 @@ qboolean GLVID_Init (rendererstate_t *info, unsigned char *palette)
vid_initialized = false;
vid_initializing = true;
VID_SetPalette (palette);
if (!GLVID_SetMode (info, palette))
{
VID_UnSetMode();

View File

@ -53,6 +53,7 @@ void R_SetSky(char *skyname)
skyboxface = R_RegisterShader("skyboxface",
"{\n"
"program default2d\n"
"{\n"
"map $diffuse\n"
"}\n"

View File

@ -1246,6 +1246,72 @@ YOU SHOULD NOT EDIT THIS FILE BY HAND
},
#endif
#ifdef GLQUAKE
{QR_OPENGL, 110, "defaultgammacb",
//this shader is applies gamma/contrast/brightness to the source image, and dumps it out.
"varying vec2 tc;\n"
"varying vec4 vc;\n"
"#ifdef VERTEX_SHADER\n"
"attribute vec2 v_texcoord;\n"
"attribute vec4 v_colour;\n"
"void main ()\n"
"{\n"
"tc = v_texcoord;\n"
"vc = v_colour;\n"
"gl_Position = ftetransform();\n"
"}\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"uniform sampler2D s_t0;\n"
"void main ()\n"
"{\n"
"gl_FragColor = pow(texture2D(s_t0, tc) * vc.g, vec4(vc.r)) + vc.b;\n"
"}\n"
"#endif\n"
},
#endif
#ifdef D3D11QUAKE
{QR_DIRECT3D11, 11, "defaultgammacb",
//this shader is applies gamma/contrast/brightness to the source image, and dumps it out.
"struct a2v\n"
"{\n"
"float4 pos: POSITION;\n"
"float2 tc: TEXCOORD0;\n"
"float4 vcol: COLOR0;\n"
"};\n"
"struct v2f\n"
"{\n"
"float4 pos: SV_POSITION;\n"
"float2 tc: TEXCOORD0;\n"
"float4 vcol: COLOR0;\n"
"};\n"
"#include <ftedefs.h>\n"
"#ifdef VERTEX_SHADER\n"
"v2f main (a2v inp)\n"
"{\n"
"v2f outp;\n"
"outp.pos = mul(m_projection, inp.pos);\n"
"outp.tc = inp.tc;\n"
"outp.vcol = inp.vcol;\n"
"return outp;\n"
"}\n"
"#endif\n"
"#ifdef FRAGMENT_SHADER\n"
"Texture2D shaderTexture;\n"
"SamplerState SampleType;\n"
"float4 main (v2f inp) : SV_TARGET\n"
"{\n"
"return pow(shaderTexture.Sample(SampleType, inp.tc) * inp.vcol.g, inp.vcol.r) + inp.vcol.b;\n"
"}\n"
"#endif\n"
},
#endif
#ifdef GLQUAKE
{QR_OPENGL, 110, "drawflat_wall",
"!!cvarv r_floorcolor\n"
"!!cvarv r_wallcolor\n"

View File

@ -375,6 +375,7 @@ static int FSPPAPI_EnumerateFiles (void *handle, const char *match, int (*func)(
static int FSPPAPI_RebuildFSHash(const char *filename, int filesize, void *data, void *handle)
{
void (QDECL *AddFileHash)(int depth, const char *fname, fsbucket_t *filehandle, void *pathhandle) = data;
if (filename[strlen(filename)-1] == '/')
{ //this is actually a directory
@ -383,12 +384,12 @@ static int FSPPAPI_RebuildFSHash(const char *filename, int filesize, void *data,
Sys_EnumerateFiles((char*)data, childpath, FSPPAPI_RebuildFSHash, data, handle);
return true;
}
FS_AddFileHash(0, filename, NULL, handle);
AddFileHash(0, filename, NULL, handle);
return true;
}
static void FSPPAPI_BuildHash(void *handle, int depth)
static void FSPPAPI_BuildHash(void *handle, int depth, void (QDECL *AddFileHash)(int depth, const char *fname, fsbucket_t *filehandle, void *pathhandle))
{
Sys_EnumerateFiles(handle, "*", FSPPAPI_RebuildFSHash, handle, handle);
Sys_EnumerateFiles(handle, "*", FSPPAPI_RebuildFSHash, AddFileHash, handle);
}
/*

View File

@ -114,16 +114,6 @@ qboolean Sys_RandomBytes(qbyte *string, int len)
return false;
}
//q2...
void Sys_UnloadGame (void)
{
}
//q2...
void *Sys_GetGameAPI (void *parms)
{
return NULL;
}
qboolean Sys_InitTerminal (void)
{
return false;
@ -410,7 +400,6 @@ static void ppp_mouseunlocked(PP_Instance instance)
unsigned int domkeytoquake(unsigned int code)
{
#define K_PRINTSCREEN ' '
unsigned int tab[256] =
{
/* 0*/ 0,0,0,0,0,0,0,0, K_BACKSPACE,K_TAB,0,0,0,K_ENTER,0,0,

View File

@ -1776,7 +1776,7 @@ int PDECL PR_LoadEnts(pubprogfuncs_t *ppf, char *file, float killonspawnflags)
pbool resethunk=0;
pbool isloadgame;
if (!strncmp(file, "loadgame", 8))
if (file && !strncmp(file, "loadgame", 8))
{
isloadgame = true;
numents = -1;

View File

@ -134,6 +134,7 @@ typedef struct {
int ebfsnum; //extra functions, these exist ONLY after being checked for.
char *prototype;
char *biglongdesc;
qboolean obsolete;
} BuiltinList_t;
builtin_t pr_builtin[1024];
@ -8963,18 +8964,23 @@ static void QCBUILTIN PF_SendPacket(pubprogfuncs_t *prinst, struct globalvars_s
#define STUB ,true
#define STUB ,NULL,true
#if defined(DEBUG) || defined(_DEBUG)
#define NYI
#else
#define NYI ,true
#endif
#ifdef MINIMAL
#define D(p,d) NULL,NULL
#else
#define D(p,d) p,d
#endif
BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"fixme", PF_Fixme, 0, 0, 0, 0, "void()"},
{"fixme", PF_Fixme, 0, 0, 0, 0, D("void()", "Some builtin that should never be called. Ends the game with some weird message.")},
#ifndef SERVERONLY
//begin menu-only 'standard'
{"checkextension", PF_Fixme, 0, 0, 0, 1, "float(string ext)"},
{"checkextension", PF_Fixme, 0, 0, 0, 1, D("float(string ext)", "Checks if the named extension is supported by the running engine.")},
{"error", PF_Fixme, 0, 0, 0, 2, "void(string err,...)"},
{"objerror", PF_Fixme, 0, 0, 0, 3, "void(string err,...)"},
{"print", PF_Fixme, 0, 0, 0, 4, "void(string text,...)"},
@ -9061,73 +9067,73 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"altstr_ins", PF_Fixme, 0, 0, 0, 86, "string(string str, float num, string set)"},
{"findflags", PF_Fixme, 0, 0, 0, 87, "entity(entity start, .float field, float match)"},
{"findchainflags", PF_Fixme, 0, 0, 0, 88, "entity(.float field, float match)"},
{"mcvar_defstring", PF_Fixme, 0, 0, 0, 89, "string(string name) " STUB},
{"mcvar_defstring", PF_Fixme, 0, 0, 0, 89, "string(string name)" STUB},
//end menu-only 'standard'
#endif
//nq qw h2 ebfs
{"ignore", PF_Ignore, 0, 0, 0, 0, "void()"},
{"makevectors", PF_makevectors, 1, 1, 1, 0, "void(vector vang)"},
{"setorigin", PF_setorigin, 2, 2, 2, 0, "void(entity e, vector o)"},
{"setmodel", PF_setmodel, 3, 3, 3, 0, "void(entity e, string m)"},
{"setsize", PF_setsize, 4, 4, 4, 0, "void(entity e, vector min, vector max)"},
{"qtest_setabssize",PF_setsize, 5, 0, 0, 0, "void(entity e, vector min, vector max)", true},
{"lightstylestatic",PF_lightstylestatic,0, 0, 5, 5, "void(float style, float val)"},
{"break", PF_break, 6, 6, 6, 0, "void()"},
{"random", PF_random, 7, 7, 7, 0, "float()"},
{"sound", PF_sound, 8, 8, 8, 0, "void(entity e, float chan, string samp, float vol, float atten, optional float speedpct, optional float flags)"},
{"normalize", PF_normalize, 9, 9, 9, 0, "vector(vector v)"},
{"error", PF_error, 10, 10, 10, 0, "void(string e)"},
{"objerror", PF_objerror, 11, 11, 11, 0, "void(string e)"},
{"vlen", PF_vlen, 12, 12, 12, 0, "float(vector v)"},
{"vectoyaw", PF_vectoyaw, 13, 13, 13, 0, "float(vector v)"},
{"spawn", PF_Spawn, 14, 14, 14, 0, "entity()"},
{"remove", PF_Remove, 15, 15, 15, 0, "void(entity e)"},
{"traceline", PF_svtraceline, 16, 16, 16, 0, "void(vector v1, vector v2, float nomonsters, entity ent)"},
{"checkclient", PF_checkclient, 17, 17, 17, 0, "entity()"},
{"find", PF_FindString, 18, 18, 18, 0, "entity(entity start, .string fld, string match)"},
{"precache_sound", PF_precache_sound, 19, 19, 19, 0, "string(string s)"},
{"precache_model", PF_precache_model, 20, 20, 20, 0, "string(string s)"},
{"stuffcmd", PF_stuffcmd, 21, 21, 21, 0, "void(entity client, string s)"},
{"findradius", PF_findradius, 22, 22, 22, 0, "entity(vector org, float rad)"},
{"ignore", PF_Ignore, 0, 0, 0, 0, D("void()","Ignored by the engine. Returns 0.")},
{"makevectors", PF_makevectors, 1, 1, 1, 0, D("void(vector vang)","Takes an angle vector (pitch,yaw,roll). Writes its results into v_forward, v_right, v_up vectors.")},
{"setorigin", PF_setorigin, 2, 2, 2, 0, D("void(entity e, vector o)","Changes e's origin to be equal to o. Also relinks collision state (as well as setting absmin+absmax), which is required after changing .solid")},
{"setmodel", PF_setmodel, 3, 3, 3, 0, D("void(entity e, string m)","Looks up m in the model precache list, and sets both e.model and e.modelindex to match. BSP models will set e.mins and e.maxs accordingly, other models depend upon the value of sv_gameplayfix_setmodelrealbox - for compatibility you should always call setsize after all pickups or non-bsp models. Also relinks collision state.")},
{"setsize", PF_setsize, 4, 4, 4, 0, D("void(entity e, vector min, vector max)", "Sets the e's mins and maxs fields. Also relinks collision state, which sets absmin and absmax too.")},
{"qtest_setabssize",PF_setsize, 5, 0, 0, 0, D("void(entity e, vector min, vector max)", "qtest"), true},
{"lightstylestatic",PF_lightstylestatic,0, 0, 5, 5, D("void(float style, float val)", "Sets the lightstyle to an explicit numerical level. From Hexen2.")},
{"break", PF_break, 6, 6, 6, 0, D("void()", "Trigger a debugging event. FTE will break into the qc debugger. Other engines may crash with a debug execption.")},
{"random", PF_random, 7, 7, 7, 0, D("float()", "Returns a random value between 0 and 1. Be warned, this builtin can return 1 in most engines, which can break arrays.")},
{"sound", PF_sound, 8, 8, 8, 0, D("void(entity e, float chan, string samp, float vol, float atten, optional float speedpct, optional float flags)", "Starts a sound centered upon the given entity.\nchan is the entity sound channel to use, channel 0 will allow you to mix many samples at once, others will replace the old sample\n'samp' must have been precached first\nif specified, 'speedpct' should normally be around 100 (or =0), 200 for double speed or 50 for half speed.\nflags&1 means the sound should be sent reliably.")},
{"normalize", PF_normalize, 9, 9, 9, 0, D("vector(vector v)", "Shorten or lengthen a direction vector such that it is only one quake unit long.")},
{"error", PF_error, 10, 10, 10, 0, D("void(string e)", "Ends the game with an easily readable error message.")},
{"objerror", PF_objerror, 11, 11, 11, 0, D("void(string e)", "Displays a non-fatal easily readable error message concerning the self entity, including a field dump. self will be removed!")},
{"vlen", PF_vlen, 12, 12, 12, 0, D("float(vector v)", "Returns the square root of the dotproduct of a vector with itself. Or in other words the length of a distance vector, in quake units.")},
{"vectoyaw", PF_vectoyaw, 13, 13, 13, 0, D("float(vector v)", "Given a direction vector, returns the yaw (_y) angle in which that direction vector points.")},
{"spawn", PF_Spawn, 14, 14, 14, 0, D("entity()", "Adds a brand new entity into the world! Hurrah, you're now a parent!")},
{"remove", PF_Remove, 15, 15, 15, 0, D("void(entity e)", "Destroys the given entity and clears some limited fields (including model, modelindex, solid, classname). Any references to the entity following the call are an error. After two seconds, the entity will be reused, in the interim you can unfortunatly still read its fields to see if the reference is no longer valid.")},
{"traceline", PF_svtraceline, 16, 16, 16, 0, D("void(vector v1, vector v2, float flags, entity ent)", "Traces an infinitely thin line through the world from v1 towards v2.\nWill not collide with ent, ent.owner, or any entity who's owner field refers to ent.\nThere are no side effects beyond the trace_* globals being written.\nflags&MOVE_NOMONSTERS will not impact on non-bsp entities.\nflags&MOVE_MISSILE will impact with increased size.\nflags&MOVE_HITMODEL will impact upon model meshes, instead of their bounding boxes.\nflags&MOVE_TRIGGERS will also stop on triggers\nflags&MOVE_EVERYTHING will stop if it hits anything, even non-solid entities.\nflags&MOVE_LAGGED will backdate entity positions for the purposes of this builtin according to the indicated player ent's latency, to provide lag compensation.")},
{"checkclient", PF_checkclient, 17, 17, 17, 0, D("entity()", "Returns one of the player entities. The returned player will change periodically.")},
{"find", PF_FindString, 18, 18, 18, 0, D("entity(entity start, .string fld, string match)", "Scan for the next entity with a given field set to the given 'match' value. start should be either world, or the previous entity that was found. Returns world on failure/if there are no more.")},
{"precache_sound", PF_precache_sound, 19, 19, 19, 0, D("string(string s)", "Precaches a sound, making it known to clients and loading it from disk. This builtin (strongly) should be called during spawn functions. This builtin must be called for the sound before the sound builtin is called, or it might not even be heard.")},
{"precache_model", PF_precache_model, 20, 20, 20, 0, D("string(string s)", "Precaches a model, making it known to clients and loading it from disk if it has a .bsp extension. This builtin (strongly) should be called during spawn functions. This must be called for each model name before setmodel may use that model name.\nModelindicies precached in SSQC will always be positive. CSQC precaches will be negative if they are not also on the server.")},
{"stuffcmd", PF_stuffcmd, 21, 21, 21, 0, D("void(entity client, string s)", "Sends a console command (or cvar) to the client, where it will be executed. Different clients support different commands. Do NOT forget the final \\n.\nThis builtin is generally considered evil.")},
{"findradius", PF_findradius, 22, 22, 22, 0, D("entity(vector org, float rad)", "Finds all entities within a distance of the 'org' specified. One entity is returned directly, while other entities are returned via that entity's .chain field.")},
//both bprint and sprint accept different arguments in QW vs NQ/H2
{"bprint", PF_bprint, 23, 0, 23, 0, "void(string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)"},
{"bprint", PF_bprint, 0, 23, 0, 0, "void(float msglvl, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)"},
{"sprint", PF_sprint, 24, 0, 24, 0, "void(entity client, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)"},
{"sprint", PF_sprint, 0, 24, 0, 0, "void(entity client, float msglvl, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6)"},
{"bprint", PF_bprint, 23, 0, 23, 0, D("void(string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)", "NQ: Concatenates all arguments, and prints the messsage on the console of all connected clients.")},
{"bprint", PF_bprint, 0, 23, 0, 0, D("void(float msglvl, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)", "QW: Concatenates all string arguments, and prints the messsage on the console of only all clients who's 'msg' infokey is set lower or equal to the supplied 'msglvl' argument.")},
{"sprint", PF_sprint, 24, 0, 24, 0, D("void(entity client, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7)", "NQ: Concatenates all string arguments, and prints the messsage on the named client's console")},
{"sprint", PF_sprint, 0, 24, 0, 0, D("void(entity client, float msglvl, string s, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6)", "NQ: Concatenates all string arguments, and prints the messsage on the named client's console, but only if that client's 'msg' infokey is set lower or equal to the supplied 'msglvl' argument.")},
//these have subtly different behaviour, and are implemented using different internal builtins, which is a bit weird in the extensions file. documentation is documentation.
{"dprint", PF_dprint, 25, 0, 25, 0, "void(string s, ...)"},
{"dprint", PF_print, 0, 25, 0, 0, "void(string s, ...)"},
{"ftos", PF_ftos, 26, 26, 26, 0, "string(float val)"},
{"vtos", PF_vtos, 27, 27, 27, 0, "string(vector val)"},
{"coredump", PF_coredump, 28, 28, 28, 0, "void()"},
{"traceon", PF_traceon, 29, 29, 29, 0, "void()"},
{"traceoff", PF_traceoff, 30, 30, 30, 0, "void()"},
{"eprint", PF_eprint, 31, 31, 31, 0, "void(entity e)"},// debug print an entire entity
{"walkmove", PF_walkmove, 32, 32, 32, 0, "float(float yaw, float dist)"},
{"tracearea", PF_traceboxh2, 0, 0, 33, 0, "void(vector v1, vector v2, vector mins, vector maxs, float nomonsters, entity ent)"},
{"dprint", PF_dprint, 25, 0, 25, 0, D("void(string s, ...)", "NQ: Prints the given message on the server's console, but only if the developer cvar is set. Arguments will be concatenated into a single message.")},
{"dprint", PF_print, 0, 25, 0, 0, D("void(string s, ...)", "QW: Unconditionally prints the given message on the server's console. Arguments will be concatenated into a single message.")},
{"ftos", PF_ftos, 26, 26, 26, 0, D("string(float val)", "Returns a tempstring containing a representation of the given float. Precision depends upon engine.")},
{"vtos", PF_vtos, 27, 27, 27, 0, D("string(vector val)", "Returns a tempstring containing a representation of the given vector. Precision depends upon engine.")},
{"coredump", PF_coredump, 28, 28, 28, 0, D("void()", "Writes out a coredump. This contains stack, globals, and field info for all ents. This can be handy for debugging.")},
{"traceon", PF_traceon, 29, 29, 29, 0, D("void()", "Enables tracing. This may be spammy, slow, and stuff. Set debugger 1 in order to use fte's qc debugger.")},
{"traceoff", PF_traceoff, 30, 30, 30, 0, D("void()", "Disables tracing again.")},
{"eprint", PF_eprint, 31, 31, 31, 0, D("void(entity e)", "Debugging builtin that prints all fields of the given entity to the console.")},// debug print an entire entity
{"walkmove", PF_walkmove, 32, 32, 32, 0, D("float(float yaw, float dist, optional float settraceglobals)", "Attempt to walk the entity at a given angle for a given distance.\nif settraceglobals is set, the trace_* globals will be set, showing the results of the movement.\nThis function will trigger touch events.")},
{"tracearea", PF_traceboxh2, 0, 0, 33, 0, D("void(vector v1, vector v2, vector mins, vector maxs, float nomonsters, entity ent)", "For hexen2 compat")},
// {"qtest_flymove", NULL, 33}, // float(vector dir) flymove = #33;
//qbism super8's 'private'sound #33
{"droptofloor", PF_droptofloor, 34, 34, 34, 0, "float()"},
{"lightstyle", PF_lightstyle, 35, 35, 35, 0, "void(float lightstyle, string stylestring)"},
{"rint", PF_rint, 36, 36, 36, 0, "float(float)"},
{"floor", PF_floor, 37, 37, 37, 0, "float(float)"},
{"ceil", PF_ceil, 38, 38, 38, 0, "float(float)"},
{"droptofloor", PF_droptofloor, 34, 34, 34, 0, D("float()", "Instantly moves the entity downwards until it hits the ground. If the entity would need to drop more than 'pr_droptofloorunits' quake units, its position will be considered invalid and the builtin will abort.")},
{"lightstyle", PF_lightstyle, 35, 35, 35, 0, D("void(float lightstyle, string stylestring, optional float channels)", "Specifies an auto-animating string that specifies the light intensity for entities using that lightstyle.\na is off, z is fully lit. Should be lower case only.\nchannels&1 enables red light.\nchannels&2 enables green light.\nchannels&4 enables blue light.\n")},
{"rint", PF_rint, 36, 36, 36, 0, D("float(float)", "Rounds the given float up or down to the closest integeral value. X.5 rounds away from 0")},
{"floor", PF_floor, 37, 37, 37, 0, D("float(float)", "Rounds the given float downwards, even when negative.")},
{"ceil", PF_ceil, 38, 38, 38, 0, D("float(float)", "Rounds the given float upwards, even when negative.")},
{"qtest_canreach", PF_Ignore, 39, 0, 0, 0, "float(vector v)"}, // QTest builtin called in effectless statement
{"checkbottom", PF_checkbottom, 40, 40, 40, 0, "float(entity ent)"},
{"pointcontents", PF_pointcontents, 41, 41, 41, 0, "float(vector pos)"},
{"checkbottom", PF_checkbottom, 40, 40, 40, 0, D("float(entity ent)", "Expensive checks to ensure that the entity is actually sitting on something solid, returns true if it is.")},
{"pointcontents", PF_pointcontents, 41, 41, 41, 0, D("float(vector pos)", "Checks the given point to see what is there. Returns one of the SOLID_* constants. Just because a spot is empty does not mean that the player can stand there due to the size of the player - use tracebox for such tests.")},
// {"qtest_stopsound", NULL, 42}, // defined QTest builtin that is never called
{"fabs", PF_fabs, 43, 43, 43, 0, "float(float)"},
{"aim", PF_aim, 44, 44, 44, 0, "vector(entity player, float missilespeed)"}, //44
{"cvar", PF_cvar, 45, 45, 45, 0, "float(string)"},
{"localcmd", PF_localcmd, 46, 46, 46, 0, "void(string, ...)"},
{"nextent", PF_nextent, 47, 47, 47, 0, "entity(entity)"},
{"particle", PF_particle, 48, 0, 48, 48, "void(vector pos, vector dir, float colour, float count)"}, //48 nq readded. This isn't present in QW protocol (fte added it back).
{"changeyaw", PF_changeyaw, 49, 49, 49, 0, "#define ChangeYaw changeyaw\nvoid()"},
{"fabs", PF_fabs, 43, 43, 43, 0, D("float(float)", "Removes the sign of the float, making it positive if it is negative.")},
{"aim", PF_aim, 44, 44, 44, 0, D("vector(entity player, float missilespeed)", "Returns a direction vector (specifically v_forward on error). This builtin attempts to guess what pitch angle to fire projectiles at for people that don't know about mouselook. Does not affect yaw angles.")}, //44
{"cvar", PF_cvar, 45, 45, 45, 0, D("float(string)", "Returns the numeric value of the named cvar")},
{"localcmd", PF_localcmd, 46, 46, 46, 0, D("void(string, ...)", "Adds the string to the console command queue. Commands will not be executed immediately, but rather at the start of the following frame.")},
{"nextent", PF_nextent, 47, 47, 47, 0, D("entity(entity)", "Returns the following entity. Skips over removed entities. Returns world when passed the last valid entity.")},
{"particle", PF_particle, 48, 0, 48, 48, D("void(vector pos, vector dir, float colour, float count)", "Spawn 'count' particles around 'pos' moving in the direction 'dir', with a palette colour index between 'colour' and 'colour+8'.")}, //48 nq readded. This isn't present in QW protocol (fte added it back).
{"changeyaw", PF_changeyaw, 49, 49, 49, 0, D("#define ChangeYaw changeyaw\nvoid()", "Changes the self.angles_y field towards self.ideal_yaw by up to self.yawspeed.")},
// {"qtest_precacheitem", NULL, 50}, // defined QTest builtin that is never called
{"vhlen", PF_vhlen, 0, 0, 50, 0, "float(vector)"},
{"vectoangles", PF_vectoangles, 51, 51, 51, 0, "vector(vector fwd, optional vector up)"},
{"vhlen", PF_vhlen, 0, 0, 50, 0, D("float(vector)", "Returns the horizontal length of the given vector ignoring z dispalcement - specifically sqrt(x*x+y*y)")},
{"vectoangles", PF_vectoangles, 51, 51, 51, 0, D("vector(vector fwd, optional vector up)", "Returns the angles required to orient an entity to look in the given direction. The 'up' argument is required if you wish to set a roll angle, otherwise it will be limited to just monster-style turning.")},
{"WriteByte", PF_WriteByte, 52, 52, 52, 0, "void(float to, float val)"}, //52
{"WriteByte", PF_WriteByte, 52, 52, 52, 0, D("void(float to, float val)", "Writes a single byte into a network message buffer. Typically you will find a more correct alternative to writing arbitary data. 'to' should be one of the MSG_* constants. MSG_ONE must have msg_entity set first.")}, //52
{"WriteChar", PF_WriteChar, 53, 53, 53, 0, "void(float to, float val)"}, //53
{"WriteShort", PF_WriteShort, 54, 54, 54, 0, "void(float to, float val)"}, //54
{"WriteLong", PF_WriteLong, 55, 55, 55, 0, "void(float to, float val)"}, //55
@ -9175,13 +9181,13 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"etos", PF_etos, 0, 0, 0, 65, "string(entity ent)"},
{"movetogoal", PF_sv_movetogoal, 67, 67, 67, 0, "void(float step)"}, //67
{"precache_file", PF_precache_file, 68, 68, 68, 0, "string(string s)"}, //68
{"makestatic", PF_makestatic, 69, 69, 69, 0, "void(entity e)"}, //69
{"precache_file", PF_precache_file, 68, 68, 68, 0, D("string(string s)", "This builtin does nothing. It was used only as a hint for pak generation.")}, //68
{"makestatic", PF_makestatic, 69, 69, 69, 0, D("void(entity e)", "Sends a copy of the entity's renderable fields to all clients, and REMOVES the entity, preventing further changes. This means it will be unmutable and non-solid.")}, //69
{"changelevel", PF_changelevel, 70, 70, 70, 0, "void(string mapname, optional string newmapstartspot)"}, //70
{"lightstylevalue", PF_lightstylevalue, 0, 0, 71, 0, "float(float lstyle)"}, //70
{"changelevel", PF_changelevel, 70, 70, 70, 0, D("void(string mapname, optional string newmapstartspot)", "Attempts to change the map to the named map. If 'newmapstartspot' is specified, the state of the current map will be preserved, and the argument will be passed to the next map in the 'startspot' global, and the next map will be loaded from archived state if it was previously visited. If not specified, all archived map states will be purged.")}, //70
{"lightstylevalue", PF_lightstylevalue, 0, 0, 71, 0, D("float(float lstyle)", "Returns the last value passed into the lightstylestatic builtin, or the first value specified by the style string passed to the lightstyle builtin")}, //70
{"cvar_set", PF_cvar_set, 72, 72, 72, 0, "void(string cvarname, string valuetoset)"}, //72
{"cvar_set", PF_cvar_set, 72, 72, 72, 0, D("void(string cvarname, string valuetoset)", "Instantly sets a cvar to the given string value.")}, //72
{"centerprint", PF_centerprint, 73, 73, 73, 0, "void(entity ent, string text, optional string text2, optional string text3, optional string text4, optional string text5, optional string text6, optional string text7)"}, //73
{"ambientsound", PF_ambientsound, 74, 74, 74, 0, "void (vector pos, string samp, float vol, float atten)"}, //74
@ -9195,58 +9201,58 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"logfrag", PF_logfrag, 0, 79, 0, 79, "void(entity killer, entity killee)"}, //79
// Tomaz - QuakeC String Manipulation Begin
{"tq_zone", PF_dupstring, 0, 0, 0, 79, "string(string s)", true}, //79
{"tq_unzone", PF_forgetstring, 0, 0, 0, 80, "void(string s)", true}, //80
{"tq_stof", PF_stof, 0, 0, 0, 81, "float(string s)", true}, //81
{"tq_strcat", PF_strcat, 0, 0, 0, 82, "string(string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)", true}, //82
{"tq_substring", PF_substring, 0, 0, 0, 83, "string(string str, float start, float len)", true}, //83
{"tq_stof", PF_stof, 0, 0, 0, 84, "float(string s)", true}, //84
{"tq_stov", PF_stov, 0, 0, 0, 85, "vector(string s)", true}, //85
{"tq_zone", PF_dupstring, 0, 0, 0, 79, D("string(string s)",NULL), true}, //79
{"tq_unzone", PF_forgetstring, 0, 0, 0, 80, D("void(string s)",NULL), true}, //80
{"tq_stof", PF_stof, 0, 0, 0, 81, D("float(string s)",NULL), true}, //81
{"tq_strcat", PF_strcat, 0, 0, 0, 82, D("string(string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)",NULL), true}, //82
{"tq_substring", PF_substring, 0, 0, 0, 83, D("string(string str, float start, float len)",NULL), true}, //83
{"tq_stof", PF_stof, 0, 0, 0, 84, D("float(string s)",NULL), true}, //84
{"tq_stov", PF_stov, 0, 0, 0, 85, D("vector(string s)",NULL), true}, //85
// Tomaz - QuakeC String Manipulation End
// Tomaz - QuakeC File System Begin (new mods use frik_file instead)
{"tq_fopen", PF_fopen, 0, 0, 0, 86, "float(string filename, float mode)", true},// (QSG_FILE)
{"tq_fclose", PF_fclose, 0, 0, 0, 87, "void(float fhandle)", true},// (QSG_FILE)
{"tq_fgets", PF_fgets, 0, 0, 0, 88, "string(float fhandle)", true},// (QSG_FILE)
{"tq_fputs", PF_fputs, 0, 0, 0, 89, "void(float fhandle, string s)", true},// (QSG_FILE)
{"tq_fopen", PF_fopen, 0, 0, 0, 86, D("float(string filename, float mode)",NULL), true},// (QSG_FILE)
{"tq_fclose", PF_fclose, 0, 0, 0, 87, D("void(float fhandle)",NULL), true},// (QSG_FILE)
{"tq_fgets", PF_fgets, 0, 0, 0, 88, D("string(float fhandle)",NULL), true},// (QSG_FILE)
{"tq_fputs", PF_fputs, 0, 0, 0, 89, D("void(float fhandle, string s)",NULL), true},// (QSG_FILE)
// Tomaz - QuakeC File System End
{"rain_go", PF_h2rain_go, 0, 0, 80, 0}, //80
{"infokey", PF_infokey, 0, 80, 0, 80, "string(entity e, string key)"}, //80
{"infokey", PF_infokey, 0, 80, 0, 80, D("string(entity e, string key)", "If e is world, returns the field 'key' from either the serverinfo or the localinfo. If e is a player, returns the value of 'key' from the player's userinfo string. There are a few special exceptions, like 'ip' which is not technically part of the userinfo.")}, //80
{"stof", PF_stof, 0, 81, 0, 81, "float(string)"}, //81
{"multicast", PF_multicast, 0, 82, 0, 82, "#define unicast(pl,reli) do{msg_entity = pl; multicast('0 0 0', reli?MULITCAST_ONE_R:MULTICAST_ONE);}while(0)\n"
"void(vector where, float set)"}, //82
{"multicast", PF_multicast, 0, 82, 0, 82, D("#define unicast(pl,reli) do{msg_entity = pl; multicast('0 0 0', reli?MULITCAST_ONE_R:MULTICAST_ONE);}while(0)\n"
"void(vector where, float set)", "Once the MSG_MULTICAST network message buffer has been filled with data, this builtin is used to dispatch it to the given target, filtering by pvs for reduced network bandwidth.")}, //82
//mvdsv (don't require ebfs usage in qw)
{"executecommand", PF_ExecuteCommand, 0, 0, 0, 83, "void()", true},
{"mvdtokenize", PF_Tokenize, 0, 0, 0, 84, "void(string str)", true},
{"mvdargc", PF_ArgC, 0, 0, 0, 85, "float()", true},
{"mvdargv", PF_ArgV, 0, 0, 0, 86, "string(float num)", true},
{"executecommand", PF_ExecuteCommand, 0, 0, 0, 83, D("void()",NULL), true},
{"mvdtokenize", PF_Tokenize, 0, 0, 0, 84, D("void(string str)",NULL), true},
{"mvdargc", PF_ArgC, 0, 0, 0, 85, D("float()",NULL), true},
{"mvdargv", PF_ArgV, 0, 0, 0, 86, D("string(float num)",NULL), true},
//mvd commands
//some of these are a little iffy.
//we support them for mvdsv compatability but some of them look very hacky.
//these ones are not honoured with numbers, but can be used via the proper means.
{"teamfield", PF_teamfield, 0, 0, 0, 87, "void(.string teamfield)", true},
{"substr", PF_substr, 0, 0, 0, 88, "string(string str, float start, float len)", true},
{"mvdstrcat", PF_strcat, 0, 0, 0, 89, "string(string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)", true},
{"mvdstrlen", PF_strlen, 0, 0, 0, 90, "float(string s)", true},
{"str2byte", PF_str2byte, 0, 0, 0, 91, "float(string str)", true},
{"str2short", PF_str2short, 0, 0, 0, 92, "float(string str)", true},
{"mvdnewstr", PF_newstring, 0, 0, 0, 93, "string(string s, optional float bufsize)", true},
{"mvdfreestr", PF_forgetstring, 0, 0, 0, 94, "void(string s)", true},
{"conprint", PF_conprint, 0, 0, 0, 95, "void(string s, ...)", true},
{"readcmd", PF_readcmd, 0, 0, 0, 96, "string(string str)", true},
{"mvdstrcpy", PF_MVDSV_strcpy, 0, 0, 0, 97, "void(string dst, string src)", true},
{"strstr", PF_strstr, 0, 0, 0, 98, "string(string str, string sub)", true},
{"mvdstrncpy", PF_MVDSV_strncpy, 0, 0, 0, 99, "void(string dst, string src, float count)", true},
{"log", PF_log, 0, 0, 0, 100, "void(string name, float console, string text)", true},
// {"redirectcmd", PF_redirectcmd, 0, 0, 0, 101, "void(entity to, string str)", true},
{"mvdcalltimeofday",PF_calltimeofday, 0, 0, 0, 102, "void()", true},
{"forcedemoframe", PF_forcedemoframe, 0, 0, 0, 103, "void(float now)", true},
{"teamfield", PF_teamfield, 0, 0, 0, 87, D("void(.string teamfield)",NULL), true},
{"substr", PF_substr, 0, 0, 0, 88, D("string(string str, float start, float len)",NULL), true},
{"mvdstrcat", PF_strcat, 0, 0, 0, 89, D("string(string s1, optional string s2, optional string s3, optional string s4, optional string s5, optional string s6, optional string s7, optional string s8)",NULL), true},
{"mvdstrlen", PF_strlen, 0, 0, 0, 90, D("float(string s)",NULL), true},
{"str2byte", PF_str2byte, 0, 0, 0, 91, D("float(string str)",NULL), true},
{"str2short", PF_str2short, 0, 0, 0, 92, D("float(string str)",NULL), true},
{"mvdnewstr", PF_newstring, 0, 0, 0, 93, D("string(string s, optional float bufsize)",NULL), true},
{"mvdfreestr", PF_forgetstring, 0, 0, 0, 94, D("void(string s)",NULL), true},
{"conprint", PF_conprint, 0, 0, 0, 95, D("void(string s, ...)",NULL), true},
{"readcmd", PF_readcmd, 0, 0, 0, 96, D("string(string str)",NULL), true},
{"mvdstrcpy", PF_MVDSV_strcpy, 0, 0, 0, 97, D("void(string dst, string src)",NULL), true},
{"strstr", PF_strstr, 0, 0, 0, 98, D("string(string str, string sub)",NULL), true},
{"mvdstrncpy", PF_MVDSV_strncpy, 0, 0, 0, 99, D("void(string dst, string src, float count)",NULL), true},
{"log", PF_log, 0, 0, 0, 100, D("void(string name, float console, string text)",NULL), true},
// {"redirectcmd", PF_redirectcmd, 0, 0, 0, 101, D("void(entity to, string str)",NULL), true},
{"mvdcalltimeofday",PF_calltimeofday, 0, 0, 0, 102, D("void()",NULL), true},
{"forcedemoframe", PF_forcedemoframe, 0, 0, 0, 103, D("void(float now)",NULL), true},
//end of mvdsv
{"setpuzzlemodel", PF_h2set_puzzle_model,0, 0, 87, 0},
@ -9258,7 +9264,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"v_factor", PF_h2v_factor, 0, 0, 94, 0},
{"v_factorrange", PF_h2v_factorrange, 0, 0, 95, 0},
{"precache_puzzle_model", PF_h2precache_puzzle_model,0, 0, 90, 0},
{"precache_puzzle_model",PF_h2precache_puzzle_model,0,0,90, 0},
{"concatv", PF_h2concatv, 0, 0, 91, 0},
{"precache_sound3", PF_precache_sound, 0, 0, 96, 0},
{"precache_model3", PF_precache_model, 0, 0, 97, 0},//please don't use...
@ -9274,7 +9280,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"precache_model4", PF_precache_model, 0, 0, 116, 0},//please don't use...
{"precache_sound4", PF_precache_sound, 0, 0, 117, 0},
{"tracebox", PF_traceboxdp, 0, 0, 0, 90, "void(vector start, vector mins, vector maxs, vector end, float nomonsters, entity ent)"},
{"tracebox", PF_traceboxdp, 0, 0, 0, 90, D("void(vector start, vector mins, vector maxs, vector end, float nomonsters, entity ent)", "Exactly like traceline, but a box instead of a uselessly thin point. Acceptable sizes are limited by bsp format, q1bsp has strict acceptable size values.")},
{"randomvec", PF_randomvector, 0, 0, 0, 91, "vector()"},
{"getlight", PF_sv_getlight, 0, 0, 0, 92, "vector(vector org)"},// (DP_QC_GETLIGHT),
@ -9283,22 +9289,22 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"max", PF_max, 0, 0, 0, 95, "float(float a, float b, ...)"},// (DP_QC_MINMAXBOUND)
{"bound", PF_bound, 0, 0, 0, 96, "float(float minimum, float val, float maximum)"},// (DP_QC_MINMAXBOUND)
{"pow", PF_pow, 0, 0, 0, 97, "float(float value, float exp)"},
{"tj_cvar_string", PF_cvar_string, 0, 0, 0, 97, "string(string cvarname)", true}, //telejano
{"tj_cvar_string", PF_cvar_string, 0, 0, 0, 97, D("string(string cvarname)",NULL), true}, //telejano
//DP_QC_FINDFLOAT
{"findfloat", PF_FindFloat, 0, 0, 0, 98, "entity(entity start, .float fld, float match)"}, // #98 (DP_QC_FINDFLOAT)
{"checkextension", PF_checkextension, 99, 99, 0, 99, "float(string extname)"}, // #99 //darkplaces system - query a string to see if the mod supports X Y and Z.
{"builtin_find", PF_builtinsupported,100, 100, 0, 100, "float(string builtinname)"}, // #100 //per builtin system.
{"anglemod", PF_anglemod, 0, 0, 0, 102, "float(float value)"},
{"qsg_cvar_string", PF_cvar_string, 0, 0, 0, 103, "string(string cvarname)", true},
{"qsg_cvar_string", PF_cvar_string, 0, 0, 0, 103, D("string(string cvarname)",NULL), true},
//TEI_SHOWLMP2
{"showpic", PF_ShowPic, 0, 0, 0, 104, "void(string slot, string picname, float x, float y, float zone, optional entity player)"},
{"hidepic", PF_HidePic, 0, 0, 0, 105, "void(string slot, optional entity player)"},
{"movepic", PF_MovePic, 0, 0, 0, 106, "void(string slot, float x, float y, float zone, optional entity player)"},
{"changepic", PF_ChangePic, 0, 0, 0, 107, "void(string slot, string picname, optional entity player)"},
{"showpicent", PF_ShowPic, 0, 0, 0, 108, "void(string slot, entity player)", true},
{"hidepicent", PF_HidePic, 0, 0, 0, 109, "void(string slot, entity player)", true},
{"showpicent", PF_ShowPic, 0, 0, 0, 108, D("void(string slot, entity player)",NULL), true},
{"hidepicent", PF_HidePic, 0, 0, 0, 109, D("void(string slot, entity player)",NULL), true},
// {"movepicent", PF_ShowPic, 0, 0, 0, 110, "void(string slot, float x, float y, float zone, entity player)", true},
// {"changepicent", PF_HidePic, 0, 0, 0, 111, "void(string slot, string picname, entity player)", true},
//End TEU_SHOWLMP2
@ -9318,7 +9324,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
//these are telejano's
{"cvar_setf", PF_cvar_setf, 0, 0, 0, 176, "void(string cvar, float val)"},
{"localsound", PF_LocalSound, 0, 0, 0, 177, "", true},// #177
{"localsound", PF_LocalSound, 0, 0, 0, 177, D("", NULL), true},// #177
//end telejano
//fte extras
@ -9327,7 +9333,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"addprogs", PF_addprogs, 0, 0, 0, 202, "float(string progsname)"},
{"externvalue", PF_externvalue, 0, 0, 0, 203, "__variant(float prnum, string varname)"},
{"externset", PF_externset, 0, 0, 0, 204, "void(float prnum, __variant newval, string varname)"},
{"externrefcall", PF_externrefcall, 0, 0, 0, 205, "__variant(float prnum, void() func, ...)", true},
{"externrefcall", PF_externrefcall, 0, 0, 0, 205, D("__variant(float prnum, void() func, ...)",NULL), true},
{"instr", PF_instr, 0, 0, 0, 206, "float(string input, string token)"},
#ifdef Q2BSPS
{"openportal", PF_OpenPortal, 0, 0, 0, 207, "void(float portal, float state)"},
@ -9353,7 +9359,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
//I guess this should go under DP_TE_STANDARDEFFECTBUILTINS...
{"te_lightningblood",PF_te_lightningblood, 0, 0, 0, 219, "void(vector pos)"},// #219 te_lightningblood
{"map_builtin", PF_builtinsupported,0, 0, 0, 220, "", true}, //like #100 - takes 2 args. arg0 is builtinname, 1 is number to map to.
{"map_builtin", PF_builtinsupported,0, 0, 0, 220, D("",NULL), true}, //like #100 - takes 2 args. arg0 is builtinname, 1 is number to map to.
//FTE_STRINGS
{"strstrofs", PF_strstrofs, 0, 0, 0, 221, "float(string s1, string sub, optional float startidx)"},
@ -9372,10 +9378,10 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"calltimeofday", PF_calltimeofday, 0, 0, 0, 231, "void()"},
//EXT_CSQC
{"clientstat", PF_clientstat, 0, 0, 0, 232, "void(float num, float type, .__variant fld)"}, //EXT_CSQC
{"globalstat", PF_globalstat, 0, 0, 0, 233, "void(float num, float type, string name)"}, //EXT_CSQC_1 actually
{"clientstat", PF_clientstat, 0, 0, 0, 232, D("void(float num, float type, .__variant fld)", "Specifies what data to use in order to send various stats, in a client-specific way.\n'num' should be a value between 32 and 127, other values are reserved.\n'type' must be set to one of the EV_* constants, one of EV_FLOAT, EV_STRING, EV_INTEGER, EV_ENTITY.\nfld must be a reference to the field used, each player will be sent only their own copy of these fields.")}, //EXT_CSQC
{"globalstat", PF_globalstat, 0, 0, 0, 233, D("void(float num, float type, string name)", "Specifies what data to use in order to send various stats, in a non-client-specific way. num and type are as in clientstat, name however, is the name of the global to read in the form of a string.")}, //EXT_CSQC_1 actually
//END EXT_CSQC
{"isbackbuffered", PF_isbackbuffered, 0, 0, 0, 234, "float(entity player)"},
{"isbackbuffered", PF_isbackbuffered, 0, 0, 0, 234, D("float(entity player)", "Returns if the given player's network buffer will take multiple network frames in order to clear. If this builtin returns non-zero, you should delay or reduce the amount of reliable (and also unreliable) data that you are sending to that client.")},
{"rotatevectorsbyangle",PF_rotatevectorsbyangles,0,0, 0, 235, "void(vector angle)"}, // #235
{"rotatevectorsbyvectors",PF_rotatevectorsbymatrix,0,0, 0, 236, "void(vector fwd, vector right, vector up)"}, // #236
{"skinforname", PF_skinforname, 0, 0, 0, 237, "float(float mdlindex, string skinname)"}, // #237
@ -9411,116 +9417,116 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"stoh", PF_stoh, 0, 0, 0, 261, "int(string)"},
{"htos", PF_htos, 0, 0, 0, 262, "string(int)"},
{"skel_create", PF_skel_create, 0, 0, 0, 263, "float(float modlindex, optional float useabstransforms)"}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_build", PF_skel_build, 0, 0, 0, 264, "float(float skel, entity ent, float modelindex, float retainfrac, float firstbone, float lastbone, optional float addfrac)"}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_get_numbones",PF_skel_get_numbones,0, 0, 0, 265, "float(float skel)"}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_get_bonename",PF_skel_get_bonename,0, 0, 0, 266, "string(float skel, float bonenum)"}, // (FTE_CSQC_SKELETONOBJECTS) (returns tempstring)
{"skel_get_boneparent",PF_skel_get_boneparent,0,0, 0, 267, "float(float skel, float bonenum)"}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_find_bone", PF_skel_find_bone, 0, 0, 0, 268, "float(float skel, string tagname)"}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_get_bonerel",PF_skel_get_bonerel,0, 0, 0, 269, "vector(float skel, float bonenum)"}, // (FTE_CSQC_SKELETONOBJECTS) (sets v_forward etc)
{"skel_get_boneabs",PF_skel_get_boneabs,0, 0, 0, 270, "vector(float skel, float bonenum)"}, // (FTE_CSQC_SKELETONOBJECTS) (sets v_forward etc)
{"skel_set_bone", PF_skel_set_bone, 0, 0, 0, 271, "void(float skel, float bonenum, vector org, optional vector fwd, optional vector right, optional vector up)"}, // (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
{"skel_mul_bone", PF_skel_mul_bone, 0, 0, 0, 272, "void(float skel, float bonenum, vector org, optional vector fwd, optional vector right, optional vector up)"}, // (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
{"skel_mul_bones", PF_skel_mul_bones, 0, 0, 0, 273, "void(float skel, float startbone, float endbone, vector org, optional vector fwd, optional vector right, optional vector up)"}, // (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
{"skel_copybones", PF_skel_copybones, 0, 0, 0, 274, "void(float skeldst, float skelsrc, float startbone, float entbone)"}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_delete", PF_skel_delete, 0, 0, 0, 275, "void(float skel)"}, // (FTE_CSQC_SKELETONOBJECTS)
{"frameforname", PF_frameforname, 0, 0, 0, 276, "float(float modidx, string framename)"},// (FTE_CSQC_SKELETONOBJECTS)
{"frameduration", PF_frameduration, 0, 0, 0, 277, "float(float modidx, float framenum)"},// (FTE_CSQC_SKELETONOBJECTS)
{"skel_create", PF_skel_create, 0, 0, 0, 263, D("float(float modlindex, optional float useabstransforms)", "Allocates a new uninitiaised skeletal object, with enough bone info to animate the given model.\neg: self.skeletonobject = skel_create(self.modelindex);")}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_build", PF_skel_build, 0, 0, 0, 264, D("float(float skel, entity ent, float modelindex, float retainfrac, float firstbone, float lastbone, optional float addfrac)", "Animation data (according to the entity's frame info) is pulled from the specified model and blended into the specified skeletal object.\nIf retainfrac is set to 0 on the first call and 1 on the others, you can blend multiple animations together according to the addfrac value. The final weight should be 1. Other values will result in scaling and/or other weirdness. You can use firstbone and lastbone to update only part of the skeletal object, to allow legs to animate separately from torso, use 0 for both arguments to specify all, as bones are 1-based.")}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_get_numbones",PF_skel_get_numbones,0, 0, 0, 265, D("float(float skel)", "Retrives the number of bones in the model. The valid range is 1<=bone<=numbones.")}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_get_bonename",PF_skel_get_bonename,0, 0, 0, 266, D("string(float skel, float bonenum)", "Retrieves the name of the specified bone. Mostly only for debugging.")}, // (FTE_CSQC_SKELETONOBJECTS) (returns tempstring)
{"skel_get_boneparent",PF_skel_get_boneparent,0,0, 0, 267, D("float(float skel, float bonenum)", "Retrieves which bone this bone's position is relative to. Bone 0 refers to the entity's position rather than an actual bone")}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_find_bone", PF_skel_find_bone, 0, 0, 0, 268, D("float(float skel, string tagname)", "Finds a bone by its name, from the model that was used to create the skeletal object.")}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_get_bonerel",PF_skel_get_bonerel,0, 0, 0, 269, D("vector(float skel, float bonenum)", "Gets the bone position and orientation relative to the bone's parent. Return value is the offset, and v_forward, v_right, v_up contain the orientation.")}, // (FTE_CSQC_SKELETONOBJECTS) (sets v_forward etc)
{"skel_get_boneabs",PF_skel_get_boneabs,0, 0, 0, 270, D("vector(float skel, float bonenum)", "Gets the bone position and orientation relative to the entity. Return value is the offset, and v_forward, v_right, v_up contain the orientation.\nUse gettaginfo for world coord+orientation.")}, // (FTE_CSQC_SKELETONOBJECTS) (sets v_forward etc)
{"skel_set_bone", PF_skel_set_bone, 0, 0, 0, 271, D("void(float skel, float bonenum, vector org, optional vector fwd, optional vector right, optional vector up)", "Sets a bone position relative to its parent. If the orientation arguments are not specified, v_forward+v_right+v_up are used instead.")}, // (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
{"skel_mul_bone", PF_skel_mul_bone, 0, 0, 0, 272, D("void(float skel, float bonenum, vector org, optional vector fwd, optional vector right, optional vector up)", "Transforms a single bone by a matrix. You can use makevectors to generate a rotation matrix from an angle.")}, // (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
{"skel_mul_bones", PF_skel_mul_bones, 0, 0, 0, 273, D("void(float skel, float startbone, float endbone, vector org, optional vector fwd, optional vector right, optional vector up)", "Transforms an entire consecutive range of bones by a matrix. You can use makevectors to generate a rotation matrix from an angle, but you'll probably want to divide the angle by the number of bones.")}, // (FTE_CSQC_SKELETONOBJECTS) (reads v_forward etc)
{"skel_copybones", PF_skel_copybones, 0, 0, 0, 274, D("void(float skeldst, float skelsrc, float startbone, float entbone)", "Copy bone data from one skeleton directly into another.")}, // (FTE_CSQC_SKELETONOBJECTS)
{"skel_delete", PF_skel_delete, 0, 0, 0, 275, D("void(float skel)", "Deletes a skeletal object. The actual delete is delayed, allowing the skeletal object to be deleted in an entity's predraw function yet still be valid by the time the addentity+renderscene builtins need it. Also uninstanciates any ragdoll currently in effect on the skeletal object.")}, // (FTE_CSQC_SKELETONOBJECTS)
{"frameforname", PF_frameforname, 0, 0, 0, 276, D("float(float modidx, string framename)", "Looks up a framegroup from a model by name, avoiding the need for hardcoding. Returns -1 on error.")},// (FTE_CSQC_SKELETONOBJECTS)
{"frameduration", PF_frameduration, 0, 0, 0, 277, D("float(float modidx, float framenum)", "Retrieves the duration (in seconds) of the specified framegroup.")},// (FTE_CSQC_SKELETONOBJECTS)
{"terrain_edit", PF_terrain_edit, 0, 0, 0, 278, "void(float action, optional vector pos, optional float radius, optional float quant, ...)"},// (??FTE_TERRAIN_EDIT??
{"touchtriggers", PF_touchtriggers, 0, 0, 0, 279, "void()"},//
{"touchtriggers", PF_touchtriggers, 0, 0, 0, 279, D("void()", "Triggers a touch events between self and every entity that it is in contact with. This should typically just be the triggers touch functions.")},//
{"writefloat", PF_WriteFloat, 0, 0, 0, 280, "void(float buf, float fl)"},//
{"skel_ragupdate", PF_skel_ragedit, 0, 0, 0, 281, "float(entity skelent, string dollcmd, float animskel)" NYI}, // (FTE_CSQC_RAGDOLL)
{"skel_mmap", PF_skel_mmap, 0, 0, 0, 282, "float*(float skel)"},// (FTE_QC_RAGDOLL)
{"skel_set_bone_world",PF_skel_set_bone_world,0,0, 0, 283, "void(entity ent, float bonenum, vector org, optional vector angorfwd, optional vector right, optional vector up)"},
{"skel_ragupdate", PF_skel_ragedit, 0, 0, 0, 281, D("float(entity skelent, string dollcmd, float animskel)", "Updates the skeletal object attached to the entity according to its origin and other properties.\nif animskel is non-zero, the ragdoll will animate towards the bone state in the animskel skeletal object, otherwise they will pick up the model's base pose which may not give nice results.\nIf dollcmd is not set, the ragdoll will update (this should be done each frame).\nIf the doll is updated without having a valid doll, the model's default .doll will be instanciated.\ncommands:\n doll foo.doll : sets up the entity to use the named doll file\n dollstring TEXT : uses the doll file directly embedded within qc, with that extra prefix.\n cleardoll : uninstanciates the doll without destroying the skeletal object.\n animate 0.5 : specifies the strength of the ragdoll as a whole \n animatebody somebody 0.5 : specifies the strength of the ragdoll on a specific body (0 will disable ragdoll animations on that body).\n enablejoint somejoint 1 : enables (or disables) a joint. Disabling joints will allow the doll to shatter.")}, // (FTE_CSQC_RAGDOLL)
{"skel_mmap", PF_skel_mmap, 0, 0, 0, 282, D("float*(float skel)", "Map the bones in VM memory. They can then be accessed via pointers. Each bone is 12 floats, the four vectors interleaved (sadly).")},// (FTE_QC_RAGDOLL)
{"skel_set_bone_world",PF_skel_set_bone_world,0,0, 0, 283, D("void(entity ent, float bonenum, vector org, optional vector angorfwd, optional vector right, optional vector up)", "Sets the world position of a bone within the given entity's attached skeletal object. The world position is dependant upon the owning entity's position. If no orientation argument is specified, v_forward+v_right+v_up are used for the orientation instead. If 1 is specified, it is understood as angles. If 3 are specified, they are the forawrd/right/up vectors to use.")},
{"frametoname", PF_frametoname, 0, 0, 0, 284, "string(float modidx, float framenum)"},
{"skintoname", PF_skintoname, 0, 0, 0, 285, "string(float modidx, float skin)"},
// {"cvar_setlatch", PF_cvar_setlatch, 0, 0, 0, 286, "void(string cvarname, optional string value)"},
{"hash_createtab", PF_hash_createtab, 0, 0, 0, 287, "float(float tabsize)"},
{"hash_destroytab", PF_hash_destroytab, 0, 0, 0, 288, "void(float table)"},
{"hash_add", PF_hash_add, 0, 0, 0, 289, "void(float table, string name, __variant value)"}, //adds the given key with the given value to the table. value will NOT be strzoned or anything fancy like that, so don't pass temp strings there. Its okay to pass temp strings for 'name' though.
{"hash_get", PF_hash_get, 0, 0, 0, 290, "__variant(float table, string name, __variant default)"}, //looks up the specified key name. returns default if key was not found.
{"hash_delete", PF_hash_delete, 0, 0, 0, 291, "__variant(float table, string name)"}, //removes the named key. returns its value.
{"hash_getkey", PF_hash_getkey, 0, 0, 0, 292, "string(float table, float idx)"}, //gets some random key name. add+delete can change return values of this. suggested use is: while((n = hash_getkey(t,0))) strunzone(hash_delete(t,n));
{"hash_createtab", PF_hash_createtab, 0, 0, 0, 287, D("float(float tabsize)", "Creates a hash table object with at least 'tabsize' slots")},
{"hash_destroytab", PF_hash_destroytab, 0, 0, 0, 288, D("void(float table)", "Destroys a hash table object.")},
{"hash_add", PF_hash_add, 0, 0, 0, 289, D("void(float table, string name, __variant value)", "Adds the given key with the given value to the table. value will NOT be strzoned or anything fancy like that, so don't pass temp strings there. Its okay to pass temp strings for 'name' though.")},
{"hash_get", PF_hash_get, 0, 0, 0, 290, D("__variant(float table, string name, __variant deflt)", "looks up the specified key name in the hash table. returns deflt if key was not found.")},
{"hash_delete", PF_hash_delete, 0, 0, 0, 291, D("__variant(float table, string name)", "removes the named key. returns the value of the object that was destroyed, or 0 on error.")},
{"hash_getkey", PF_hash_getkey, 0, 0, 0, 292, D("string(float table, float idx)", "gets some random key name. add+delete can change return values of this. suggested use is: while((n = hash_getkey(t,0))) strunzone(hash_delete(t,n));")},
{"clearscene", PF_Fixme, 0, 0, 0, 300, "void()"},// (EXT_CSQC)
{"addentities", PF_Fixme, 0, 0, 0, 301, "void(float mask)"},// (EXT_CSQC)
{"addentity", PF_Fixme, 0, 0, 0, 302, "void(entity ent)"},// (EXT_CSQC)
{"setproperty", PF_Fixme, 0, 0, 0, 303, "#define setviewprop setproperty\nfloat(float property, ...)"},// (EXT_CSQC)
{"renderscene", PF_Fixme, 0, 0, 0, 304, "void()"},// (EXT_CSQC)
{"clearscene", PF_Fixme, 0, 0, 0, 300, D("void()", "Forgets all rentities, polygons, and temporary dlights. Resets all view properties to their default values.")},// (EXT_CSQC)
{"addentities", PF_Fixme, 0, 0, 0, 301, D("void(float mask)", "Walks through all entities effectively doing this:\n if (ent.drawmask&mask){ ent.predaw(); if (wasremoved(ent)||(ent.renderflags&RF_NOAUTOADD))continue; addentity(ent); }\nIf mask&MASK_DELTA, non-csqc entities, particles, and related effects will also be added to the rentity list.\n If mask&MASK_STDVIEWMODEL then the default view model will also be added.")},// (EXT_CSQC)
{"addentity", PF_Fixme, 0, 0, 0, 302, D("void(entity ent)", "Copies the entity fields into a new rentity for later rendering via addscene.")},// (EXT_CSQC)
{"setproperty", PF_Fixme, 0, 0, 0, 303, D("#define setviewprop setproperty\nfloat(float property, ...)", "Allows you to override default view properties like viewport, fov, and whether the engine hud will be drawn. Different VF_ values have slightly different arguments, some are vectors, some floats.")},// (EXT_CSQC)
{"renderscene", PF_Fixme, 0, 0, 0, 304, D("void()", "Draws all entities, polygons, and particles on the rentity list (which were added via addentities or addentity), using the various view properties set via setproperty. There is no ordering dependancy.\nThe scene must generally be cleared again before more entities are added, as entities will persist even over to the next frame.\nYou may call this builtin multiple times per frame, but should only be called from CSQC_UpdateView.")},// (EXT_CSQC)
{"dynamiclight_add",PF_Fixme, 0, 0, 0, 305, "float(vector org, float radius, vector lightcolours)"},// (EXT_CSQC)
{"dynamiclight_add",PF_Fixme, 0, 0, 0, 305, D("float(vector org, float radius, vector lightcolours)", "Adds a temporary dlight, ready to be drawn via addscene.")},// (EXT_CSQC)
//gonna expose these to ssqc as a debugging extension
{"R_BeginPolygon", PF_R_PolygonBegin,0,0, 0, 306, "void(string texturename, optional float flags)"},// (EXT_CSQC_???)
{"R_PolygonVertex", PF_R_PolygonVertex,0,0, 0, 307, "void(vector org, vector texcoords, vector rgb, float alpha)"},// (EXT_CSQC_???)
{"R_EndPolygon", PF_R_PolygonEnd,0, 0, 0, 308, "void()"},// (EXT_CSQC_???)
{"R_BeginPolygon", PF_R_PolygonBegin,0,0, 0, 306, D("void(string texturename, optional float flags)", "Specifies the shader to use for the following polygons, along with optional flags.\nIf flags&4, the polygon will be drawn as soon as the EndPolygon call is made, rather than waiting for renderscene. This allows complex 2d effects.")},// (EXT_CSQC_???)
{"R_PolygonVertex", PF_R_PolygonVertex,0,0, 0, 307, D("void(vector org, vector texcoords, vector rgb, float alpha)", "Specifies a polygon vertex with its various properties.")},// (EXT_CSQC_???)
{"R_EndPolygon", PF_R_PolygonEnd,0, 0, 0, 308, D("void()", "Ends the current polygon. At least 3 verticies must have been specified. You do not need to call beginpolygon if you wish to draw another polygon with the same shader.")},
{"getproperty", PF_Fixme, 0, 0, 0, 309, "#define getviewprop getproperty\n__variant(float property)"},// (EXT_CSQC_1)
{"getproperty", PF_Fixme, 0, 0, 0, 309, D("#define getviewprop getproperty\n__variant(float property)", "Retrieve a currently-set (typically view) property, allowing you to read the current viewport or other things. Due to cheat protection, certain values may be unretrievable.")},// (EXT_CSQC_1)
//310
//maths stuff that uses the current view settings.
{"unproject", PF_Fixme, 0, 0, 0, 310, "vector (vector v)"},// (EXT_CSQC)
{"project", PF_Fixme, 0, 0, 0, 311, "vector (vector v)"},// (EXT_CSQC)
{"unproject", PF_Fixme, 0, 0, 0, 310, D("vector (vector v)", "Transform a 2d screen-space point (with depth) into a 3d world-space point, according the various origin+angle+fov etc settings set via setproperty.")},// (EXT_CSQC)
{"project", PF_Fixme, 0, 0, 0, 311, D("vector (vector v)", "Transform a 3d world-space point into a 2d screen-space point, according the various origin+angle+fov etc settings set via setproperty.")},// (EXT_CSQC)
//2d (immediate) operations
{"drawline", PF_Fixme, 0, 0, 0, 315, "void(float width, vector pos1, vector pos2)"},// (EXT_CSQC)
{"iscachedpic", PF_Fixme, 0, 0, 0, 316, "float(string name)"},// (EXT_CSQC)
{"precache_pic", PF_Fixme, 0, 0, 0, 317, "string(string name, optional float trywad)"},// (EXT_CSQC)
{"drawgetimagesize",PF_Fixme, 0, 0, 0, 318, "#define draw_getimagesize drawgetimagesize\nvector(string picname)"},// (EXT_CSQC)
{"freepic", PF_Fixme, 0, 0, 0, 319, "void(string name)"},// (EXT_CSQC)
{"drawline", PF_Fixme, 0, 0, 0, 315, D("void(float width, vector pos1, vector pos2)", "Draws a 2d line between the 2d points")},// (EXT_CSQC)
{"iscachedpic", PF_Fixme, 0, 0, 0, 316, D("float(string name)", "Checks to see if the image is currently loaded. Engines might lie, or cache between maps.")},// (EXT_CSQC)
{"precache_pic", PF_Fixme, 0, 0, 0, 317, D("string(string name, optional float trywad)", "Forces the engine to load the named image. If trywad is specified, the specified name must any lack path and extension.")},// (EXT_CSQC)
{"drawgetimagesize",PF_Fixme, 0, 0, 0, 318, D("#define draw_getimagesize drawgetimagesize\nvector(string picname)", "Returns the dimensions of the named image. Images specified with .lmp should give the original .lmp's dimensions even if texture replacements use a different resolution.")},// (EXT_CSQC)
{"freepic", PF_Fixme, 0, 0, 0, 319, D("void(string name)", "Tells the engine that the image is no longer needed. The image will appear to be new the next time its needed.")},// (EXT_CSQC)
//320
{"drawcharacter", PF_Fixme, 0, 0, 0, 320, "float(vector position, float character, vector scale, vector rgb, float alpha, optional float flag)"},// (EXT_CSQC, [EXT_CSQC_???])
{"drawrawstring", PF_Fixme, 0, 0, 0, 321, "float(vector position, string text, vector scale, vector rgb, float alpha, optional float flag)"},// (EXT_CSQC, [EXT_CSQC_???])
{"drawpic", PF_Fixme, 0, 0, 0, 322, "float(vector position, string pic, vector size, vector rgb, float alpha, optional float flag)"},// (EXT_CSQC, [EXT_CSQC_???])
{"drawfill", PF_Fixme, 0, 0, 0, 323, "float(vector position, vector size, vector rgb, float alpha, optional float flag)"},// (EXT_CSQC, [EXT_CSQC_???])
{"drawsetcliparea", PF_Fixme, 0, 0, 0, 324, "void(float x, float y, float width, float height)"},// (EXT_CSQC_???)
{"drawresetcliparea",PF_Fixme, 0, 0, 0, 325, "void(void)"},// (EXT_CSQC_???)
{"drawcharacter", PF_Fixme, 0, 0, 0, 320, D("float(vector position, float character, vector size, vector rgb, float alpha, optional float flag)", "Draw the given quake character at the given position.\nIf flag&4, the function will consider the char to be a unicode char instead (or display as a ? if outside the 32-127 range).\nsize should normally be something like '8 8 0'.\nrgb should normally be '1 1 1'\nalpha normally 1.\nSoftware engines may assume the named defaults.\nNote that ALL text may be rescaled on the X axis due to variable width fonts. The X axis may even be ignored completely.")},// (EXT_CSQC, [EXT_CSQC_???])
{"drawrawstring", PF_Fixme, 0, 0, 0, 321, D("float(vector position, string text, vector size, vector rgb, float alpha, optional float flag)", "Draws the specified string without using any markup at all, even in engines that support it.\nIf UTF-8 is globally enabled in the engine, then that encoding is used (without additional markup), otherwise it is raw quake chars.\nSoftware engines may assume a size of '8 8 0', rgb='1 1 1', alpha=1, flag&3=0, but it is not an error to draw out of the screen.")},// (EXT_CSQC, [EXT_CSQC_???])
{"drawpic", PF_Fixme, 0, 0, 0, 322, D("float(vector position, string pic, vector size, vector rgb, float alpha, optional float flag)", "Draws an shader within the given 2d screen box. Software engines may omit support for rgb+alpha, but must support rescaling, and must clip to the screen without crashing.")},// (EXT_CSQC, [EXT_CSQC_???])
{"drawfill", PF_Fixme, 0, 0, 0, 323, D("float(vector position, vector size, vector rgb, float alpha, optional float flags)", "Draws a solid block over the given 2d box, with given colour, alpha, and blend mode (specified via flags).\nflags&3=0 simple blend.\nflags&3=1 additive blend")},// (EXT_CSQC, [EXT_CSQC_???])
{"drawsetcliparea", PF_Fixme, 0, 0, 0, 324, D("void(float x, float y, float width, float height)", "Specifies a 2d clipping region (aka: scissor test). 2d draw calls will all be clipped to this 2d box, the area outside will not be modified by any 2d draw call (even 2d polygons).")},// (EXT_CSQC_???)
{"drawresetcliparea",PF_Fixme, 0, 0, 0, 325, D("void(void)", "Reverts the scissor/clip area to the whole screen.")},// (EXT_CSQC_???)
{"drawstring", PF_Fixme, 0, 0, 0, 326, "float(vector position, string text, vector scale, vector rgb, float alpha, float flag)"},// #326
{"stringwidth", PF_Fixme, 0, 0, 0, 327, "float(string text, float usecolours, optional vector fontsize)"},// EXT_CSQC_'DARKPLACES'
{"drawsubpic", PF_Fixme, 0, 0, 0, 328, "void(vector pos, vector sz, string pic, vector srcpos, vector srcsz, vector rgb, float alpha, float flag)"},// #328 EXT_CSQC_'DARKPLACES'
{"drawstring", PF_Fixme, 0, 0, 0, 326, D("float(vector position, string text, vector size, vector rgb, float alpha, float flag)", "Draws a string, interpreting markup and recolouring as appropriate.")},// #326
{"stringwidth", PF_Fixme, 0, 0, 0, 327, D("float(string text, float usecolours, optional vector fontsize)", "Calculates the width of the screen in virtual pixels. If usecolours is 1, markup that does not affect the string width will be ignored. Will always be decoded as UTF-8 if UTF-8 is globally enabled.\nIf the char size is not specified, '8 8 0' will be assumed.")},// EXT_CSQC_'DARKPLACES'
{"drawsubpic", PF_Fixme, 0, 0, 0, 328, D("void(vector pos, vector sz, string pic, vector srcpos, vector srcsz, vector rgb, float alpha, float flag)", "Draws a rescaled subsection of an image to the screen.")},// #328 EXT_CSQC_'DARKPLACES'
//330
{"getstati", PF_Fixme, 0, 0, 0, 330, "float(float stnum)"},// (EXT_CSQC)
{"getstatbits", PF_Fixme, 0, 0, 0, 331, "#define getstatf getstatbits\nfloat(float stnum, optional float firstbit, optional float bitcount)"},// (EXT_CSQC)
{"getstats", PF_Fixme, 0, 0, 0, 332, "string(float firststnum)"},
{"getstati", PF_Fixme, 0, 0, 0, 330, D("float(float stnum)", "Retrieves the numerical value of the given EV_INTEGER or EV_ENTITY stat (converted to a float).")},// (EXT_CSQC)
{"getstatf", PF_Fixme, 0, 0, 0, 331, D("#define getstatbits getstatf\nfloat(float stnum, optional float firstbit, optional float bitcount)", "Retrieves the numerical value of the given EV_FLOAT stat. If firstbit and bitcount are specified, retrieves the upper bits of the STAT_ITEMS stat.")},// (EXT_CSQC)
{"getstats", PF_Fixme, 0, 0, 0, 332, D("string(float firststnum)", "Retrieves the value of the given EV_STRING stat, as a tempstring.\nOlder engines may use 4 consecutive integer stats, with a limit of 15 chars (yes, really. 15.), but "DISTRIBUTION" uses a separate namespace for string stats and has a much higher length limit.")},
//EXT_CSQC
{"setmodelindex", PF_Fixme, 0, 0, 0, 333, "void(entity e, float mdlindex)"},//
{"modelnameforindex",PF_Fixme, 0, 0, 0, 334, "string(float mdlindex)"},//
{"particleeffectnum",PF_sv_particleeffectnum,0,0,0, 335, "float(string effectname)"},// (EXT_CSQC)
{"trailparticles", PF_sv_trailparticles,0, 0, 0, 336, "void(float effectnum, entity ent, vector start, vector end)"},// (EXT_CSQC),
{"pointparticles", PF_sv_pointparticles,0, 0, 0, 337, "void(float effectnum, vector origin, optional vector dir, optional float count)"},// (EXT_CSQC)
{"particleeffectnum",PF_sv_particleeffectnum,0,0,0, 335, D("float(string effectname)", "Precaches the named particle effect. If your effect name is of the form 'foo.bar' then particles/foo.cfg will be loaded by the client if foo.bar was not already defined.\nDifferent engines will have different particle systems, this specifies the QC API only.")},// (EXT_CSQC)
{"trailparticles", PF_sv_trailparticles,0, 0, 0, 336, D("void(float effectnum, entity ent, vector start, vector end)", "Draws the given effect between the two named points. If ent is not world, distances will be cached in the entity in order to avoid framerate dependancies. The entity is not otherwise used.")},// (EXT_CSQC),
{"pointparticles", PF_sv_pointparticles,0, 0, 0, 337, D("void(float effectnum, vector origin, optional vector dir, optional float count)", "Spawn a load of particles from the given effect at the given point traveling or aiming along the direction specified. The number of particles are scaled by the count argument.")},// (EXT_CSQC)
{"cprint", PF_Fixme, 0, 0, 0, 338, "void(string s, ...)"},//(EXT_CSQC)
{"print", PF_print, 0, 0, 0, 339, "void(string s, ...)"},//(EXT_CSQC)
{"cprint", PF_Fixme, 0, 0, 0, 338, D("void(string s, ...)", "Print into the center of the screen just as ssqc's centerprint would appear.")},//(EXT_CSQC)
{"print", PF_print, 0, 0, 0, 339, D("void(string s, ...)", "Unambiguously print on the local system's console, even in ssqc (doesn't care about the value of the developer cvar).")},//(EXT_CSQC)
{"keynumtostring", PF_Fixme, 0, 0, 0, 340, "string(float keynum)"},// (EXT_CSQC)
{"stringtokeynum", PF_Fixme, 0, 0, 0, 341, "float(string keyname)"},// (EXT_CSQC)
{"getkeybind", PF_Fixme, 0, 0, 0, 342, "string(float keynum)"},// (EXT_CSQC)
{"keynumtostring", PF_Fixme, 0, 0, 0, 340, D("string(float keynum)", "Returns a hunam-readable name for the given keycode, as a tempstring.")},// (EXT_CSQC)
{"stringtokeynum", PF_Fixme, 0, 0, 0, 341, D("float(string keyname)", "Looks up the key name in the same way that the bind command would, returning the keycode for that key.")},// (EXT_CSQC)
{"getkeybind", PF_Fixme, 0, 0, 0, 342, D("string(float keynum)", "Finds the current binding for the given key (ignores modifiers like shift/alt/ctrl).")},// (EXT_CSQC)
{"getmousepos", PF_Fixme, 0, 0, 0, 344, "vector()"}, // #344 This is a DP extension
{"getmousepos", PF_Fixme, 0, 0, 0, 344, D("vector()", "Nasty convoluted DP extension. Typically returns deltas instead of positions. Use CSQC_InputEvent for such things in csqc mods.")}, // #344 This is a DP extension
{"getinputstate", PF_Fixme, 0, 0, 0, 345, "float(float framenum)"},// (EXT_CSQC)
{"setsensitivityscaler",PF_Fixme,0, 0, 0, 346, "void(float sens)"},// (EXT_CSQC)
{"getinputstate", PF_Fixme, 0, 0, 0, 345, D("float(float inputsequencenum)", "Looks up an input frame from the log, setting the input_* globals accordingly.\nThe sequence number range used for prediction should normally be servercommandframe < sequence <= clientcommandframe.\nThe sequence equal to clientcommandframe will change between input frames.")},// (EXT_CSQC)
{"setsensitivityscaler",PF_Fixme,0, 0, 0, 346, D("void(float sens)", "Temporarily scales the player's mouse sensitivity based upon something like zoom, avoiding potential cvar saving and thus corruption.")},// (EXT_CSQC)
{"runstandardplayerphysics",PF_runclientphys,0,0,0, 347, "void(entity ent)"},
{"getplayerkeyvalue", PF_Fixme,0, 0, 0, 348, "string(float playernum, string keyname)"},// (EXT_CSQC)
{"runstandardplayerphysics",PF_runclientphys,0,0,0, 347, D("void(entity ent)", "Perform the engine's standard player movement prediction upon the given entity using the input_* globals to describe movement.")},
{"getplayerkeyvalue", PF_Fixme,0, 0, 0, 348, D("string(float playernum, string keyname)", "Look up a player's userinfo, to discover things like their name, topcolor, bottomcolor, skin, team, *ver.\nAlso includes scoreboard info like frags, ping, pl, userid, entertime, as well as voipspeaking and voiploudness.")},// (EXT_CSQC)
{"isdemo", PF_Fixme, 0, 0, 0, 349, "float()"},// (EXT_CSQC)
{"isserver", PF_Fixme, 0, 0, 0, 350, "float()"},//(EXT_CSQC)
{"SetListener", PF_Fixme, 0, 0, 0, 351, "void(vector origin, vector forward, vector right, vector up)"},// (EXT_CSQC)
{"registercommand", PF_Fixme, 0, 0, 0, 352, "void(string cmdname)"},//(EXT_CSQC)
{"wasfreed", PF_WasFreed,0, 0, 0, 353, "float(entity ent)"},//(EXT_CSQC) (should be availabe on server too)
{"serverkey", PF_Fixme, 0, 0, 0, 354, "string(string key)"},//
{"getentitytoken", PF_Fixme, 0, 0, 0, 355, "string(optional string resetstring)"},//;
{"findfont", PF_Fixme, 0, 0, 0, 356, "float(string s)"},//;
{"loadfont", PF_Fixme, 0, 0, 0, 357, "float(string fontname, string fontmaps, string sizes, float slot, optional float fix_scale, optional float fix_voffset)"},
{"isdemo", PF_Fixme, 0, 0, 0, 349, D("float()", "Returns if the client is currently playing a demo or not")},// (EXT_CSQC)
{"isserver", PF_Fixme, 0, 0, 0, 350, D("float()", "Returns if the client is acting as the server (aka: listen server)")},//(EXT_CSQC)
{"SetListener", PF_Fixme, 0, 0, 0, 351, D("void(vector origin, vector forward, vector right, vector up)", "Sets the position of the view, as far as the audio subsystem is concerned. This should be called once per CSQC_UpdateView as it will otherwise revert to default.")},// (EXT_CSQC)
{"registercommand", PF_Fixme, 0, 0, 0, 352, D("void(string cmdname)", "Register the given console command, for easy console use.\nConsole commands that are later used will invoke CSQC_ConsoleCommand.")},//(EXT_CSQC)
{"wasfreed", PF_WasFreed,0, 0, 0, 353, D("float(entity ent)", "Quickly check to see if the entity is currently free. This function is only valid during the two-second non-reuse window, after that it may give bad results. Try one second to make it more robust.")},//(EXT_CSQC) (should be availabe on server too)
{"serverkey", PF_Fixme, 0, 0, 0, 354, D("string(string key)", "Look up a key in the server's public serverinfo string")},//
{"getentitytoken", PF_Fixme, 0, 0, 0, 355, D("string(optional string resetstring)", "Grab the next token in the map's entity lump.\nIf resetstring is not specified, the next token will be returned with no other sideeffects.\nIf empty, will reset from the map before returning the first token, probably {.\nIf not empty, will tokenize from that string instead.\nAlways returns tempstrings.")},//;
{"findfont", PF_Fixme, 0, 0, 0, 356, D("float(string s)", "Looks up a named font slot. Matches the actual font name as a last resort.")},//;
{"loadfont", PF_Fixme, 0, 0, 0, 357, D("float(string fontname, string fontmaps, string sizes, float slot, optional float fix_scale, optional float fix_voffset)", "too convoluted for me to even try to explain correct usage. Try drawfont = loadfont(\"foo\", \"cour\", \"16\", 0, 0, 0); to switch to the courier font, if you have the freetype2 library in windows..")},
{"sendevent", PF_Fixme, 0, 0, 0, 359, "void(string evname, string evargs, ...)"},// (EXT_CSQC_1)
{"readbyte", PF_Fixme, 0, 0, 0, 360, "float()"},// (EXT_CSQC)
@ -9536,22 +9542,22 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
// {"readserverentitystate",PF_Fixme,0, 0, 0, 369, "void(float flags, float simtime)"},// (EXT_CSQC_1)
// {"readsingleentitystate",PF_Fixme,0, 0, 0, 370},
{"deltalisten", PF_Fixme, 0, 0, 0, 371, "float(string modelname, float(float isnew) updatecallback, float flags)"},// (EXT_CSQC_1)
{"deltalisten", PF_Fixme, 0, 0, 0, 371, D("float(string modelname, float(float isnew) updatecallback, float flags)", "Specifies a per-modelindex callback to listen for engine-networking entity updates. Such entities are automatically interpolated by the engine (unless flags specifies not to).\nThe various standard entity fields will be overwritten each frame before the updatecallback function is called.")},// (EXT_CSQC_1)
{"dynamiclight_get",PF_Fixme, 0, 0, 0, 372, "__variant(float lno, float fld)"},
{"dynamiclight_set",PF_Fixme, 0, 0, 0, 373, "void(float lno, float fld, __variant value)"},
{"particleeffectquery",PF_Fixme,0, 0, 0, 374, "string(float efnum, float body)"},
{"dynamiclight_get",PF_Fixme, 0, 0, 0, 372, D("__variant(float lno, float fld)", "Retrieves a property from the given dynamic/rt light. Return type depends upon the light field requested.")},
{"dynamiclight_set",PF_Fixme, 0, 0, 0, 373, D("void(float lno, float fld, __variant value)", "Changes a property on the given dynamic/rt light. Value type depends upon the light field to be changed.")},
{"particleeffectquery",PF_Fixme,0, 0, 0, 374, D("string(float efnum, float body)", "Retrieves either the name or the body of the effect with the given number. The effect body is regenerated from internal state, and can be changed before being reapplied via the localcmd builtin.")},
{"adddecal", PF_Fixme, 0, 0, 0, 375, "void(string shadername, vector origin, vector up, vector side, vector rgb, float alpha)"},
{"adddecal", PF_Fixme, 0, 0, 0, 375, D("void(string shadername, vector origin, vector up, vector side, vector rgb, float alpha)", "Adds a temporary clipped decal shader to the scene, centered at the given point with given orientation. Will be drawn by the next renderscene call, and freed by the next clearscene call.")},
//END EXT_CSQC
{"memalloc", PF_memalloc, 0, 0, 0, 384, "__variant*(int size)"},
{"memfree", PF_memfree, 0, 0, 0, 385, "void(__variant *ptr)"},
{"memcpy", PF_memcpy, 0, 0, 0, 386, "void(__variant *dst, __variant *src, int size)"},
{"memfill8", PF_memfill8, 0, 0, 0, 387, "void(__variant *dst, int val, int size)"},
{"memgetval", PF_memgetval, 0, 0, 0, 388, "__variant(__variant *dst, float ofs)"},
{"memsetval", PF_memsetval, 0, 0, 0, 389, "void(__variant *dst, float ofs, __variant val)"},
{"memptradd", PF_memptradd, 0, 0, 0, 390, "__variant*(__variant *base, float ofs)"},
{"memalloc", PF_memalloc, 0, 0, 0, 384, D("__variant*(int size)", "Allocate an arbitary block of memory")},
{"memfree", PF_memfree, 0, 0, 0, 385, D("void(__variant *ptr)", "Frees a block of memory that was allocated with memfree")},
{"memcpy", PF_memcpy, 0, 0, 0, 386, D("void(__variant *dst, __variant *src, int size)", "Copys memory from one location to another")},
{"memfill8", PF_memfill8, 0, 0, 0, 387, D("void(__variant *dst, int val, int size)", "Sets an entire block of memory to a specified value. Pretty much always 0.")},
{"memgetval", PF_memgetval, 0, 0, 0, 388, D("__variant(__variant *dst, float ofs)", "Looks up the 32bit value stored at a pointer-with-offset.")},
{"memsetval", PF_memsetval, 0, 0, 0, 389, D("void(__variant *dst, float ofs, __variant val)", "Changes the 32bit value stored at the specified pointer-with-offset.")},
{"memptradd", PF_memptradd, 0, 0, 0, 390, D("__variant*(__variant *base, float ofs)", "Perform some pointer maths. Woo.")},
//end fte extras
@ -11014,7 +11020,28 @@ void PR_DumpPlatform_f(void)
}
}
}
if (nd)
if (BuiltinList[i].biglongdesc)
{
char *line = BuiltinList[i].biglongdesc;
char *term;
if (!nd)
VFS_PRINTF(f, " /*");
while(*line)
{
VFS_PRINTF(f, "\n\t\t");
term = line;
while(*term && *term != '\n')
term++;
VFS_WRITE(f, line, term - line);
if (*term == '\n')
{
term++;
}
line = term;
}
VFS_PRINTF(f, " */\n\n");
}
else if (nd)
VFS_PRINTF(f, "*/\n");
else
VFS_PRINTF(f, "\n");

View File

@ -1342,7 +1342,7 @@ qboolean PR_LoadQ1QVM(void)
if (q1qvm)
VM_Destroy(q1qvm);
q1qvm = VM_Create(NULL, "qwprogs", syscallnative, syscallqvm);
q1qvm = VM_Create("qwprogs", com_nogamedirnativecode.ival?NULL:syscallnative, syscallqvm);
if (!q1qvm)
{
if (svprogfuncs == &q1qvmprogfuncs)

View File

@ -916,54 +916,6 @@ void *Sys_GetAddressForName(dllhandle_t *module, const char *exportname)
return dlsym(module, exportname);
}
#if 0
static void *game_library;
void Sys_UnloadGame(void)
{
if (game_library)
{
dlclose(game_library);
game_library = 0;
}
}
void *Sys_GetGameAPI(void *parms)
{
void *(*GetGameAPI)(void *);
char name[MAX_OSPATH];
char curpath[MAX_OSPATH];
char *searchpath;
const char *gamename = "gamei386.so";
void *ret;
getcwd(curpath, sizeof(curpath)); // do soemthing with the result
searchpath = 0;
while((searchpath = COM_NextPath(searchpath)))
{
snprintf (name, sizeof(name), "%s/%s/%s", curpath, searchpath, gamename);
game_library = dlopen (name, RTLD_LAZY );
if (game_library)
{
GetGameAPI = (void *)dlsym (game_library, "GetGameAPI");
if (GetGameAPI && (ret = GetGameAPI(parms)))
{
return ret;
}
dlclose(game_library);
game_library = 0;
}
}
return 0;
}
#endif
void Sys_ServerActivity(void)
{
}

View File

@ -224,122 +224,6 @@ char *Sys_GetNameForAddress(dllhandle_t *module, void *address)
#endif
#ifdef Q2SERVER
static HINSTANCE game_library;
/*
=================
Sys_UnloadGame
=================
*/
void Sys_UnloadGame (void)
{
if (!FreeLibrary (game_library))
Sys_Error ("FreeLibrary failed for game library");
game_library = NULL;
}
/*
=================
Sys_GetGameAPI
Loads the game dll
=================
*/
void *Sys_GetGameAPI (void *parms)
{
void *(VARGS *GetGameAPI) (void *);
char name[MAX_OSPATH];
char *path;
char cwd[MAX_OSPATH];
// _M_X64 should be really loading gamex64.dll
#if defined _M_IX86 || defined _M_X64
const char *gamename = "gamex86.dll";
#ifdef NDEBUG
const char *debugdir = "release";
#else
const char *debugdir = "debug";
#endif
#elif defined __amd64__
const char *gamename = "gameamd.dll";
#ifdef NDEBUG
const char *debugdir = "release";
#else
const char *debugdir = "debug";
#endif
#elif defined _M_ALPHA
const char *gamename = "gameaxp.dll";
#ifdef NDEBUG
const char *debugdir = "releaseaxp";
#else
const char *debugdir = "debugaxp";
#endif
#endif
if (game_library)
Sys_Error ("Sys_GetGameAPI without Sys_UnloadingGame");
// check the current debug directory first for development purposes
#ifdef _WIN32
GetCurrentDirectory(sizeof(cwd), cwd);
#else
_getcwd (cwd, sizeof(cwd));
#endif
snprintf (name, sizeof(name), "%s/%s/%s", cwd, debugdir, gamename);
game_library = LoadLibrary ( name );
if (game_library)
{
Con_DPrintf ("LoadLibrary (%s)\n", name);
}
else
{
#ifdef DEBUG
// check the current directory for other development purposes
_snprintf (name, sizeof(name), "%s/%s", cwd, gamename);
game_library = LoadLibrary ( name );
if (game_library)
{
Con_DPrintf ("LoadLibrary (%s)\n", name);
}
else
#endif
{
// now run through the search paths
path = NULL;
while (1)
{
path = COM_NextPath (path);
if (!path)
return NULL; // couldn't find one anywhere
snprintf (name, sizeof(name), "%s/%s", path, gamename);
game_library = LoadLibrary (name);
if (game_library)
{
Con_DPrintf ("LoadLibrary (%s)\n",name);
break;
}
}
}
}
GetGameAPI = (void *)GetProcAddress (game_library, "GetGameAPI");
if (!GetGameAPI)
{
Sys_UnloadGame ();
return NULL;
}
return GetGameAPI (parms);
}
#endif
#include <fcntl.h>
@ -1033,7 +917,7 @@ void Signal_Error_Handler (int sig)
void StartQuakeServer(void)
{
quakeparms_t parms;
//static char cwd[1024]; //unused variable
static char bindir[MAX_OSPATH]; //unused variable
int t;
memset(&parms, 0, sizeof(parms));
@ -1059,6 +943,10 @@ void StartQuakeServer(void)
if (!parms.membase)
Sys_Error("Insufficient memory.\n");
GetModuleFileName(NULL, bindir, sizeof(bindir)-1);
*COM_SkipPath(bindir) = 0;
parms.binarydir = bindir;
parms.basedir = ".";
SV_Init (&parms);

View File

@ -11,9 +11,65 @@ qboolean SVQ2_InitGameProgs(void)
game_export_t *ge;
int svq2_maxclients;
dllhandle_t *q2gamedll;
void SVQ2_UnloadGame (void)
{
if (q2gamedll)
Sys_CloseLibrary(q2gamedll);
q2gamedll = NULL;
}
void *SVQ2_GetGameAPI (void *parms)
{
void *(VARGS *GetGameAPI)(void *);
dllfunction_t funcs[] =
{
{(void**)&GetGameAPI, "GetGameAPI"},
{NULL,NULL}
};
void Sys_UnloadGame (void);
void *Sys_GetGameAPI (void *parms);
char name[MAX_OSPATH];
char *searchpath;
int o;
const char *gamename[] = {
#ifdef _DEBUG
"debug/game" ARCH_CPU_POSTFIX ARCH_DL_POSTFIX,
#endif
#if defined(__linux__) && defined(__i386__)
"game" "i386" ARCH_DL_POSTFIX, //compat is often better than consistancy
#endif
"game" ARCH_CPU_POSTFIX ARCH_DL_POSTFIX,
"game" ARCH_DL_POSTFIX,
NULL
};
void *ret;
Con_DPrintf("Searching for %s\n", gamename);
searchpath = 0;
while((searchpath = COM_NextPath(searchpath)))
{
for (o = 0; gamename[o]; o++)
{
snprintf(name, sizeof(name), "%s%s", searchpath, gamename[o]);
q2gamedll = Sys_LoadLibrary(name, funcs);
if (q2gamedll && gamename)
{
ret = GetGameAPI(parms);
if (ret)
{
return ret;
}
Sys_CloseLibrary(q2gamedll);
q2gamedll = 0;
}
}
}
return NULL;
}
/*
===============
@ -606,7 +662,7 @@ void VARGS SVQ2_ShutdownGameProgs (void)
if (!ge)
return;
ge->Shutdown ();
Sys_UnloadGame ();
SVQ2_UnloadGame ();
ge = NULL;
}
@ -751,14 +807,14 @@ qboolean SVQ2_InitGameProgs(void)
Cvar_ForceSet(Cvar_Get("game", "", CVAR_LATCH, "Q2 compat"), FS_GetGamedir());
Cvar_ForceSet(Cvar_Get("basedir", "", CVAR_LATCH, "Q2 compat"), FS_GetBasedir());
ge = (game_export_t *)Sys_GetGameAPI ((game_import_t*)&import);
ge = (game_export_t *)SVQ2_GetGameAPI ((game_import_t*)&import);
if (!ge)
return false;
if (ge->apiversion != Q2GAME_API_VERSION)
{
Con_Printf("game is version %i, not %i", ge->apiversion, Q2GAME_API_VERSION);
Sys_UnloadGame ();
SVQ2_UnloadGame ();
return false;
}

View File

@ -1694,7 +1694,7 @@ qboolean SVQ3_InitGame(void)
SVQ3_ShutdownGame();
q3gamevm = VM_Create(NULL, "vm/qagame", Q3G_SystemCallsNative, Q3G_SystemCallsVM);
q3gamevm = VM_Create("vm/qagame", com_nogamedirnativecode.ival?NULL:Q3G_SystemCallsNative, Q3G_SystemCallsVM);
if (!q3gamevm)
return false;

View File

@ -19,6 +19,7 @@ char shaders[][64] =
"defaultsprite",
"defaultwall",
"defaultwarp",
"defaultgammacb",
"drawflat_wall",
"lpp_depthnorm",
"lpp_light",

View File

@ -0,0 +1,22 @@
//this shader is applies gamma/contrast/brightness to the source image, and dumps it out.
varying vec2 tc;
varying vec4 vc;
#ifdef VERTEX_SHADER
attribute vec2 v_texcoord;
attribute vec4 v_colour;
void main ()
{
tc = v_texcoord;
vc = v_colour;
gl_Position = ftetransform();
}
#endif
#ifdef FRAGMENT_SHADER
uniform sampler2D s_t0;
void main ()
{
gl_FragColor = pow(texture2D(s_t0, tc) * vc.g, vec4(vc.r)) + vc.b;
}
#endif

View File

@ -132,8 +132,7 @@ void SWRast_Sync(struct workqueue_s *wq);
qboolean SW_VID_Init(rendererstate_t *info, unsigned char *palette);
void SW_VID_DeInit(void);
void SW_VID_SetPalette(unsigned char *palette);
void SW_VID_ShiftPalette(unsigned char *palette);
qboolean SW_VID_ApplyGammaRamps (unsigned short *ramps);
char *SW_VID_GetRGBInfo(int prepad, int *truevidwidth, int *truevidheight);
void SW_VID_SetWindowCaption(char *msg);
void SW_VID_SwapBuffers(void);

View File

@ -976,8 +976,7 @@ rendererinfo_t swrendererinfo =
SW_VID_Init,
SW_VID_DeInit,
SW_VID_SetPalette,
SW_VID_ShiftPalette,
SW_VID_ApplyGammaRamps,
SW_VID_GetRGBInfo,
SW_VID_SetWindowCaption,
@ -997,6 +996,11 @@ rendererinfo_t swrendererinfo =
SWBE_SelectDLight,
SWBE_LightCullModel,
NULL,//void (*BE_VBO_Begin)(vbobctx_t *ctx, unsigned int maxsize);
NULL,//void (*BE_VBO_Data)(vbobctx_t *ctx, void *data, unsigned int size, vboarray_t *varray);
NULL,//void (*BE_VBO_Finish)(vbobctx_t *ctx, void *edata, unsigned int esize, vboarray_t *earray);
NULL,//void (*BE_VBO_Destroy)(vboarray_t *vearray);
"no more"
};
#endif

View File

@ -745,11 +745,9 @@ void SW_VID_DeInit(void)
DIB_Shutdown();
DestroyWindow(mainwindow);
}
void SW_VID_SetPalette(unsigned char *palette)
{
}
void SW_VID_ShiftPalette(unsigned char *palette)
qboolean SW_VID_ApplyGammaRamps (unsigned short *ramps)
{
return false;
}
char *SW_VID_GetRGBInfo(int prepad, int *truevidwidth, int *truevidheight)
{

View File

@ -1,9 +1,9 @@
#include "../plugin.h"
#include "../engine.h"
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include "libswscale/swscale.h"
//between av 52.31 and 54.35, lots of constants etc got renamed to gain an extra AV_ prefix.
/*

View File

@ -1,10 +1,10 @@
#include "../plugin.h"
#include "../engine.h"
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
#include <libavcodec/avcodec.h>
#include <libswscale/swscale.h>
#include "libavformat/avformat.h"
#include "libavformat/avio.h"
#include "libavcodec/avcodec.h"
#include "libswscale/swscale.h"
//#include <libavutil/channel_layout.h>
/*
@ -325,7 +325,7 @@ static void *AVEnc_Begin (char *streamname, int videorate, int width, int height
ctx->fc = avformat_alloc_context();
ctx->fc->oformat = fmt;
snprintf(ctx->fc->filename, sizeof(ctx->fc->filename), "%s", streamname);
Q_snprintf(ctx->fc->filename, sizeof(ctx->fc->filename), "%s", streamname);
//pick default codecs

View File

@ -24,7 +24,7 @@ void Con_SubPrintf(char *subname, char *format, ...)
static char string[1024];
va_start (argptr, format);
vsnprintf (string, sizeof(string), format,argptr);
Q_vsnprintf (string, sizeof(string), format,argptr);
va_end (argptr);
Con_TrySubPrint(subname, string);
@ -34,9 +34,6 @@ void Con_SubPrintf(char *subname, char *format, ...)
//porting zone:
#define Q_strncpyz(o, i, l) do {strncpy(o, i, l-1);o[l-1]='\0';}while(0)
#define COLOURGREEN "^2"
@ -305,11 +302,11 @@ jclient_t *JCL_Connect(char *server, int defport, qboolean usesecure, char *acco
jcl->noplain = true;
*at = '\0';
strlcpy(jcl->username, account, sizeof(jcl->username));
strlcpy(jcl->domain, at+1, sizeof(jcl->domain));
strlcpy(jcl->password, password, sizeof(jcl->password));
Q_strlcpy(jcl->username, account, sizeof(jcl->username));
Q_strlcpy(jcl->domain, at+1, sizeof(jcl->domain));
Q_strlcpy(jcl->password, password, sizeof(jcl->password));
strlcpy(jcl->resource, "Quake", sizeof(jcl->password));
Q_strlcpy(jcl->resource, "Quake", sizeof(jcl->password));
Con_Printf("Trying to connect\n");
JCL_AddClientMessageString(jcl,
@ -422,13 +419,13 @@ xmltree_t *XML_Parse(char *buffer, int *startpos, int maxpos, qboolean headeronl
ns++;
memcpy(ret->xmlns, "xmlns:", 6);
strlcpy(ret->xmlns+6, com_token, sizeof(ret->xmlns)-6);
strlcpy(ret->name, ns, sizeof(ret->name));
Q_strlcpy(ret->xmlns+6, com_token, sizeof(ret->xmlns)-6);
Q_strlcpy(ret->name, ns, sizeof(ret->name));
}
else
{
strlcpy(ret->xmlns, "xmlns", sizeof(ret->xmlns));
strlcpy(ret->name, com_token, sizeof(ret->name));
Q_strlcpy(ret->xmlns, "xmlns", sizeof(ret->xmlns));
Q_strlcpy(ret->name, com_token, sizeof(ret->name));
}
while(*tagstart)
@ -508,10 +505,10 @@ xmltree_t *XML_Parse(char *buffer, int *startpos, int maxpos, qboolean headeronl
}
ns = XML_ParameterOfTree(ret, ret->xmlns);
strlcpy(ret->xmlns, ns?ns:"", sizeof(ret->xmlns));
Q_strlcpy(ret->xmlns, ns?ns:"", sizeof(ret->xmlns));
ns = XML_ParameterOfTree(ret, "xmlns");
strlcpy(ret->xmlns_dflt, ns?ns:defaultnamespace, sizeof(ret->xmlns_dflt));
Q_strlcpy(ret->xmlns_dflt, ns?ns:defaultnamespace, sizeof(ret->xmlns_dflt));
tagend[-1] = '>';
@ -733,7 +730,7 @@ void RenameConsole(char *f)
//so, if we rename the old console before printing, we don't spawn random extra consoles.
char old[256];
char *slash;
strlcpy(old, f, sizeof(old));
Q_strlcpy(old, f, sizeof(old));
slash = strchr(f, '/');
if (slash)
{
@ -830,7 +827,7 @@ int JCL_ClientFrame(jclient_t *jcl)
Con_Printf("Not an xmpp stream\n");
return JCL_KILL;
}
strlcpy(jcl->defaultnamespace, tree->xmlns_dflt, sizeof(jcl->defaultnamespace));
Q_strlcpy(jcl->defaultnamespace, tree->xmlns_dflt, sizeof(jcl->defaultnamespace));
ot = tree;
tree = tree->child;
@ -927,7 +924,7 @@ int JCL_ClientFrame(jclient_t *jcl)
Base64_Add("", 1);
Base64_Add(jcl->password, strlen(jcl->password));
Base64_Finish();
snprintf(msg, sizeof(msg), "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>%s</auth>", base64);
Q_snprintf(msg, sizeof(msg), "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>%s</auth>", base64);
JCL_AddClientMessageString(jcl, msg);
// JCL_AddClientMessageString(jcl, "<auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN'>");
// JCL_AddClientMessageString(jcl, base64);
@ -1033,7 +1030,7 @@ int JCL_ClientFrame(jclient_t *jcl)
int idletime = 0;
unparsable = false;
snprintf(msg, sizeof(msg),
Q_snprintf(msg, sizeof(msg),
"<iq type='result' to='%s' id='%s'>"
"<query xmlns='http://jabber.org/protocol/disco#info'>"
"<identity category='client' type='pc' name='FTEQW'/>"
@ -1051,7 +1048,7 @@ int JCL_ClientFrame(jclient_t *jcl)
char msg[2048];
unparsable = false;
snprintf(msg, sizeof(msg),
Q_snprintf(msg, sizeof(msg),
"<iq type='result' to='%s' id='%s'>"
"<query xmlns='jabber:iq:version'>"
"<name>FTEQW Jabber Plugin</name>"
@ -1071,7 +1068,7 @@ int JCL_ClientFrame(jclient_t *jcl)
unparsable = false;
//last activity
snprintf(msg, sizeof(msg),
Q_snprintf(msg, sizeof(msg),
"<iq type='result' to='%s' id='%s'>"
"<query xmlns='jabber:iq:last' seconds='%i'/>"
"</iq>", from, id, idletime);
@ -1095,11 +1092,11 @@ int JCL_ClientFrame(jclient_t *jcl)
timeinfo = gmtime (&rawtime);
tzs = _timezone;
tzs *= -1;
snprintf(tz, sizeof(tz), "%+i:%i", tzs/(60*60), abs(tzs/60) % 60);
Q_snprintf(tz, sizeof(tz), "%+i:%i", tzs/(60*60), abs(tzs/60) % 60);
strftime(timestamp, sizeof(timestamp), "%Y-%m-%dT%H:%M:%SZ", timeinfo);
unparsable = false;
//strftime
snprintf(msg, sizeof(msg),
Q_snprintf(msg, sizeof(msg),
"<iq type='result' to='%s' id='%s'>"
"<time xmlns='urn:xmpp:time'>"
"<tzo>+00:00</tzo>"
@ -1119,7 +1116,7 @@ int JCL_ClientFrame(jclient_t *jcl)
XML_ConPrintTree(tree, 0);
//tell them OH NOES, instead of requiring some timeout.
snprintf(msg, sizeof(msg),
Q_snprintf(msg, sizeof(msg),
"<iq type='error' to='%s' id='%s'>"
"<error type='cancel'>"
"<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>"
@ -1159,7 +1156,7 @@ int JCL_ClientFrame(jclient_t *jcl)
if (f)
{
strlcpy(jcl->defaultdest, f, sizeof(jcl->defaultdest));
Q_strlcpy(jcl->defaultdest, f, sizeof(jcl->defaultdest));
RenameConsole(f);
}
@ -1286,11 +1283,11 @@ qintptr_t JCL_Frame(qintptr_t *args)
if (strcmp(jclient->curquakeserver, serveraddr))
{
char msg[1024];
strlcpy(jclient->curquakeserver, serveraddr, sizeof(jclient->curquakeserver));
Q_strlcpy(jclient->curquakeserver, serveraddr, sizeof(jclient->curquakeserver));
if (!*jclient->curquakeserver)
strlcpy(msg, "<presence/>", sizeof(msg));
Q_strlcpy(msg, "<presence/>", sizeof(msg));
else
snprintf(msg, sizeof(msg),
Q_snprintf(msg, sizeof(msg),
"<presence>"
"<quake xmlns='fteqw.com:game'>"
"<serverip>sha1-hash-of-image</serverip>"
@ -1328,7 +1325,7 @@ void JCL_Command(void)
if (!msg)
continue;
msg = COM_Parse(msg);
strlcpy(arg[i], com_token, sizeof(arg[i]));
Q_strlcpy(arg[i], com_token, sizeof(arg[i]));
}
if (*arg[0] == '/')
@ -1394,7 +1391,7 @@ void JCL_Command(void)
}
else if (!strcmp(arg[0]+1, "msg"))
{
strlcpy(jclient->defaultdest, arg[1], sizeof(jclient->defaultdest));
Q_strlcpy(jclient->defaultdest, arg[1], sizeof(jclient->defaultdest));
msg = arg[2];
JCL_AddClientMessageString(jclient, "<message to='");

View File

@ -247,7 +247,7 @@ vfsfile_t *MPQ_OpenVFS(void *handle, flocation_t *loc, const char *mode);
void MPQ_GetDisplayPath(void *handle, char *outpath, unsigned int pathsize)
{
mpqarchive_t *mpq = handle;
strlcpy(outpath, mpq->desc, pathsize);
Q_strlcpy(outpath, mpq->desc, pathsize);
}
void MPQ_ClosePath(void *handle)
{
@ -261,15 +261,25 @@ void MPQ_ClosePath(void *handle)
qboolean MPQ_FindFile(void *handle, flocation_t *loc, const char *name, void *hashedresult)
{
mpqarchive_t *mpq = handle;
unsigned int hashentry;
unsigned int blockentry;
hashentry = mpq_lookuphash(handle, name, 0);
if (hashentry == HASH_TABLE_EMPTY)
return false;
blockentry = mpq->hashdata[hashentry].block_table_index;
if (blockentry > mpq->blockentries)
return false;
if (hashedresult)
{
mpqblock_t *block = hashedresult;
if (block >= mpq->blockdata && block <= mpq->blockdata + mpq->blockentries)
blockentry = (mpqblock_t*)block - mpq->blockdata;
else
return false;
}
else
{
unsigned int hashentry = mpq_lookuphash(handle, name, 0);
if (hashentry == HASH_TABLE_EMPTY)
return false;
blockentry = mpq->hashdata[hashentry].block_table_index;
if (blockentry > mpq->blockentries)
return false;
}
if (loc)
{
loc->index = blockentry;
@ -366,10 +376,10 @@ int MPQ_EnumerateFiles(void *handle, const char *match, int (QDECL *func)(const
}
void MPQ_BuildHash(void *handle, int depth, void (QDECL *AddFileHash)(int depth, const char *fname, fsbucket_t *filehandle, void *pathhandle))
{
mpqarchive_t *wp = handle;
char *s, *n;
char name[MAX_QPATH];
mpqarchive_t *mpq = handle;
flocation_t loc;
if (mpq->listfile)
{
s = mpq->listfile;
@ -385,8 +395,10 @@ void MPQ_BuildHash(void *handle, int depth, void (QDECL *AddFileHash)(int depth,
memcpy(name, s, n - s);
name[n-s] = 0;
AddFileHash(depth, name, NULL, wp);
//precompute the name->block lookup. fte normally does the hashing outside the archive code.
//however, its possible multiple hash tables point to a single block, so we need to pass null for the third arg (or allocate fsbucket_ts one per hash instead of buckets).
if (MPQ_FindFile(mpq, &loc, name, NULL))
AddFileHash(depth, name, NULL, &mpq->blockdata[loc.index]);
}
}
}
@ -409,7 +421,7 @@ void *MPQ_OpenNew(vfsfile_t *file, const char *desc)
mpq = malloc(sizeof(*mpq));
memset(mpq, 0, sizeof(*mpq));
strlcpy(mpq->desc, desc, sizeof(mpq->desc));
Q_strlcpy(mpq->desc, desc, sizeof(mpq->desc));
mpq->header_0 = header;
mpq->file = file;
mpq->filestart = 0;

View File

@ -3,8 +3,6 @@
#ifdef FTEPLUGIN
#include "quakedef.h"
#undef snprintf
#undef vsnprintf
#endif
#ifdef Q3_VM
@ -117,10 +115,9 @@ extern "C" {
#endif
extern qintptr_t (*plugin_syscall)( qintptr_t arg, ... );
#ifdef _WIN32
void strlcpy(char *d, const char *s, int n);
//int snprintf(char *buffer, size_t maxlen, const char *format, ...);
#endif
void Q_strlcpy(char *d, const char *s, int n);
int Q_snprintf(char *buffer, size_t maxlen, const char *format, ...);
int Q_vsnprintf(char *buffer, size_t maxlen, const char *format, va_list vargs);
#endif
@ -243,11 +240,6 @@ EBUILTIN(void, Net_Close, (qhandle_t socket));
#define NET_CLIENTPORT -1
#define NET_SERVERPORT -2
#if defined(_WIN32) || defined(Q3_VM)
//int vsnprintf(char *buffer, size_t maxlen, const char *format, va_list vargs);
#endif
#ifdef Q3_VM
EBUILTIN(void, memcpy, (void *, void *, int len));
EBUILTIN(void, memmove, (void *, void *, int len));

View File

@ -10,7 +10,7 @@ this is a fairly basic implementation.
don't expect it to do much.
You can probably get a better version from somewhere.
*/
int vsnprintf(char *buffer, size_t maxlen, const char *format, va_list vargs)
int Q_vsnprintf(char *buffer, size_t maxlen, const char *format, va_list vargs)
{
int tokens=0;
char *string;
@ -310,7 +310,7 @@ Con_Printf("%i bytes left\n", maxlen);
{*buffer++='\0';return tokens;}
}
int snprintf(char *buffer, size_t maxlen, const char *format, ...)
int Q_snprintf(char *buffer, size_t maxlen, const char *format, ...)
{
int p;
va_list argptr;
@ -323,6 +323,7 @@ int snprintf(char *buffer, size_t maxlen, const char *format, ...)
}
#ifdef Q3_VM
//libc functions that are actually properly supported on all other platforms (c89)
int strlen(const char *s)
{
int len = 0;
@ -543,13 +544,9 @@ int rand(void)
{
return(((randx = randx*1103515245 + 12345)>>16) & 077777);
}
#endif
#if 0//defined(__MINGW32_VERSION) || defined(__MINGW__) || defined(__MINGW32__) || defined(__CYGWIN__)
#else
void strlcpy(char *d, const char *s, int n)
void Q_strlcpy(char *d, const char *s, int n)
{
int i;
n--;
@ -564,4 +561,4 @@ void strlcpy(char *d, const char *s, int n)
}
*d='\0';
}
#endif