mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 14:42:13 +00:00
try to fix shader vertex lighting issue.
fix issue where ftenq protocol positions were sticking. fixed manifest file windowless infinite wait. Added support for ^[\img\foo^] images on the console if they are at the start of the line. Console objects may now be drawn by csqc. Key input is blocked for now, lest csqc get access to things its not allowed to access. Will add provisions later. fixed sound menu crash. added ultrawide speex codec. clamp micamp levels to try to boost audio quality/audiability. rtp control plugins are now allowed to use opus, speex support is correctly queried instead of assumed. WriteFloat now works properly, and not just for ents. no longer sending prespawn/precaches/signon commands to clients that do not expect them. fix sql column header queries. more verbose about active nq protocol verions. -condebug overrides config. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4461 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
803c8c4878
commit
e0aab1c134
63 changed files with 1290 additions and 760 deletions
|
@ -744,6 +744,8 @@ void CLFTE_ParseEntities(void)
|
|||
cl.last_servermessage = realtime;
|
||||
if (cls.fteprotocolextensions2 & PEXT2_PREDINFO)
|
||||
inputframe = MSG_ReadLong();
|
||||
else
|
||||
inputframe = cl.movesequence;
|
||||
|
||||
if (cl.numackframes == sizeof(cl.ackframes)/sizeof(cl.ackframes[0]))
|
||||
cl.numackframes--;
|
||||
|
@ -2269,15 +2271,15 @@ void CLQ1_AddVisibleBBoxes(void)
|
|||
packet_entities_t *pak;
|
||||
entity_state_t *state;
|
||||
model_t *mod;
|
||||
s = R_RegisterShader("bboxshader",
|
||||
s = R_RegisterShader("bboxshader", SUF_NONE,
|
||||
"{\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
"map $whiteimage\n"
|
||||
"blendfunc add\n"
|
||||
"rgbgen vertex\n"
|
||||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
"map $whiteimage\n"
|
||||
"blendfunc add\n"
|
||||
"rgbgen vertex\n"
|
||||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
frame = &cl.inframes[cl.parsecount & UPDATE_MASK];
|
||||
pak = &frame->packet_entities;
|
||||
|
@ -2323,15 +2325,15 @@ void CLQ1_AddVisibleBBoxes(void)
|
|||
if (!w->progs)
|
||||
return;
|
||||
|
||||
s = R_RegisterShader("bboxshader",
|
||||
s = R_RegisterShader("bboxshader", SUF_NONE,
|
||||
"{\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
"map $whiteimage\n"
|
||||
"blendfunc add\n"
|
||||
"rgbgen vertex\n"
|
||||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
"map $whiteimage\n"
|
||||
"blendfunc add\n"
|
||||
"rgbgen vertex\n"
|
||||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
for (i = 1; i < w->num_edicts; i++)
|
||||
{
|
||||
|
@ -2475,15 +2477,15 @@ void CLQ1_AddShadow(entity_t *ent)
|
|||
if (!r_shadows.value || !ent->model || ent->model->type != mod_alias)
|
||||
return;
|
||||
|
||||
s = R_RegisterShader("shadowshader",
|
||||
s = R_RegisterShader("shadowshader", SUF_NONE,
|
||||
"{\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
"blendfunc blend\n"
|
||||
"rgbgen vertex\n"
|
||||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
"blendfunc blend\n"
|
||||
"rgbgen vertex\n"
|
||||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
TEXASSIGN(s->defaulttextures.base, balltexture);
|
||||
|
||||
|
@ -2586,7 +2588,7 @@ void CLQ1_AddPowerupShell(entity_t *ent, qboolean viewweap, unsigned int effects
|
|||
/*view weapons are much closer to the screen, the scales don't work too well, so use a different shader with a smaller expansion*/
|
||||
if (viewweap)
|
||||
{
|
||||
shell->forcedshader = R_RegisterShader("powerups/shellweapon",
|
||||
shell->forcedshader = R_RegisterShader("powerups/shellweapon", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultpowerupshell\n"
|
||||
"sort additive\n"
|
||||
|
@ -2604,7 +2606,7 @@ void CLQ1_AddPowerupShell(entity_t *ent, qboolean viewweap, unsigned int effects
|
|||
}
|
||||
else
|
||||
{
|
||||
shell->forcedshader = R_RegisterShader("powerups/shell",
|
||||
shell->forcedshader = R_RegisterShader("powerups/shell", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultpowerupshell\n"
|
||||
"sort additive\n"
|
||||
|
@ -2893,7 +2895,7 @@ static qboolean CL_ChooseInterpolationFrames(int *newf, int *oldf, float servert
|
|||
//we should be picking the packet just after the server time, and the one just before
|
||||
for (i = cls.netchan.incoming_sequence; i >= cls.netchan.incoming_sequence-UPDATE_MASK; i--)
|
||||
{
|
||||
if (cl.inframes[i&UPDATE_MASK].receivedtime < 0 || cl.inframes[i&UPDATE_MASK].latency < 0 || cl.inframes[i&UPDATE_MASK].invalid)
|
||||
if (cl.inframes[i&UPDATE_MASK].receivedtime < 0 || /*cl.inframes[i&UPDATE_MASK].latency < 0 ||*/ cl.inframes[i&UPDATE_MASK].invalid)
|
||||
continue; //packetloss/choke, it's really only a problem for the oldframe, but...
|
||||
|
||||
if (cl.inframes[i&UPDATE_MASK].packet_entities.servertime >= servertime)
|
||||
|
@ -4510,7 +4512,7 @@ void CL_LinkViewModel(void)
|
|||
|
||||
if (alpha < 1 && qrenderer == QR_OPENGL)
|
||||
{
|
||||
ent.forcedshader = R_RegisterShader("viewmodeldepthmask",
|
||||
ent.forcedshader = R_RegisterShader("viewmodeldepthmask", SUF_NONE,
|
||||
"{\n"
|
||||
"noshadows\n"
|
||||
"surfaceparm nodlight\n"
|
||||
|
|
|
@ -3574,15 +3574,18 @@ void Host_RunFileNotify(struct dl_download *dl)
|
|||
}
|
||||
|
||||
#include "fs.h"
|
||||
#define HRF_OVERWRITE 1
|
||||
#define HRF_NOOVERWRITE 2
|
||||
#define HRF_ABORT 4
|
||||
|
||||
#define HRF_OPENED 8
|
||||
#define HRF_OVERWRITE (1<<0)
|
||||
#define HRF_NOOVERWRITE (1<<1)
|
||||
#define HRF_ABORT (1<<3)
|
||||
#define HRF_OPENED (1<<4)
|
||||
#define HRF_DEMO (1<<8)
|
||||
#define HRF_QTVINFO (1<<9)
|
||||
#define HRF_MANIFEST (1<<10)
|
||||
#define HRF_BSP (1<<11)
|
||||
#define HRF_PACKAGE (1<<12)
|
||||
|
||||
#define HRF_ACTION (HRF_OVERWRITE|HRF_NOOVERWRITE|HRF_ABORT)
|
||||
typedef struct {
|
||||
char ext[4]; //FIXME: override by mime types
|
||||
unsigned int flags;
|
||||
vfsfile_t *srcfile;
|
||||
vfsfile_t *dstfile;
|
||||
|
@ -3594,6 +3597,7 @@ void Host_DoRunFile(hrf_t *f);
|
|||
|
||||
void Host_RunFileDownloaded(struct dl_download *dl)
|
||||
{
|
||||
//fixme: sort out flags from mime type....
|
||||
hrf_t *f = dl->user_ctx;
|
||||
f->srcfile = dl->file;
|
||||
dl->file = NULL;
|
||||
|
@ -3629,6 +3633,9 @@ void Host_DoRunFile(hrf_t *f)
|
|||
|
||||
if (f->flags & HRF_ABORT)
|
||||
{
|
||||
if (f->flags & HRF_MANIFEST)
|
||||
waitingformanifest--;
|
||||
|
||||
if (f->srcfile)
|
||||
VFS_CLOSE(f->srcfile);
|
||||
if (f->dstfile)
|
||||
|
@ -3637,7 +3644,7 @@ void Host_DoRunFile(hrf_t *f)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(f->ext, "qwd") || !strcmp(f->ext, "dem") || !strcmp(f->ext, "mvd"))
|
||||
if (f->flags & HRF_DEMO)
|
||||
{
|
||||
//play directly via system path, no prompts needed
|
||||
Cbuf_AddText(va("playdemo \"#%s\"\n", f->fname), RESTRICT_LOCAL);
|
||||
|
@ -3646,7 +3653,7 @@ void Host_DoRunFile(hrf_t *f)
|
|||
Host_DoRunFile(f);
|
||||
return;
|
||||
}
|
||||
else if (!strcmp(f->ext, "qtv"))
|
||||
else if (f->flags & HRF_QTVINFO)
|
||||
{
|
||||
//play directly via url/system path, no prompts needed
|
||||
Cbuf_AddText(va("qtvplay \"#%s\"\n", f->fname), RESTRICT_LOCAL);
|
||||
|
@ -3655,7 +3662,7 @@ void Host_DoRunFile(hrf_t *f)
|
|||
Host_DoRunFile(f);
|
||||
return;
|
||||
}
|
||||
else if (!strcmp(f->ext, "bsp"))
|
||||
else if (f->flags & HRF_BSP)
|
||||
{
|
||||
char shortname[MAX_QPATH];
|
||||
COM_StripExtension(COM_SkipPath(f->fname), shortname, sizeof(shortname));
|
||||
|
@ -3663,7 +3670,7 @@ void Host_DoRunFile(hrf_t *f)
|
|||
snprintf(loadcommand, sizeof(loadcommand), "map \"%s\"\n", shortname);
|
||||
snprintf(displayname, sizeof(displayname), "map: %s", shortname);
|
||||
}
|
||||
else if (!strcmp(f->ext, "pak") || !strcmp(f->ext, "pk3"))
|
||||
else if (f->flags & HRF_PACKAGE)
|
||||
{
|
||||
char *shortname;
|
||||
shortname = COM_SkipPath(f->fname);
|
||||
|
@ -3671,11 +3678,10 @@ void Host_DoRunFile(hrf_t *f)
|
|||
snprintf(loadcommand, sizeof(loadcommand), "fs_restart\n");
|
||||
snprintf(displayname, sizeof(displayname), "package: %s", shortname);
|
||||
}
|
||||
else if (!strcmp(f->ext, "fmf"))
|
||||
else if (f->flags & HRF_MANIFEST)
|
||||
{
|
||||
if (f->flags & HRF_OPENED)
|
||||
{
|
||||
waitingformanifest--;
|
||||
if (f->srcfile)
|
||||
{
|
||||
ftemanifest_t *man;
|
||||
|
@ -3802,7 +3808,21 @@ qboolean Host_RunFile(const char *fname, int nlen, vfsfile_t *file)
|
|||
hrf_t *f = Z_Malloc(sizeof(*f) + nlen);
|
||||
memcpy(f->fname, fname, nlen);
|
||||
f->fname[nlen] = 0;
|
||||
Q_strncpyz(f->ext, ext, sizeof(f->ext));
|
||||
|
||||
if (!strcmp(ext, "qwd") || !strcmp(ext, "dem") || !strcmp(ext, "mvd"))
|
||||
f->flags |= HRF_DEMO;
|
||||
if (!strcmp(ext, "qtv"))
|
||||
f->flags |= HRF_QTVINFO;
|
||||
if (!strcmp(ext, "fmf"))
|
||||
f->flags |= HRF_MANIFEST;
|
||||
if (!strcmp(ext, "bsp"))
|
||||
f->flags |= HRF_BSP;
|
||||
if (!strcmp(ext, "pak") || !strcmp(ext, "pk3"))
|
||||
f->flags |= HRF_PACKAGE;
|
||||
|
||||
if (f->flags & HRF_MANIFEST)
|
||||
waitingformanifest++;
|
||||
|
||||
Host_DoRunFile(f);
|
||||
return true;
|
||||
}
|
||||
|
@ -4234,6 +4254,9 @@ void CL_ArgumentOverrides(void)
|
|||
|
||||
if (COM_CheckParm ("-current"))
|
||||
Cvar_Set(Cvar_FindVar("vid_desktopsettings"), "1");
|
||||
|
||||
if (COM_CheckParm("-condebug"))
|
||||
Cvar_Set(Cvar_FindVar("log_enable"), "1");
|
||||
}
|
||||
|
||||
//note that this does NOT include commandline.
|
||||
|
@ -4453,9 +4476,9 @@ void Host_Shutdown(void)
|
|||
// Host_WriteConfiguration ();
|
||||
|
||||
CDAudio_Shutdown ();
|
||||
S_Shutdown();
|
||||
IN_Shutdown ();
|
||||
R_ShutdownRenderer();
|
||||
S_Shutdown(true);
|
||||
#ifdef CL_MASTER
|
||||
MasterInfo_Shutdown();
|
||||
#endif
|
||||
|
|
|
@ -6399,6 +6399,18 @@ void CLNQ_ParseServerMessage (void)
|
|||
CL_ParseBaseline2 ();
|
||||
break;
|
||||
|
||||
case svcfte_cgamepacket:
|
||||
#ifdef HLCLIENT
|
||||
if (CLHL_ParseGamePacket())
|
||||
break;
|
||||
#endif
|
||||
#ifdef CSQC_DAT
|
||||
if (CSQC_ParseGamePacket())
|
||||
break;
|
||||
#endif
|
||||
Con_Printf("Unable to parse gamecode packet\n");
|
||||
break;
|
||||
|
||||
case svc_time:
|
||||
//fixme: move this stuff to a common place
|
||||
// cl.playerview[destsplit].oldfixangle = cl.playerview[destsplit].fixangle;
|
||||
|
|
|
@ -1498,7 +1498,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
ent.shaderRGBAf[0] = (!!(renderfx & Q2RF_SHELL_RED));
|
||||
ent.shaderRGBAf[1] = (!!(renderfx & Q2RF_SHELL_GREEN));
|
||||
ent.shaderRGBAf[2] = (!!(renderfx & Q2RF_SHELL_BLUE));
|
||||
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell, NULL);
|
||||
ent.forcedshader = R_RegisterCustom("q2/shell", SUF_NONE, Shader_DefaultSkinShell, NULL);
|
||||
V_AddEntity (&ent);
|
||||
}
|
||||
ent.forcedshader = NULL;
|
||||
|
|
|
@ -25,12 +25,11 @@ console_t con_main;
|
|||
console_t *con_current; // points to whatever is the visible console
|
||||
console_t *con_mouseover; // points to whichever console's title is currently mouseovered, or null
|
||||
console_t *con_chat; // points to a chat console
|
||||
conline_t *con_footerline; //temp text at the bottom of the console
|
||||
|
||||
#define Font_ScreenWidth() (vid.pixelwidth)
|
||||
|
||||
static int Con_DrawProgress(int left, int right, int y);
|
||||
static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qboolean selactive, int selsx, int selex, int selsy, int seley);
|
||||
static int Con_DrawConsoleLines(console_t *con, conline_t *l, int sx, int ex, int y, int top, qboolean selactive, int selsx, int selex, int selsy, int seley);
|
||||
|
||||
#ifdef QTERM
|
||||
#include <windows.h>
|
||||
|
@ -69,9 +68,6 @@ cvar_t con_separatechat = CVAR("con_separatechat", "0");
|
|||
|
||||
#define NUM_CON_TIMES 24
|
||||
|
||||
static conline_t *selstartline, *selendline;
|
||||
static unsigned int selstartoffset, selendoffset;
|
||||
|
||||
qboolean con_initialized;
|
||||
|
||||
/*makes sure the console object works*/
|
||||
|
@ -84,6 +80,9 @@ void Con_Finit (console_t *con)
|
|||
}
|
||||
if (con->display == NULL)
|
||||
con->display = con->current;
|
||||
|
||||
con->selstartline = NULL;
|
||||
con->selendline = NULL;
|
||||
}
|
||||
|
||||
/*returns a bitmask:
|
||||
|
@ -107,8 +106,10 @@ void Con_Destroy (console_t *con)
|
|||
Z_Free(t);
|
||||
}
|
||||
con->display = con->current = con->oldest = NULL;
|
||||
selstartline = NULL;
|
||||
selendline = NULL;
|
||||
|
||||
if (con->footerline)
|
||||
Z_Free(con->footerline);
|
||||
con->footerline = NULL;
|
||||
|
||||
if (con == &con_main)
|
||||
{
|
||||
|
@ -153,10 +154,9 @@ console_t *Con_Create(char *name, unsigned int flags)
|
|||
console_t *con;
|
||||
if (!strcmp(name, "current"))
|
||||
return NULL;
|
||||
if (!strcmp(name, "MAIN"))
|
||||
return NULL;
|
||||
con = Z_Malloc(sizeof(console_t));
|
||||
Q_strncpyz(con->name, name, sizeof(con->name));
|
||||
Q_strncpyz(con->title, name, sizeof(con->title));
|
||||
|
||||
con->flags = flags;
|
||||
Con_Finit(con);
|
||||
|
@ -170,12 +170,12 @@ void Con_SetActive (console_t *con)
|
|||
{
|
||||
con_current = con;
|
||||
|
||||
if (con_footerline)
|
||||
if (con->footerline)
|
||||
{
|
||||
selstartline = NULL;
|
||||
selendline = NULL;
|
||||
Z_Free(con_footerline);
|
||||
con_footerline = NULL;
|
||||
con->selstartline = NULL;
|
||||
con->selendline = NULL;
|
||||
Z_Free(con->footerline);
|
||||
con->footerline = NULL;
|
||||
}
|
||||
}
|
||||
/*for enumerating consoles*/
|
||||
|
@ -432,7 +432,7 @@ void Con_History_Save(void)
|
|||
Con_ToggleConsole_f
|
||||
================
|
||||
*/
|
||||
void Con_ToggleConsole_f (void)
|
||||
void Con_ToggleConsole_Force(void)
|
||||
{
|
||||
SCR_EndLoadingPlaque();
|
||||
Key_ClearTyping ();
|
||||
|
@ -447,6 +447,18 @@ void Con_ToggleConsole_f (void)
|
|||
else
|
||||
key_dest = key_console;
|
||||
}
|
||||
void Con_ToggleConsole_f (void)
|
||||
{
|
||||
#ifdef CSQC_DAT
|
||||
if (key_dest == key_game && CSQC_ConsoleCommand("toggleconsole"))
|
||||
{
|
||||
key_dest = key_game;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Con_ToggleConsole_Force();
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
|
@ -476,8 +488,8 @@ void Con_ClearCon(console_t *con)
|
|||
Z_Free(t);
|
||||
}
|
||||
con->display = con->current = con->oldest = NULL;
|
||||
selstartline = NULL;
|
||||
selendline = NULL;
|
||||
con->selstartline = NULL;
|
||||
con->selendline = NULL;
|
||||
|
||||
/*reset the line pointers, create an active line*/
|
||||
Con_Finit(con);
|
||||
|
@ -573,6 +585,7 @@ void Con_Init (void)
|
|||
|
||||
con_main.linebuffered = Con_ExecuteLine;
|
||||
con_main.commandcompletion = true;
|
||||
Q_strncpyz(con_main.title, "MAIN", sizeof(con_main.title));
|
||||
|
||||
con_initialized = true;
|
||||
Con_Printf ("Console initialized.\n");
|
||||
|
@ -624,12 +637,6 @@ void Con_Shutdown(void)
|
|||
}
|
||||
con_initialized = false;
|
||||
Con_Destroy(&con_main);
|
||||
|
||||
selstartline = NULL;
|
||||
selendline = NULL;
|
||||
if (con_footerline)
|
||||
Z_Free(con_footerline);
|
||||
con_footerline = NULL;
|
||||
}
|
||||
|
||||
void TTS_SayConString(conchar_t *stringtosay);
|
||||
|
@ -671,10 +678,10 @@ void Con_PrintCon (console_t *con, char *txt)
|
|||
if (con->oldest == con->current)
|
||||
break;
|
||||
|
||||
if (selstartline == con->oldest)
|
||||
selstartline = NULL;
|
||||
if (selendline == con->oldest)
|
||||
selendline = NULL;
|
||||
if (con->selstartline == con->oldest)
|
||||
con->selstartline = NULL;
|
||||
if (con->selendline == con->oldest)
|
||||
con->selendline = NULL;
|
||||
|
||||
if (con->display == con->oldest)
|
||||
con->display = con->oldest->newer;
|
||||
|
@ -710,10 +717,10 @@ void Con_PrintCon (console_t *con, char *txt)
|
|||
con->cr = false;
|
||||
}
|
||||
|
||||
if (selstartline == con->current)
|
||||
selstartline = NULL;
|
||||
if (selendline == con->current)
|
||||
selendline = NULL;
|
||||
if (con->selstartline == con->current)
|
||||
con->selstartline = NULL;
|
||||
if (con->selendline == con->current)
|
||||
con->selendline = NULL;
|
||||
|
||||
oc = con->current;
|
||||
con->current = BZ_Realloc(con->current, sizeof(*con->current)+(con->current->length+2)*sizeof(conchar_t));
|
||||
|
@ -886,6 +893,7 @@ void VARGS Con_DPrintf (const char *fmt, ...)
|
|||
/*description text at the bottom of the console*/
|
||||
void Con_Footerf(qboolean append, char *fmt, ...)
|
||||
{
|
||||
console_t *con = con_current;
|
||||
va_list argptr;
|
||||
char msg[MAXPRINTMSG];
|
||||
conchar_t marked[MAXPRINTMSG], *markedend;
|
||||
|
@ -899,7 +907,7 @@ void Con_Footerf(qboolean append, char *fmt, ...)
|
|||
|
||||
newlen = markedend - marked;
|
||||
if (append)
|
||||
oldlen = con_footerline->length;
|
||||
oldlen = con->footerline->length;
|
||||
else
|
||||
oldlen = 0;
|
||||
|
||||
|
@ -908,20 +916,20 @@ void Con_Footerf(qboolean append, char *fmt, ...)
|
|||
else
|
||||
{
|
||||
newf = Z_Malloc(sizeof(*newf) + (oldlen + newlen) * sizeof(conchar_t));
|
||||
if (con_footerline)
|
||||
memcpy(newf, con_footerline, sizeof(*con_footerline)+oldlen*sizeof(conchar_t));
|
||||
if (con->footerline)
|
||||
memcpy(newf, con->footerline, sizeof(*con->footerline)+oldlen*sizeof(conchar_t));
|
||||
markedend = (void*)(newf+1);
|
||||
markedend += oldlen;
|
||||
memcpy(markedend, marked, newlen*sizeof(conchar_t));
|
||||
newf->length = oldlen + newlen;
|
||||
}
|
||||
|
||||
if (selstartline == con_footerline)
|
||||
selstartline = NULL;
|
||||
if (selendline == con_footerline)
|
||||
selendline = NULL;
|
||||
Z_Free(con_footerline);
|
||||
con_footerline = newf;
|
||||
if (con->selstartline == con->footerline)
|
||||
con->selstartline = NULL;
|
||||
if (con->selendline == con->footerline)
|
||||
con->selendline = NULL;
|
||||
Z_Free(con->footerline);
|
||||
con->footerline = newf;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -942,7 +950,7 @@ y is the bottom of the input
|
|||
return value is the top of the region
|
||||
================
|
||||
*/
|
||||
int Con_DrawInput (int left, int right, int y, qboolean selactive, int selsx, int selex, int selsy, int seley)
|
||||
int Con_DrawInput (console_t *con, qboolean focused, int left, int right, int y, qboolean selactive, int selsx, int selex, int selsy, int seley)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
extern qboolean ActiveApp;
|
||||
|
@ -960,14 +968,14 @@ int Con_DrawInput (int left, int right, int y, qboolean selactive, int selsx, in
|
|||
|
||||
int x;
|
||||
|
||||
if (!con->linebuffered)
|
||||
return y; //fixme: draw any unfinished lines of the current console instead.
|
||||
|
||||
y -= Font_CharHeight();
|
||||
|
||||
if (key_dest != key_console)// && con_current->vislines != vid.height)
|
||||
if (!focused)
|
||||
return y; // don't draw anything (always draw if not active)
|
||||
|
||||
if (!con_current->linebuffered)
|
||||
return y; //fixme: draw any unfinished lines of the current console instead.
|
||||
|
||||
text = key_lines[edit_line];
|
||||
|
||||
//copy it to an alternate buffer and fill in text colouration escape codes.
|
||||
|
@ -989,7 +997,7 @@ int Con_DrawInput (int left, int right, int y, qboolean selactive, int selsx, in
|
|||
i = 0;
|
||||
x = left;
|
||||
|
||||
if (con_current->commandcompletion)
|
||||
if (con->commandcompletion)
|
||||
{
|
||||
if (cl_chatmode.ival && (text[1] == '/' || (cl_chatmode.ival == 2 && Cmd_IsCommand(text+1))))
|
||||
{ //color the first token yellow, it's a valid command
|
||||
|
@ -1066,9 +1074,9 @@ int Con_DrawInput (int left, int right, int y, qboolean selactive, int selsx, in
|
|||
}
|
||||
|
||||
/*if its getting completed to something, show some help about the command that is going to be used*/
|
||||
if (con_footerline)
|
||||
if (con->footerline)
|
||||
{
|
||||
y = Con_DrawConsoleLines(con_footerline, left, right, y, 0, selactive, selsx, selex, selsy, seley);
|
||||
y = Con_DrawConsoleLines(con, con->footerline, left, right, y, 0, selactive, selsx, selex, selsy, seley);
|
||||
}
|
||||
|
||||
/*just above that, we have the tab completion list*/
|
||||
|
@ -1205,7 +1213,7 @@ void Con_DrawNotify (void)
|
|||
{
|
||||
console_t *con;
|
||||
|
||||
con_main.flags = CONF_NOTIFY;
|
||||
con_main.flags |= CONF_NOTIFY;
|
||||
/*keep the main console up to date*/
|
||||
con_main.notif_l = con_numnotifylines.ival;
|
||||
con_main.notif_w = vid.width;
|
||||
|
@ -1446,10 +1454,7 @@ int Con_DrawAlternateConsoles(int lines)
|
|||
{
|
||||
if (con->flags & CONF_HIDDEN)
|
||||
continue;
|
||||
if (con == &con_main)
|
||||
txt = "MAIN";
|
||||
else
|
||||
txt = con->name;
|
||||
txt = con->title;
|
||||
|
||||
//yeah, om is an evil 1-frame delay. whatever
|
||||
end = COM_ParseFunString(CON_WHITEMASK, va("^&%c%i%s", ((con!=om)?'F':'B'), (con==con_current)+con->unseentext*4, txt), buffer, sizeof(buffer), false);
|
||||
|
@ -1481,10 +1486,10 @@ int Con_DrawAlternateConsoles(int lines)
|
|||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
#include "shader.h"
|
||||
//draws the conline_t list bottom-up within the width of the screen until the top of the screen is reached.
|
||||
//if text is selected, the selstartline globals will be updated, so make sure the lines persist or check them.
|
||||
static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qboolean selactive, int selsx, int selex, int selsy, int seley)
|
||||
static int Con_DrawConsoleLines(console_t *con, conline_t *l, int sx, int ex, int y, int top, qboolean selactive, int selsx, int selex, int selsy, int seley)
|
||||
{
|
||||
int linecount;
|
||||
int linelength;
|
||||
|
@ -1550,20 +1555,81 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
|
|||
seley += y;
|
||||
}
|
||||
|
||||
if (l && l == con_current->current && l->length == 0)
|
||||
if (l && l == con->current && l->length == 0)
|
||||
l = l->older;
|
||||
for (; l; l = l->older)
|
||||
{
|
||||
shader_t *pic = NULL;
|
||||
int picw=0, pich=0;
|
||||
s = (conchar_t*)(l+1);
|
||||
|
||||
linecount = Font_LineBreaks(s, s+l->length, ex-sx, sizeof(starts)/sizeof(starts[0]), starts, ends);
|
||||
if (l->length >= 2 && *s == CON_LINKSTART && (s[1]&CON_CHARMASK) == '\\')
|
||||
{ //leading tag with no text, look for an image in there
|
||||
conchar_t *e;
|
||||
char linkinfo[256];
|
||||
int linkinfolen = 0;
|
||||
for (e = s+1; e < s+l->length; e++)
|
||||
{
|
||||
if (*e == CON_LINKEND)
|
||||
{
|
||||
char *imgname;
|
||||
linkinfo[linkinfolen] = 0;
|
||||
imgname = Info_ValueForKey(linkinfo, "img");
|
||||
if (*imgname)
|
||||
{
|
||||
pic = R_RegisterPic(imgname);
|
||||
if (pic)
|
||||
{
|
||||
imgname = Info_ValueForKey(linkinfo, "w");
|
||||
if (*imgname)
|
||||
picw = atoi(imgname);
|
||||
else if (pic->width)
|
||||
picw = (pic->width * vid.pixelwidth) / vid.width;
|
||||
else
|
||||
picw = 64;
|
||||
imgname = Info_ValueForKey(linkinfo, "h");
|
||||
if (*imgname)
|
||||
pich = atoi(imgname);
|
||||
else if (pic->height)
|
||||
pich = (pic->height * vid.pixelheight) / vid.height;
|
||||
else
|
||||
pich = 64;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
linkinfolen += unicode_encode(linkinfo+linkinfolen, (*e & CON_CHARMASK), sizeof(linkinfo)-1-linkinfolen);
|
||||
}
|
||||
}
|
||||
|
||||
linecount = Font_LineBreaks(s, s+l->length, ex-sx-picw, sizeof(starts)/sizeof(starts[0]), starts, ends);
|
||||
//if Con_LineBreaks didn't find any lines at all, then it was an empty line, and we need to ensure that its still drawn
|
||||
if (linecount == 0)
|
||||
{
|
||||
linecount = 1;
|
||||
starts[0] = ends[0] = NULL;
|
||||
}
|
||||
|
||||
if (pic)
|
||||
{
|
||||
float szx = (float)vid.width / vid.pixelwidth;
|
||||
float szy = (float)vid.height / vid.pixelheight;
|
||||
int texth = (linecount) * Font_CharHeight();
|
||||
R2D_ImageColours(1.0, 1.0, 1.0, 1.0);
|
||||
if (texth > pich)
|
||||
{
|
||||
texth = pich + (texth-pich)/2;
|
||||
R2D_Image(sx*szx, (y-texth)*szy, picw*szx, pich*szy, 0, 0, 1, 1, pic);
|
||||
pich = 0; //don't pad the text...
|
||||
}
|
||||
else
|
||||
{
|
||||
R2D_Image(sx*szx, (y-pich)*szy, picw*szx, pich*szy, 0, 0, 1, 1, pic);
|
||||
pich -= texth;
|
||||
y-= pich/2; //skip some space above and below the text block, to keep the text and image aligned.
|
||||
}
|
||||
}
|
||||
|
||||
l->lines = linecount;
|
||||
|
||||
while(linecount-- > 0)
|
||||
|
@ -1584,7 +1650,7 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
|
|||
{
|
||||
int sstart;
|
||||
int send;
|
||||
sstart = sx;
|
||||
sstart = sx+picw;
|
||||
send = sstart;
|
||||
for (i = 0; i < linelength; i++)
|
||||
send += Font_CharWidth(s[i]);
|
||||
|
@ -1604,11 +1670,11 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
|
|||
break;
|
||||
}
|
||||
|
||||
selendline = l;
|
||||
con->selendline = l;
|
||||
if (s)
|
||||
selendoffset = (s+i+1) - (conchar_t*)(l+1);
|
||||
con->selendoffset = (s+i+1) - (conchar_t*)(l+1);
|
||||
else
|
||||
selendoffset = 0;
|
||||
con->selendoffset = 0;
|
||||
}
|
||||
if (y <= selsy)
|
||||
{
|
||||
|
@ -1620,11 +1686,11 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
|
|||
sstart += x;
|
||||
}
|
||||
|
||||
selstartline = l;
|
||||
con->selstartline = l;
|
||||
if (s)
|
||||
selstartoffset = (s+i) - (conchar_t*)(l+1);
|
||||
con->selstartoffset = (s+i) - (conchar_t*)(l+1);
|
||||
else
|
||||
selstartoffset = 0;
|
||||
con->selstartoffset = 0;
|
||||
}
|
||||
R2D_ImagePaletteColour(0, 1.0);
|
||||
R2D_FillBlock((sstart*vid.width)/vid.rotpixelwidth, (y*vid.height)/vid.rotpixelheight, ((send - sstart)*vid.width)/vid.rotpixelwidth, (Font_CharHeight()*vid.height)/vid.rotpixelheight);
|
||||
|
@ -1633,12 +1699,13 @@ static int Con_DrawConsoleLines(conline_t *l, int sx, int ex, int y, int top, qb
|
|||
}
|
||||
R2D_ImageColours(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
x = sx;
|
||||
x = sx + picw;
|
||||
Font_LineDraw(x, y, s, s+linelength);
|
||||
|
||||
if (y < top)
|
||||
break;
|
||||
}
|
||||
y -= pich/2;
|
||||
if (y < top)
|
||||
break;
|
||||
}
|
||||
|
@ -1679,12 +1746,17 @@ void Con_DrawConsole (int lines, qboolean noback)
|
|||
|
||||
top = Con_DrawAlternateConsoles(lines);
|
||||
|
||||
if (!con_current->display)
|
||||
con_current->display = con_current->current;
|
||||
|
||||
x = 8;
|
||||
y = lines;
|
||||
|
||||
selstartline = NULL;
|
||||
selendline = NULL;
|
||||
selactive = Key_GetConsoleSelectionBox(&selsx, &selsy, &selex, &seley);
|
||||
con_current->mousecursor[0] = mousecursor_x;
|
||||
con_current->mousecursor[1] = mousecursor_y;
|
||||
con_current->selstartline = NULL;
|
||||
con_current->selendline = NULL;
|
||||
selactive = Key_GetConsoleSelectionBox(con_current, &selsx, &selsy, &selex, &seley);
|
||||
|
||||
Font_BeginString(font_conchar, x, y, &x, &y);
|
||||
Font_BeginString(font_conchar, selsx, selsy, &selsx, &selsy);
|
||||
|
@ -1695,10 +1767,8 @@ void Con_DrawConsole (int lines, qboolean noback)
|
|||
|
||||
y -= Font_CharHeight();
|
||||
haveprogress = Con_DrawProgress(x, ex - x, y) != y;
|
||||
y = Con_DrawInput (x, ex - x, y, selactive, selsx, selex, selsy, seley);
|
||||
y = Con_DrawInput (con_current, key_dest == key_console, x, ex - x, y, selactive, selsx, selex, selsy, seley);
|
||||
|
||||
if (!con_current->display)
|
||||
con_current->display = con_current->current;
|
||||
l = con_current->display;
|
||||
|
||||
if (l != con_current->current)
|
||||
|
@ -1709,7 +1779,7 @@ void Con_DrawConsole (int lines, qboolean noback)
|
|||
x = (Font_DrawChar (x, y, '^'|CON_WHITEMASK)-x)*4+x;
|
||||
}
|
||||
|
||||
y = Con_DrawConsoleLines(l, sx, ex, y, top, selactive, selsx, selex, selsy, seley);
|
||||
y = Con_DrawConsoleLines(con_current, l, sx, ex, y, top, selactive, selsx, selex, selsy, seley);
|
||||
|
||||
if (!haveprogress && lines == vid.height)
|
||||
{
|
||||
|
@ -1726,10 +1796,45 @@ void Con_DrawConsole (int lines, qboolean noback)
|
|||
Font_EndString(font_conchar);
|
||||
}
|
||||
|
||||
void Con_DrawOneConsole(console_t *con, struct font_s *font, float fx, float fy, float fsx, float fsy)
|
||||
{
|
||||
int selactive, selsx, selsy, selex, seley;
|
||||
int x, y, sx, sy;
|
||||
Font_BeginString(font, fx, fy, &x, &y);
|
||||
Font_BeginString(font, fx+fsx, fy+fsy, &sx, &sy);
|
||||
|
||||
if (con == con_current && key_dest == key_console)
|
||||
{
|
||||
selactive = false; //don't change selections if this is the main console and we're looking at the console, because that main console has focus instead anyway.
|
||||
selsx = selsy = selex = seley = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
con->selstartline = NULL;
|
||||
con->selendline = NULL;
|
||||
selactive = Key_GetConsoleSelectionBox(con, &selsx, &selsy, &selex, &seley);
|
||||
|
||||
Font_BeginString(font, selsx, selsy, &selsx, &selsy);
|
||||
Font_BeginString(font, selex, seley, &selex, &seley);
|
||||
selsx += x;
|
||||
selsy += y;
|
||||
selex += x;
|
||||
seley += y;
|
||||
}
|
||||
|
||||
sy = Con_DrawInput (con, con->flags & CONF_KEYFOCUSED, x, sx, sy, selactive, selsx, selex, selsy, seley);
|
||||
|
||||
if (!con->display)
|
||||
con->display = con->current;
|
||||
Con_DrawConsoleLines(con, con->display, x, sx, sy, y, selactive, selsx, selex, selsy, seley);
|
||||
|
||||
Font_EndString(font);
|
||||
}
|
||||
|
||||
|
||||
char *Con_CopyConsole(qboolean nomarkup)
|
||||
{
|
||||
console_t *con = con_current;
|
||||
conchar_t *cur;
|
||||
conline_t *l;
|
||||
conchar_t *lend;
|
||||
|
@ -1737,7 +1842,7 @@ char *Con_CopyConsole(qboolean nomarkup)
|
|||
int outlen, maxlen;
|
||||
int finalendoffset;
|
||||
|
||||
if (!selstartline || !selendline)
|
||||
if (!con->selstartline || !con->selendline)
|
||||
return NULL;
|
||||
|
||||
maxlen = 1024*1024;
|
||||
|
@ -1746,13 +1851,13 @@ char *Con_CopyConsole(qboolean nomarkup)
|
|||
// for (cur = (conchar_t*)(selstartline+1), finalendoffset = 0; cur < (conchar_t*)(selstartline+1) + selstartline->length; cur++, finalendoffset++)
|
||||
// result[finalendoffset] = *cur & 0xffff;
|
||||
|
||||
l = selstartline;
|
||||
cur = (conchar_t*)(l+1) + selstartoffset;
|
||||
finalendoffset = selendoffset;
|
||||
l = con->selstartline;
|
||||
cur = (conchar_t*)(l+1) + con->selstartoffset;
|
||||
finalendoffset = con->selendoffset;
|
||||
|
||||
if (selstartline == selendline)
|
||||
if (con->selstartline == con->selendline)
|
||||
{
|
||||
if (selstartoffset+1 == finalendoffset)
|
||||
if (con->selstartoffset+1 == finalendoffset)
|
||||
{
|
||||
//they only selected a single char?
|
||||
//fix that up to select the entire token
|
||||
|
@ -1767,7 +1872,7 @@ char *Con_CopyConsole(qboolean nomarkup)
|
|||
if (*cur == CON_LINKSTART)
|
||||
break;
|
||||
}
|
||||
while (finalendoffset < selendline->length)
|
||||
while (finalendoffset < con->selendline->length)
|
||||
{
|
||||
if ((((conchar_t*)(l+1))[finalendoffset] & CON_CHARMASK) != ' ')
|
||||
finalendoffset++;
|
||||
|
@ -1793,11 +1898,11 @@ char *Con_CopyConsole(qboolean nomarkup)
|
|||
}
|
||||
}
|
||||
//scan forwards to find the end of the selected link
|
||||
for(lend = (conchar_t*)(selendline+1) + finalendoffset; lend < (conchar_t*)(selendline+1) + selendline->length; lend++)
|
||||
for(lend = (conchar_t*)(con->selendline+1) + finalendoffset; lend < (conchar_t*)(con->selendline+1) + con->selendline->length; lend++)
|
||||
{
|
||||
if (*lend == CON_LINKEND)
|
||||
{
|
||||
finalendoffset = lend+1 - (conchar_t*)(selendline+1);
|
||||
finalendoffset = lend+1 - (conchar_t*)(con->selendline+1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1805,14 +1910,14 @@ char *Con_CopyConsole(qboolean nomarkup)
|
|||
outlen = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (l == selendline)
|
||||
if (l == con->selendline)
|
||||
lend = (conchar_t*)(l+1) + finalendoffset;
|
||||
else
|
||||
lend = (conchar_t*)(l+1) + l->length;
|
||||
|
||||
outlen = COM_DeFunString(cur, lend, result + outlen, maxlen - outlen, nomarkup) - result;
|
||||
|
||||
if (l == selendline)
|
||||
if (l == con->selendline)
|
||||
break;
|
||||
|
||||
l = l->newer;
|
||||
|
|
|
@ -43,8 +43,6 @@ keydest_t key_dest;
|
|||
|
||||
int key_count; // incremented every key event
|
||||
|
||||
int con_mousedown[3];
|
||||
|
||||
char *keybindings[K_MAX][KEY_MODIFIERSTATES];
|
||||
qbyte bindcmdlevel[K_MAX][KEY_MODIFIERSTATES];
|
||||
qboolean consolekeys[K_MAX]; // if true, can't be rebound while in console
|
||||
|
@ -440,35 +438,35 @@ void Con_Selectioncolour_Callback(struct cvar_s *var, char *oldvalue)
|
|||
SCR_StringToRGB(var->string, sccolor, 1);
|
||||
}
|
||||
|
||||
qboolean Key_GetConsoleSelectionBox(int *sx, int *sy, int *ex, int *ey)
|
||||
qboolean Key_GetConsoleSelectionBox(console_t *con, int *sx, int *sy, int *ex, int *ey)
|
||||
{
|
||||
*sx = *sy = *ex = *ey = 0;
|
||||
|
||||
if (con_mousedown[2] == 1)
|
||||
if (con->mousedown[2] == 1)
|
||||
{
|
||||
while (mousecursor_y - con_mousedown[1] > 8 && con_current->display->older)
|
||||
while (con->mousecursor[1] - con->mousedown[1] > 8 && con->display->older)
|
||||
{
|
||||
con_mousedown[1] += 8;
|
||||
con_current->display = con_current->display->older;
|
||||
con->mousedown[1] += 8;
|
||||
con->display = con->display->older;
|
||||
}
|
||||
while (mousecursor_y - con_mousedown[1] < -8 && con_current->display->newer)
|
||||
while (con->mousecursor[1] - con->mousedown[1] < -8 && con->display->newer)
|
||||
{
|
||||
con_mousedown[1] -= 8;
|
||||
con_current->display = con_current->display->newer;
|
||||
con->mousedown[1] -= 8;
|
||||
con->display = con->display->newer;
|
||||
}
|
||||
|
||||
*sx = mousecursor_x;
|
||||
*sy = mousecursor_y;
|
||||
*ex = mousecursor_x;
|
||||
*ey = mousecursor_y;
|
||||
*sx = con->mousecursor[0];
|
||||
*sy = con->mousecursor[1];
|
||||
*ex = con->mousecursor[0];
|
||||
*ey = con->mousecursor[1];
|
||||
return true;
|
||||
}
|
||||
else if (con_mousedown[2] == 2)
|
||||
else if (con->mousedown[2] == 2)
|
||||
{
|
||||
*sx = con_mousedown[0];
|
||||
*sy = con_mousedown[1];
|
||||
*ex = mousecursor_x;
|
||||
*ey = mousecursor_y;
|
||||
*sx = con->mousedown[0];
|
||||
*sy = con->mousedown[1];
|
||||
*ex = con->mousecursor[0];
|
||||
*ey = con->mousecursor[1];
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -726,13 +724,13 @@ void Key_DefaultLinkClicked(char *text, char *info)
|
|||
}
|
||||
}
|
||||
|
||||
void Key_ConsoleRelease(int key, int unicode)
|
||||
void Key_ConsoleRelease(console_t *con, int key, int unicode)
|
||||
{
|
||||
char *buffer;
|
||||
if (key == K_MOUSE1)
|
||||
{
|
||||
con_mousedown[2] = 0;
|
||||
if (abs(con_mousedown[0] - mousecursor_x) < 5 && abs(con_mousedown[1] - mousecursor_y) < 5)
|
||||
con->mousedown[2] = 0;
|
||||
if (abs(con->mousedown[0] - con->mousecursor[0]) < 5 && abs(con->mousedown[1] - con->mousecursor[1]) < 5)
|
||||
{
|
||||
buffer = Con_CopyConsole(false);
|
||||
Con_Footerf(false, "");
|
||||
|
@ -807,9 +805,9 @@ void Key_ConsoleRelease(int key, int unicode)
|
|||
else
|
||||
Con_Footerf(false, "");
|
||||
}
|
||||
if (key == K_MOUSE2 && con_mousedown[2] == 2)
|
||||
if (key == K_MOUSE2 && con->mousedown[2] == 2)
|
||||
{
|
||||
con_mousedown[2] = 0;
|
||||
con->mousedown[2] = 0;
|
||||
buffer = Con_CopyConsole(true); //don't keep markup if we're copying to the clipboard
|
||||
if (!buffer)
|
||||
return;
|
||||
|
@ -921,7 +919,7 @@ Key_Console
|
|||
Interactive line editing and console scrollback
|
||||
====================
|
||||
*/
|
||||
void Key_Console (unsigned int unicode, int key)
|
||||
qboolean Key_Console (console_t *con, unsigned int unicode, int key)
|
||||
{
|
||||
qboolean ctrl = keydown[K_LCTRL] || keydown[K_RCTRL];
|
||||
qboolean shift = keydown[K_LSHIFT] || keydown[K_RSHIFT];
|
||||
|
@ -932,27 +930,27 @@ void Key_Console (unsigned int unicode, int key)
|
|||
if ((unicode >= '0' && unicode <= '9') || unicode == '.')
|
||||
key = 0;
|
||||
|
||||
if (con_current->redirect)
|
||||
if (con->redirect)
|
||||
{
|
||||
if (key == K_TAB)
|
||||
{ // command completion
|
||||
if (ctrl || shift)
|
||||
{
|
||||
Con_CycleConsole();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
con_current->redirect(con_current, key);
|
||||
return;
|
||||
con->redirect(con_current, key);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((key == K_MOUSE1 || key == K_MOUSE2))
|
||||
{
|
||||
int xpos, ypos;
|
||||
xpos = (int)((mousecursor_x*vid.width)/(vid.pixelwidth*8));
|
||||
ypos = (int)((mousecursor_y*vid.height)/(vid.pixelheight*8));
|
||||
con_mousedown[0] = mousecursor_x;
|
||||
con_mousedown[1] = mousecursor_y;
|
||||
xpos = (int)((con->mousecursor[0]*vid.width)/(vid.pixelwidth*8));
|
||||
ypos = (int)((con->mousecursor[1]*vid.height)/(vid.pixelheight*8));
|
||||
con->mousedown[0] = con->mousecursor[0];
|
||||
con->mousedown[1] = con->mousecursor[1];
|
||||
if (ypos == 0 && con_mouseover)
|
||||
{
|
||||
if (key == K_MOUSE2)
|
||||
|
@ -961,11 +959,11 @@ void Key_Console (unsigned int unicode, int key)
|
|||
con_current = con_mouseover;
|
||||
}
|
||||
else if (key == K_MOUSE2)
|
||||
con_mousedown[2] = 2;
|
||||
con->mousedown[2] = 2;
|
||||
else
|
||||
con_mousedown[2] = 1;
|
||||
con->mousedown[2] = 1;
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == K_ENTER || key == K_KP_ENTER)
|
||||
|
@ -979,22 +977,22 @@ void Key_Console (unsigned int unicode, int key)
|
|||
key_lines[edit_line][1] = '\0';
|
||||
key_linepos = 1;
|
||||
|
||||
if (con_current->linebuffered)
|
||||
con_current->linebuffered(con_current, key_lines[oldl]+1);
|
||||
if (con->linebuffered)
|
||||
con->linebuffered(con, key_lines[oldl]+1);
|
||||
con_commandmatch = 0;
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == K_SPACE && ctrl && con_current->commandcompletion)
|
||||
if (key == K_SPACE && ctrl && con->commandcompletion)
|
||||
{
|
||||
char *txt = key_lines[edit_line]+1;
|
||||
if (*txt == '/')
|
||||
txt++;
|
||||
if (Cmd_CompleteCommand(txt, true, true, con_current->commandcompletion, NULL))
|
||||
if (Cmd_CompleteCommand(txt, true, true, con->commandcompletion, NULL))
|
||||
{
|
||||
CompleteCommand (true);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1003,12 +1001,12 @@ void Key_Console (unsigned int unicode, int key)
|
|||
if (shift)
|
||||
{
|
||||
Con_CycleConsole();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (con_current->commandcompletion)
|
||||
if (con->commandcompletion)
|
||||
CompleteCommand (ctrl);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if (key != K_CTRL && key != K_SHIFT && con_commandmatch)
|
||||
con_commandmatch=1;
|
||||
|
@ -1026,7 +1024,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
}
|
||||
else
|
||||
key_linepos = utf_left(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - key_lines[edit_line];
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if (key == K_RIGHTARROW || key == K_KP_RIGHTARROW)
|
||||
{
|
||||
|
@ -1042,10 +1040,10 @@ void Key_Console (unsigned int unicode, int key)
|
|||
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;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
key = ' ';
|
||||
unicode = ' ';
|
||||
}
|
||||
|
||||
if (key == K_DEL || key == K_KP_DEL)
|
||||
|
@ -1054,7 +1052,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
{
|
||||
int charlen = utf_right(key_lines[edit_line]+1, key_lines[edit_line] + key_linepos) - (key_lines[edit_line] + key_linepos);
|
||||
memmove(key_lines[edit_line]+key_linepos, key_lines[edit_line]+key_linepos+charlen, strlen(key_lines[edit_line]+key_linepos+charlen)+1);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
key = K_BACKSPACE;
|
||||
|
@ -1070,7 +1068,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
}
|
||||
if (!key_lines[edit_line][1])
|
||||
con_commandmatch = 0;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == K_UPARROW || key == K_KP_UPARROW)
|
||||
|
@ -1089,7 +1087,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
key_lines[edit_line][0] = ']';
|
||||
if (!key_lines[edit_line][1])
|
||||
con_commandmatch = 0;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == K_DOWNARROW || key == K_KP_DOWNARROW)
|
||||
|
@ -1100,7 +1098,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
key_lines[edit_line][1] = '\0';
|
||||
key_linepos=1;
|
||||
con_commandmatch = 0;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
do
|
||||
{
|
||||
|
@ -1120,7 +1118,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
Q_strcpy(key_lines[edit_line], key_lines[history_line]);
|
||||
key_linepos = Q_strlen(key_lines[edit_line]);
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == K_PGUP || key == K_KP_PGUP || key==K_MWHEELUP)
|
||||
|
@ -1128,59 +1126,59 @@ void Key_Console (unsigned int unicode, int key)
|
|||
int i = 2;
|
||||
if (ctrl)
|
||||
i = 8;
|
||||
if (!con_current->display)
|
||||
return;
|
||||
if (con_current->display == con_current->current)
|
||||
if (!con->display)
|
||||
return true;
|
||||
if (con->display == con->current)
|
||||
i+=2; //skip over the blank input line, and extra so we actually move despite the addition of the ^^^^^ line
|
||||
while (i-->0)
|
||||
{
|
||||
if (con_current->display->older == NULL)
|
||||
if (con->display->older == NULL)
|
||||
break;
|
||||
con_current->display = con_current->display->older;
|
||||
con->display = con->display->older;
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if (key == K_PGDN || key == K_KP_PGDN || key==K_MWHEELDOWN)
|
||||
{
|
||||
int i = 2;
|
||||
if (ctrl)
|
||||
i = 8;
|
||||
if (!con_current->display)
|
||||
return;
|
||||
if (!con->display)
|
||||
return true;
|
||||
while (i-->0)
|
||||
{
|
||||
if (con_current->display->newer == NULL)
|
||||
if (con->display->newer == NULL)
|
||||
break;
|
||||
con_current->display = con_current->display->newer;
|
||||
con->display = con->display->newer;
|
||||
}
|
||||
if (con_current->display->newer && con_current->display->newer == con_current->current)
|
||||
con_current->display = con_current->current;
|
||||
return;
|
||||
if (con->display->newer && con->display->newer == con->current)
|
||||
con->display = con->current;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == K_HOME || key == K_KP_HOME)
|
||||
{
|
||||
if (ctrl)
|
||||
con_current->display = con_current->oldest;
|
||||
con->display = con->oldest;
|
||||
else
|
||||
key_linepos = 1;
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (key == K_END || key == K_KP_END)
|
||||
{
|
||||
if (ctrl)
|
||||
con_current->display = con_current->current;
|
||||
con->display = con->current;
|
||||
else
|
||||
key_linepos = strlen(key_lines[edit_line]);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
//beware that windows translates ctrl+c and ctrl+v to a control char
|
||||
if (((unicode=='C' || unicode=='c' || unicode==3) && ctrl) || (ctrl && key == K_INS))
|
||||
{
|
||||
Sys_SaveClipboard(key_lines[edit_line]+1);
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (((unicode=='V' || unicode=='v' || unicode==22) && ctrl) || (shift && key == K_INS))
|
||||
|
@ -1191,7 +1189,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
Key_ConsoleInsert(clipText);
|
||||
Sys_CloseClipboard(clipText);
|
||||
}
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (unicode < ' ')
|
||||
|
@ -1220,7 +1218,7 @@ void Key_Console (unsigned int unicode, int key)
|
|||
default:
|
||||
// if (unicode)
|
||||
// Con_Printf("escape code %i\n", unicode);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
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.
|
||||
|
@ -1261,7 +1259,9 @@ void Key_Console (unsigned int unicode, int key)
|
|||
{
|
||||
utf8[unicode] = 0;
|
||||
Key_ConsoleInsert(utf8);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
@ -1612,11 +1612,13 @@ Writes lines containing "bind key value"
|
|||
*/
|
||||
void Key_WriteBindings (vfsfile_t *f)
|
||||
{
|
||||
char *s;
|
||||
const char *s;
|
||||
int i, m;
|
||||
char *binding, *base;
|
||||
|
||||
char prefix[128];
|
||||
char keybuf[256];
|
||||
char commandbuf[2048];
|
||||
|
||||
for (i=0 ; i<K_MAX ; i++) //we rebind the key with all modifiers to get the standard bind, then change the specific ones.
|
||||
{ //this does two things, it normally allows us to skip 7 of the 8 possibilities
|
||||
|
@ -1638,24 +1640,15 @@ void Key_WriteBindings (vfsfile_t *f)
|
|||
if (m & 1)
|
||||
strcat(prefix, "SHIFT_");
|
||||
|
||||
s = va("%s%s", prefix, Key_KeynumToString(i));
|
||||
//quote it as required
|
||||
if (i == ';' || i <= ' ' || i == '\"')
|
||||
s = COM_QuotedString(s, keybuf, sizeof(keybuf));
|
||||
|
||||
if (bindcmdlevel[i][m] != bindcmdlevel[i][0])
|
||||
{
|
||||
if (i == ';')
|
||||
s = va("bindlevel \"%s%s\" %i \"%s\"\n", prefix, Key_KeynumToString(i), bindcmdlevel[i][m], keybindings[i][m]);
|
||||
else if (i == '\"')
|
||||
s = va("bindlevel \"%s%s\" %i \"%s\"\n", prefix, "\"\"", bindcmdlevel[i][m], keybindings[i][m]);
|
||||
else
|
||||
s = va("bindlevel %s%s %i \"%s\"\n", prefix, Key_KeynumToString(i), bindcmdlevel[i][m], keybindings[i][m]);
|
||||
}
|
||||
s = va("bindlevel %s %i %s\n", s, bindcmdlevel[i][m], COM_QuotedString(binding, commandbuf, sizeof(commandbuf)));
|
||||
else
|
||||
{
|
||||
if (i == ';')
|
||||
s = va("bind \"%s%s\" \"%s\"\n", prefix, Key_KeynumToString(i), keybindings[i][m]);
|
||||
else if (i == '\"')
|
||||
s = va("bind \"%s%s\" \"%s\"\n", prefix, "\"\"", keybindings[i][m]);
|
||||
else
|
||||
s = va("bind %s%s \"%s\"\n", prefix, Key_KeynumToString(i), keybindings[i][m]);
|
||||
}
|
||||
s = va("bind %s %s\n", s, COM_QuotedString(binding, commandbuf, sizeof(commandbuf)));
|
||||
VFS_WRITE(f, s, strlen(s));
|
||||
}
|
||||
}
|
||||
|
@ -1922,7 +1915,7 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
|
|||
{
|
||||
if (down)
|
||||
{
|
||||
Con_ToggleConsole_f();
|
||||
Con_ToggleConsole_Force();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -2021,7 +2014,9 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
|
|||
M_Keyup (key, unicode);
|
||||
break;
|
||||
case key_console:
|
||||
Key_ConsoleRelease(key, unicode);
|
||||
con_current->mousecursor[0] = mousecursor_x;
|
||||
con_current->mousecursor[1] = mousecursor_y;
|
||||
Key_ConsoleRelease(con_current, key, unicode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -2152,7 +2147,9 @@ void Key_Event (int devid, int key, unsigned int unicode, qboolean down)
|
|||
case key_console:
|
||||
if ((key && unicode) || key == K_ENTER || key == K_KP_ENTER || key == K_TAB)
|
||||
key_dest = key_console;
|
||||
Key_Console (unicode, key);
|
||||
con_current->mousecursor[0] = mousecursor_x;
|
||||
con_current->mousecursor[1] = mousecursor_y;
|
||||
Key_Console (con_current, unicode, key);
|
||||
break;
|
||||
default:
|
||||
Sys_Error ("Bad key_dest");
|
||||
|
|
|
@ -189,7 +189,8 @@ void Key_SetBinding (int keynum, int modifier, char *binding, int cmdlevel);
|
|||
void Key_ClearStates (void);
|
||||
void Key_Unbindall_f (void); //aka: Key_Shutdown
|
||||
|
||||
qboolean Key_GetConsoleSelectionBox(int *sx, int *sy, int *ex, int *ey);
|
||||
struct console_s;
|
||||
qboolean Key_GetConsoleSelectionBox(struct console_s *con, int *sx, int *sy, int *ex, int *ey);
|
||||
qboolean Key_MouseShouldBeFree(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -2197,7 +2197,7 @@ qboolean Media_BeginNextFilm(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
videoshader = R_RegisterCustom(sname, Shader_DefaultCinematic, p->name);
|
||||
videoshader = R_RegisterCustom(sname, SUF_NONE, Shader_DefaultCinematic, p->name);
|
||||
Z_Free(p);
|
||||
|
||||
cin = R_ShaderGetCinematic(videoshader);
|
||||
|
|
|
@ -224,7 +224,7 @@ void M_ToggleMenu_f (void)
|
|||
if (cls.state != ca_active)
|
||||
M_Menu_Main_f();
|
||||
else
|
||||
Con_ToggleConsole_f ();
|
||||
Con_ToggleConsole_Force ();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -58,10 +58,10 @@ extern char *q_renderername;
|
|||
mpic_t *R2D_SafeCachePic (char *path);
|
||||
mpic_t *R2D_SafePicFromWad (char *name);
|
||||
void R2D_DrawCrosshair (void);
|
||||
void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic);
|
||||
void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
|
||||
void R2D_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qbyte *translation);
|
||||
void R2D_TileClear (int x, int y, int w, int h);
|
||||
void R2D_ScalePic (float x, float y, float width, float height, mpic_t *pic);
|
||||
void R2D_SubPic(float x, float y, float width, float height, mpic_t *pic, float srcx, float srcy, float srcwidth, float srcheight);
|
||||
void R2D_TransPicTranslate (float x, float y, int width, int height, qbyte *pic, qbyte *translation);
|
||||
void R2D_TileClear (float x, float y, float w, float h);
|
||||
void R2D_FadeScreen (void);
|
||||
|
||||
void R2D_ConsoleBackground (int firstline, int lastline, qboolean forceopaque);
|
||||
|
@ -71,7 +71,7 @@ void R2D_Image(float x, float y, float w, float h, float s1, float t1, float s2,
|
|||
|
||||
void R2D_ImageColours(float r, float g, float b, float a);
|
||||
void R2D_ImagePaletteColour(unsigned int i, float a);
|
||||
void R2D_FillBlock(int x, int y, int w, int h);
|
||||
void R2D_FillBlock(float x, float y, float w, float h);
|
||||
|
||||
extern void (*Draw_Init) (void);
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ static qboolean PClassic_InitParticles (void)
|
|||
classicmesh.colors4b_array = (byte_vec4_t*)classiccolours;
|
||||
classicmesh.indexes = classicindexes;
|
||||
#endif
|
||||
classicshader = R_RegisterShader("particles_classic",
|
||||
classicshader = R_RegisterShader("particles_classic", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultsprite\n"
|
||||
"nomipmaps\n"
|
||||
|
|
|
@ -578,7 +578,7 @@ static void P_LoadTexture(part_type_t *ptype, qboolean warn)
|
|||
if (*ptype->texname && ptype->looks.blendmode == BM_BLEND)
|
||||
{
|
||||
/*try and load the shader, fail if we would need to generate one*/
|
||||
ptype->looks.shader = R_RegisterCustom(ptype->texname, NULL, NULL);
|
||||
ptype->looks.shader = R_RegisterCustom(ptype->texname, SUF_NONE, NULL, NULL);
|
||||
}
|
||||
else
|
||||
ptype->looks.shader = NULL;
|
||||
|
@ -686,33 +686,33 @@ static void P_LoadTexture(part_type_t *ptype, qboolean warn)
|
|||
if (ptype->looks.type == PT_BEAM)
|
||||
{
|
||||
/*untextured beams get a single continuous blob*/
|
||||
ptype->looks.shader = R_RegisterShader(va("beam%s", namepostfix), defaultshader);
|
||||
ptype->looks.shader = R_RegisterShader(va("beam%s", namepostfix), SUF_NONE, defaultshader);
|
||||
TEXASSIGNF(tn.base, beamtexture);
|
||||
}
|
||||
else if (ptype->looks.type == PT_SPARKFAN)
|
||||
{
|
||||
/*untextured beams get a single continuous blob*/
|
||||
ptype->looks.shader = R_RegisterShader(va("fan%s", namepostfix), defaultshader);
|
||||
ptype->looks.shader = R_RegisterShader(va("fan%s", namepostfix), SUF_NONE, defaultshader);
|
||||
TEXASSIGNF(tn.base, ptritexture);
|
||||
}
|
||||
else if (strstr(ptype->texname, "glow") || strstr(ptype->texname, "ball") || ptype->looks.type == PT_TEXTUREDSPARK)
|
||||
{
|
||||
/*sparks and special names get a nice circular texture.
|
||||
as these are fully default, we can basically discard the texture name in the shader, and get better batching*/
|
||||
ptype->looks.shader = R_RegisterShader(va("ball%s", namepostfix), defaultshader);
|
||||
ptype->looks.shader = R_RegisterShader(va("ball%s", namepostfix), SUF_NONE, defaultshader);
|
||||
TEXASSIGNF(tn.base, balltexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*anything else gets a fuzzy texture*/
|
||||
ptype->looks.shader = R_RegisterShader(va("default%s", namepostfix), defaultshader);
|
||||
ptype->looks.shader = R_RegisterShader(va("default%s", namepostfix), SUF_NONE, defaultshader);
|
||||
TEXASSIGNF(tn.base, explosiontexture);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*texture looks good, make a shader, and give it the texture as a diffuse stage*/
|
||||
ptype->looks.shader = R_RegisterShader(va("%s%s", ptype->texname, namepostfix), defaultshader);
|
||||
ptype->looks.shader = R_RegisterShader(va("%s%s", ptype->texname, namepostfix), SUF_NONE, defaultshader);
|
||||
}
|
||||
R_BuildDefaultTexnums(&tn, ptype->looks.shader);
|
||||
}
|
||||
|
@ -957,7 +957,7 @@ static void P_ParticleEffect_f(void)
|
|||
str[slen++] = '\n';
|
||||
}
|
||||
str[slen] = 0;
|
||||
R_RegisterShader(ptype->texname, str);
|
||||
R_RegisterShader(ptype->texname, SUF_NONE, str);
|
||||
BZ_Free(str);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -290,7 +290,7 @@ void QCBUILTIN PF_cs_gecko_create (pubprogfuncs_t *prinst, struct globalvars_s *
|
|||
{
|
||||
char *shadername = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
cin_t *cin;
|
||||
cin = R_ShaderGetCinematic(R_RegisterShader(shadername,
|
||||
cin = R_ShaderGetCinematic(R_RegisterShader(shadername, SUF_2D,
|
||||
"{\n"
|
||||
"{\n"
|
||||
"videomap http:\n"
|
||||
|
@ -555,7 +555,7 @@ void QCBUILTIN PF_shaderforname (pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
shader_t *shad;
|
||||
|
||||
if (*defaultbody)
|
||||
shad = R_RegisterShader(str, defaultbody);
|
||||
shad = R_RegisterShader(str, SUF_NONE, defaultbody);
|
||||
else
|
||||
shad = R_RegisterSkin(str, NULL);
|
||||
if (shad)
|
||||
|
|
|
@ -314,11 +314,11 @@ static void QCBUILTIN PF_cs_gettime (pubprogfuncs_t *prinst, struct globalvars_s
|
|||
//note: doesn't even have to match the clprogs.dat :)
|
||||
typedef struct {
|
||||
|
||||
#define comfieldfloat(csqcname) float csqcname;
|
||||
#define comfieldvector(csqcname) vec3_t csqcname;
|
||||
#define comfieldentity(csqcname) int csqcname;
|
||||
#define comfieldstring(csqcname) string_t csqcname;
|
||||
#define comfieldfunction(csqcname, typestr) func_t csqcname;
|
||||
#define comfieldfloat(csqcname,desc) float csqcname;
|
||||
#define comfieldvector(csqcname,desc) vec3_t csqcname;
|
||||
#define comfieldentity(csqcname,desc) int csqcname;
|
||||
#define comfieldstring(csqcname,desc) string_t csqcname;
|
||||
#define comfieldfunction(csqcname, typestr,desc) func_t csqcname;
|
||||
comqcfields
|
||||
#undef comfieldfloat
|
||||
#undef comfieldvector
|
||||
|
@ -331,11 +331,11 @@ comqcfields
|
|||
typedef struct {
|
||||
#endif
|
||||
|
||||
#define comfieldfloat(name) float name;
|
||||
#define comfieldvector(name) vec3_t name;
|
||||
#define comfieldentity(name) int name;
|
||||
#define comfieldstring(name) string_t name;
|
||||
#define comfieldfunction(name, typestr) func_t name;
|
||||
#define comfieldfloat(name,desc) float name;
|
||||
#define comfieldvector(name,desc) vec3_t name;
|
||||
#define comfieldentity(name,desc) int name;
|
||||
#define comfieldstring(name,desc) string_t name;
|
||||
#define comfieldfunction(name, typestr,desc) func_t name;
|
||||
comextqcfields
|
||||
csqcextfields
|
||||
#undef comfieldfloat
|
||||
|
@ -381,11 +381,11 @@ typedef struct csqcedict_s
|
|||
|
||||
static void CSQC_InitFields(void)
|
||||
{ //CHANGING THIS FUNCTION REQUIRES CHANGES TO csqcentvars_t
|
||||
#define comfieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldfloat(name,desc) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name,desc) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name,desc) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name,desc) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr,desc) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
comqcfields
|
||||
#undef comfieldfloat
|
||||
#undef comfieldvector
|
||||
|
@ -394,17 +394,17 @@ comqcfields
|
|||
#undef comfieldfunction
|
||||
|
||||
#ifdef VM_Q1
|
||||
#define comfieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr) PR_RegisterFieldVar(csqcprogs, ev_function, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldfloat(name,desc) PR_RegisterFieldVar(csqcprogs, ev_float, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name,desc) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name,desc) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name,desc) PR_RegisterFieldVar(csqcprogs, ev_string, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr,desc) PR_RegisterFieldVar(csqcprogs, ev_function, #name, sizeof(csqcentvars_t) + (size_t)&((csqcextentvars_t*)0)->name, -1);
|
||||
#else
|
||||
#define comfieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldfloat(name,desc) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name,desc) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name,desc) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name,desc) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr,desc) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1);
|
||||
#endif
|
||||
comextqcfields
|
||||
csqcextfields
|
||||
|
@ -1113,8 +1113,8 @@ void QCBUILTIN PF_R_PolygonEnd(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
{
|
||||
mesh_t mesh;
|
||||
memset(&mesh, 0, sizeof(mesh));
|
||||
mesh.colors4f_array = cl_strisvertc + csqc_poly_startvert;
|
||||
|
||||
mesh.istrifan = true;
|
||||
mesh.xyz_array = cl_strisvertv + csqc_poly_startvert;
|
||||
mesh.st_array = cl_strisvertt + csqc_poly_startvert;
|
||||
mesh.colors4f_array = cl_strisvertc + csqc_poly_startvert;
|
||||
|
@ -1216,7 +1216,7 @@ static void QCBUILTIN PF_cs_unproject (pubprogfuncs_t *prinst, struct globalvars
|
|||
v[2] = in[2];//*2-1;
|
||||
v[3] = 1;
|
||||
|
||||
//don't use 1, because the far clip plane really is an infinite distance away
|
||||
//don't use 1, because the far clip plane really is an infinite distance away. and that tends to result division by infinity.
|
||||
if (v[2] >= 1)
|
||||
v[2] = 0.999999;
|
||||
|
||||
|
@ -4431,6 +4431,8 @@ static struct {
|
|||
{"hash_get", PF_hash_get, 290},
|
||||
{"hash_delete", PF_hash_delete, 291},
|
||||
{"hash_getkey", PF_hash_getkey, 292},
|
||||
{"hash_getcb", PF_hash_getcb, 293},
|
||||
{"checkcommand", PF_checkcommand, 294},
|
||||
//300
|
||||
{"clearscene", PF_R_ClearScene, 300}, // #300 void() clearscene (EXT_CSQC)
|
||||
{"addentities", PF_R_AddEntityMask, 301}, // #301 void(float mask) addentities (EXT_CSQC)
|
||||
|
@ -4548,6 +4550,11 @@ static struct {
|
|||
{"memsetval", PF_memsetval, 389},
|
||||
{"memptradd", PF_memptradd, 390},
|
||||
|
||||
{"con_getset", PF_SubConGetSet, 391},
|
||||
{"con_print", PF_SubConPrintf, 392},
|
||||
{"con_draw", PF_SubConDraw, 393},
|
||||
{"con_input", PF_SubConInput, 394},
|
||||
|
||||
//400
|
||||
{"copyentity", PF_cs_copyentity, 400}, // #400 void(entity from, entity to) copyentity (DP_QC_COPYENTITY)
|
||||
{"setcolors", PF_NoCSQC, 401}, // #401 void(entity cl, float colours) setcolors (DP_SV_SETCOLOR) (don't implement)
|
||||
|
@ -4824,7 +4831,7 @@ void VARGS CSQC_Abort (char *format, ...) //an error occured.
|
|||
{
|
||||
int size = 1024*1024*8;
|
||||
char *buffer = BZ_Malloc(size);
|
||||
csqcprogs->save_ents(csqcprogs, buffer, &size, 3);
|
||||
csqcprogs->save_ents(csqcprogs, buffer, &size, size, 3);
|
||||
COM_WriteFile("csqccore.txt", buffer, size);
|
||||
BZ_Free(buffer);
|
||||
}
|
||||
|
@ -5356,6 +5363,7 @@ void CSQC_WorldLoaded(void)
|
|||
{
|
||||
char *map;
|
||||
csqcedict_t *worldent;
|
||||
char *entfile;
|
||||
|
||||
if (!csqcprogs)
|
||||
return;
|
||||
|
@ -5363,7 +5371,7 @@ void CSQC_WorldLoaded(void)
|
|||
return;
|
||||
csqcmapentitydataloaded = true;
|
||||
map = Info_ValueForKey(cl.serverinfo, "map");
|
||||
csqcmapentitydata = map?COM_LoadFile(va("maps/%s.ent", map), 1):NULL;
|
||||
entfile = csqcmapentitydata = map?FS_LoadMallocFile(va("maps/%s.ent", map)):NULL;
|
||||
if (!csqcmapentitydata)
|
||||
csqcmapentitydata = cl.worldmodel->entities;
|
||||
|
||||
|
@ -5381,6 +5389,7 @@ void CSQC_WorldLoaded(void)
|
|||
if (csqcg.worldloaded)
|
||||
PR_ExecuteProgram(csqcprogs, csqcg.worldloaded);
|
||||
csqcmapentitydata = NULL;
|
||||
BZ_Free(entfile);
|
||||
|
||||
worldent->readonly = true;
|
||||
}
|
||||
|
@ -5396,7 +5405,7 @@ void CSQC_CoreDump(void)
|
|||
{
|
||||
int size = 1024*1024*8;
|
||||
char *buffer = BZ_Malloc(size);
|
||||
csqcprogs->save_ents(csqcprogs, buffer, &size, 3);
|
||||
csqcprogs->save_ents(csqcprogs, buffer, &size, size, 3);
|
||||
COM_WriteFile("csqccore.txt", buffer, size);
|
||||
BZ_Free(buffer);
|
||||
}
|
||||
|
@ -5536,6 +5545,7 @@ void CSQC_Breakpoint_f(void)
|
|||
else
|
||||
Con_Printf("Breakpoint has been cleared\n");
|
||||
|
||||
Cvar_Set(Cvar_FindVar("debugger"), "1");
|
||||
}
|
||||
|
||||
static void CSQC_Poke_f(void)
|
||||
|
@ -5745,8 +5755,8 @@ qboolean CSQC_MouseMove(float xdelta, float ydelta, int devid)
|
|||
|
||||
pr_globals = PR_globals(csqcprogs, PR_CURRENT);
|
||||
G_FLOAT(OFS_PARM0) = CSIE_MOUSEDELTA;
|
||||
G_FLOAT(OFS_PARM1) = xdelta;
|
||||
G_FLOAT(OFS_PARM2) = ydelta;
|
||||
G_FLOAT(OFS_PARM1) = (xdelta * vid.width) / vid.pixelwidth;
|
||||
G_FLOAT(OFS_PARM2) = (ydelta * vid.height) / vid.pixelheight;
|
||||
G_FLOAT(OFS_PARM3) = devid;
|
||||
|
||||
PR_ExecuteProgram (csqcprogs, csqcg.input_event);
|
||||
|
|
|
@ -76,7 +76,8 @@ struct {
|
|||
int size[4];
|
||||
struct font_s *font[4];
|
||||
} fontslot[FONT_SLOTS];
|
||||
void PR_CL_BeginString(pubprogfuncs_t *prinst, float vx, float vy, float szx, float szy, float *px, float *py)
|
||||
|
||||
static struct font_s *PR_CL_ChooseFont(pubprogfuncs_t *prinst, float szx, float szy)
|
||||
{
|
||||
int fontidx = 0; //default by default...
|
||||
world_t *world = prinst->parms->user;
|
||||
|
@ -106,6 +107,11 @@ void PR_CL_BeginString(pubprogfuncs_t *prinst, float vx, float vy, float szx, fl
|
|||
}
|
||||
}
|
||||
}
|
||||
return font;
|
||||
}
|
||||
void PR_CL_BeginString(pubprogfuncs_t *prinst, float vx, float vy, float szx, float szy, float *px, float *py)
|
||||
{
|
||||
struct font_s *font = PR_CL_ChooseFont(prinst, szx, szy);
|
||||
|
||||
Font_BeginScaledString(font, vx, vy, szx, szy, px, py);
|
||||
}
|
||||
|
@ -362,7 +368,7 @@ void QCBUILTIN PF_CL_is_cached_pic (pubprogfuncs_t *prinst, struct globalvars_s
|
|||
{
|
||||
char *str;
|
||||
str = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
G_FLOAT(OFS_RETURN) = !!R_RegisterCustom(str, NULL, NULL);
|
||||
G_FLOAT(OFS_RETURN) = !!R_RegisterCustom(str, SUF_2D, NULL, NULL);
|
||||
}
|
||||
|
||||
void QCBUILTIN PF_CL_precache_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
|
@ -522,7 +528,7 @@ void QCBUILTIN PF_CL_drawline (pubprogfuncs_t *prinst, struct globalvars_s *pr_g
|
|||
mesh.numindexes = 2;
|
||||
|
||||
//this shader lookup might get pricy.
|
||||
shader_draw_line = R_RegisterShader("shader_draw_line",
|
||||
shader_draw_line = R_RegisterShader("shader_draw_line", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultfill\n"
|
||||
"{\n"
|
||||
|
@ -581,6 +587,123 @@ void QCBUILTIN PF_cl_getmousepos (pubprogfuncs_t *prinst, struct globalvars_s *p
|
|||
// ret[1] = mousecursor_y;
|
||||
ret[2] = 0;
|
||||
}
|
||||
|
||||
|
||||
void QCBUILTIN PF_SubConGetSet (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
char *conname = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
char *field = PR_GetStringOfs(prinst, OFS_PARM1);
|
||||
char *value = (prinst->callargc>2)?PR_GetStringOfs(prinst, OFS_PARM2):NULL;
|
||||
console_t *con = Con_FindConsole(conname);
|
||||
G_INT(OFS_RETURN) = 0;
|
||||
if (!con)
|
||||
{
|
||||
//null if it doesn't exist
|
||||
return;
|
||||
}
|
||||
if (!strcmp(field, "title"))
|
||||
{
|
||||
RETURN_TSTRING(con->title);
|
||||
if (value)
|
||||
Q_strncpyz(con->title, value, sizeof(con->title));
|
||||
}
|
||||
else if (!strcmp(field, "name"))
|
||||
{
|
||||
RETURN_TSTRING(con->name);
|
||||
if (value && *value && *con->name)
|
||||
Q_strncpyz(con->name, value, sizeof(con->name));
|
||||
}
|
||||
else if (!strcmp(field, "next"))
|
||||
{
|
||||
con = con->next;
|
||||
if (con)
|
||||
RETURN_TSTRING(con->name);
|
||||
}
|
||||
else if (!strcmp(field, "unseen"))
|
||||
{
|
||||
RETURN_TSTRING(va("%i", con->unseentext));
|
||||
if (value)
|
||||
con->unseentext = atoi(value);
|
||||
}
|
||||
else if (!strcmp(field, "hidden"))
|
||||
{
|
||||
RETURN_TSTRING((con->flags & CON_HIDDEN)?"1":"0");
|
||||
if (value)
|
||||
con->flags = (con->flags & ~CON_HIDDEN) | (atoi(value)?CON_HIDDEN:0);
|
||||
}
|
||||
else if (!strcmp(field, "linecount"))
|
||||
{
|
||||
RETURN_TSTRING(va("%i", con->linecount));
|
||||
if (value)
|
||||
con->unseentext = atoi(value);
|
||||
}
|
||||
}
|
||||
void QCBUILTIN PF_SubConPrintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
char outbuf[4096];
|
||||
char *conname = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
char *fmt = PR_GetStringOfs(prinst, OFS_PARM1);
|
||||
console_t *con = Con_FindConsole(conname);
|
||||
if (!con)
|
||||
return;
|
||||
PF_sprintf_internal(prinst, pr_globals, fmt, 2, outbuf, sizeof(outbuf));
|
||||
Con_PrintCon(con, outbuf);
|
||||
}
|
||||
void QCBUILTIN PF_SubConDraw (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
char *conname = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
float *pos = G_VECTOR(OFS_PARM1);
|
||||
float *size = G_VECTOR(OFS_PARM2);
|
||||
float fontsize = G_FLOAT(OFS_PARM3);
|
||||
console_t *con = Con_FindConsole(conname);
|
||||
if (!con)
|
||||
return;
|
||||
|
||||
Con_DrawOneConsole(con, PR_CL_ChooseFont(prinst, fontsize, fontsize), pos[0], pos[1], size[0], size[1]);
|
||||
}
|
||||
qboolean Key_Console (console_t *con, unsigned int unicode, int key);
|
||||
void Key_ConsoleRelease (console_t *con, unsigned int unicode, int key);
|
||||
void QCBUILTIN PF_SubConInput (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
char *conname = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
int ie = G_FLOAT(OFS_PARM1);
|
||||
float pa = G_FLOAT(OFS_PARM2);
|
||||
float pb = G_FLOAT(OFS_PARM3);
|
||||
float pc = G_FLOAT(OFS_PARM4);
|
||||
console_t *con = Con_FindConsole(conname);
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
if (!con)
|
||||
return;
|
||||
switch(ie)
|
||||
{
|
||||
case CSIE_KEYDOWN:
|
||||
//scan, char
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
// G_FLOAT(OFS_RETURN) = Key_Console(con, pb, MP_TranslateQCtoFTECodes(pa));
|
||||
break;
|
||||
case CSIE_KEYUP:
|
||||
//scan, char
|
||||
Key_ConsoleRelease(con, MP_TranslateQCtoFTECodes(pa), pb);
|
||||
G_FLOAT(OFS_RETURN) = 0; //does not inhibit
|
||||
break;
|
||||
case CSIE_MOUSEABS:
|
||||
//x, y
|
||||
if (con == con_current && key_dest == key_console)
|
||||
break; //no interfering with the main console!
|
||||
con->mousecursor[0] = pa;
|
||||
con->mousecursor[1] = pb;
|
||||
G_FLOAT(OFS_RETURN) = true;
|
||||
break;
|
||||
case CSIE_FOCUS:
|
||||
//mouse, key
|
||||
if (pb >= 0)
|
||||
{
|
||||
con->flags = (con->flags & ~CONF_KEYFOCUSED) | (pb?CONF_KEYFOCUSED:0);
|
||||
G_FLOAT(OFS_RETURN) = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1330,6 +1453,8 @@ static struct {
|
|||
{"hash_get", PF_hash_get, 290},
|
||||
{"hash_delete", PF_hash_delete, 291},
|
||||
{"hash_getkey", PF_hash_getkey, 292},
|
||||
{"hash_getcb", PF_hash_getcb, 293},
|
||||
{"checkcommand", PF_checkcommand, 294},
|
||||
//gap
|
||||
{"print", PF_print, 339},
|
||||
{"keynumtostring_csqc", PF_cl_keynumtostring, 340},
|
||||
|
@ -1582,7 +1707,7 @@ void VARGS Menu_Abort (char *format, ...)
|
|||
char *buffer;
|
||||
int size = 1024*1024*8;
|
||||
buffer = Z_Malloc(size);
|
||||
menu_world.progs->save_ents(menu_world.progs, buffer, &size, 3);
|
||||
menu_world.progs->save_ents(menu_world.progs, buffer, &size, size, 3);
|
||||
COM_WriteFile("menucore.txt", buffer, size);
|
||||
Z_Free(buffer);
|
||||
}
|
||||
|
@ -1743,7 +1868,7 @@ void MP_CoreDump_f(void)
|
|||
{
|
||||
int size = 1024*1024*8;
|
||||
char *buffer = BZ_Malloc(size);
|
||||
menu_world.progs->save_ents(menu_world.progs, buffer, &size, 3);
|
||||
menu_world.progs->save_ents(menu_world.progs, buffer, &size, size, 3);
|
||||
COM_WriteFile("menucore.txt", buffer, size);
|
||||
BZ_Free(buffer);
|
||||
}
|
||||
|
@ -1777,6 +1902,7 @@ void MP_Breakpoint_f(void)
|
|||
else
|
||||
Con_Printf("Breakpoint has been cleared\n");
|
||||
|
||||
Cvar_Set(Cvar_FindVar("debugger"), "1");
|
||||
}
|
||||
|
||||
void MP_RegisterCvarsAndCmds(void)
|
||||
|
@ -1835,7 +1961,7 @@ void MP_Keydown(int key, int unicode)
|
|||
{
|
||||
if (keydown[K_LSHIFT] || keydown[K_RSHIFT])
|
||||
{
|
||||
Con_ToggleConsole_f();
|
||||
Con_ToggleConsole_Force();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1246,7 +1246,7 @@ void rag_derive(skelobject_t *sko, skelobject_t *asko, float *emat)
|
|||
continue;
|
||||
|
||||
if (!debugshader)
|
||||
debugshader = R_RegisterShader("boneshader",
|
||||
debugshader = R_RegisterShader("boneshader", SUF_NONE,
|
||||
"{\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
|
@ -1291,7 +1291,7 @@ void rag_derive(skelobject_t *sko, skelobject_t *asko, float *emat)
|
|||
// CLQ1_AddOrientedCube(debugshader, mins, maxs, bodymat, 0, 0.2, 0, 1);
|
||||
|
||||
if (!lineshader)
|
||||
lineshader = R_RegisterShader("lineshader",
|
||||
lineshader = R_RegisterShader("lineshader", SUF_NONE,
|
||||
"{\n"
|
||||
"polygonoffset\n"
|
||||
"{\n"
|
||||
|
|
|
@ -172,7 +172,7 @@ void R2D_Init(void)
|
|||
translate_texture = r_nulltex;
|
||||
ch_int_texture = r_nulltex;
|
||||
|
||||
draw_backtile = R_RegisterShader("gfx/backtile.lmp",
|
||||
draw_backtile = R_RegisterShader("gfx/backtile.lmp", SUF_NONE,
|
||||
"{\n"
|
||||
"if $nofixed\n"
|
||||
"program default2d\n"
|
||||
|
@ -187,7 +187,7 @@ void R2D_Init(void)
|
|||
if (!TEXVALID(draw_backtile->defaulttextures.base))
|
||||
draw_backtile->defaulttextures.base = R_LoadHiResTexture("gfx/menu/backtile", NULL, IF_UIPIC|IF_NOPICMIP|IF_NOMIPMAP);
|
||||
|
||||
shader_draw_fill = R_RegisterShader("fill_opaque",
|
||||
shader_draw_fill = R_RegisterShader("fill_opaque", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultfill\n"
|
||||
"{\n"
|
||||
|
@ -196,7 +196,7 @@ void R2D_Init(void)
|
|||
"alphagen vertex\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
shader_draw_fill_trans = R_RegisterShader("fill_trans",
|
||||
shader_draw_fill_trans = R_RegisterShader("fill_trans", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultfill\n"
|
||||
"{\n"
|
||||
|
@ -206,7 +206,7 @@ void R2D_Init(void)
|
|||
"blendfunc blend\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
shader_contrastup = R_RegisterShader("constrastupshader",
|
||||
shader_contrastup = R_RegisterShader("constrastupshader", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultfill\n"
|
||||
"{\n"
|
||||
|
@ -218,7 +218,7 @@ void R2D_Init(void)
|
|||
"}\n"
|
||||
"}\n"
|
||||
);
|
||||
shader_contrastdown = R_RegisterShader("constrastdownshader",
|
||||
shader_contrastdown = R_RegisterShader("constrastdownshader", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultfill\n"
|
||||
"{\n"
|
||||
|
@ -230,7 +230,7 @@ void R2D_Init(void)
|
|||
"}\n"
|
||||
"}\n"
|
||||
);
|
||||
shader_brightness = R_RegisterShader("brightnessshader",
|
||||
shader_brightness = R_RegisterShader("brightnessshader", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultfill\n"
|
||||
"{\n"
|
||||
|
@ -242,7 +242,7 @@ void R2D_Init(void)
|
|||
"}\n"
|
||||
"}\n"
|
||||
);
|
||||
shader_gammacb = R_RegisterShader("gammacbshader",
|
||||
shader_gammacb = R_RegisterShader("gammacbshader", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultgammacb\n"
|
||||
"cull back\n"
|
||||
|
@ -252,7 +252,7 @@ void R2D_Init(void)
|
|||
"}\n"
|
||||
"}\n"
|
||||
);
|
||||
shader_polyblend = R_RegisterShader("polyblendshader",
|
||||
shader_polyblend = R_RegisterShader("polyblendshader", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultfill\n"
|
||||
"{\n"
|
||||
|
@ -263,7 +263,7 @@ void R2D_Init(void)
|
|||
"}\n"
|
||||
"}\n"
|
||||
);
|
||||
shader_menutint = R_RegisterShader("menutint",
|
||||
shader_menutint = R_RegisterShader("menutint", SUF_NONE,
|
||||
"{\n"
|
||||
"if $glsl && gl_menutint_shader != 0\n"
|
||||
"program menutint\n"
|
||||
|
@ -279,7 +279,7 @@ void R2D_Init(void)
|
|||
"endif\n"
|
||||
"}\n"
|
||||
);
|
||||
shader_crosshair = R_RegisterShader("crosshairshader",
|
||||
shader_crosshair = R_RegisterShader("crosshairshader", SUF_NONE,
|
||||
"{\n"
|
||||
"if $nofixed\n"
|
||||
"program default2d\n"
|
||||
|
@ -401,7 +401,7 @@ void R2D_Image(float x, float y, float w, float h, float s1, float t1, float s2,
|
|||
}
|
||||
|
||||
/*draws a block of the current colour on the screen*/
|
||||
void R2D_FillBlock(int x, int y, int w, int h)
|
||||
void R2D_FillBlock(float x, float y, float w, float h)
|
||||
{
|
||||
draw_mesh_xyz[0][0] = x;
|
||||
draw_mesh_xyz[0][1] = y;
|
||||
|
@ -421,12 +421,12 @@ void R2D_FillBlock(int x, int y, int w, int h)
|
|||
BE_DrawMesh_Single(shader_draw_fill, &draw_mesh, NULL, &shader_draw_fill->defaulttextures, r2d_be_flags);
|
||||
}
|
||||
|
||||
void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic)
|
||||
void R2D_ScalePic (float x, float y, float width, float height, mpic_t *pic)
|
||||
{
|
||||
R2D_Image(x, y, width, height, 0, 0, 1, 1, pic);
|
||||
}
|
||||
|
||||
void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight)
|
||||
void R2D_SubPic(float x, float y, float width, float height, mpic_t *pic, float srcx, float srcy, float srcwidth, float srcheight)
|
||||
{
|
||||
float newsl, newtl, newsh, newth;
|
||||
|
||||
|
@ -440,7 +440,7 @@ void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int
|
|||
}
|
||||
|
||||
/* this is an ugly special case drawing func that's only used for the player color selection menu */
|
||||
void R2D_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qbyte *translation)
|
||||
void R2D_TransPicTranslate (float x, float y, int width, int height, qbyte *pic, qbyte *translation)
|
||||
{
|
||||
int v, u;
|
||||
unsigned trans[64*64], *dest;
|
||||
|
@ -464,16 +464,17 @@ void R2D_TransPicTranslate (int x, int y, int width, int height, qbyte *pic, qby
|
|||
if (!TEXVALID(translate_texture))
|
||||
{
|
||||
translate_texture = R_AllocNewTexture("***translatedpic***", 64, 64, 0);
|
||||
translate_shader = R_RegisterShader("translatedpic", "{\n"
|
||||
"if $nofixed\n"
|
||||
"program default2d\n"
|
||||
"endif\n"
|
||||
"nomipmaps\n"
|
||||
translate_shader = R_RegisterShader("translatedpic", SUF_2D,
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
"blendfunc blend\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
"if $nofixed\n"
|
||||
"program default2d\n"
|
||||
"endif\n"
|
||||
"nomipmaps\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
"blendfunc blend\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
translate_shader->defaulttextures.base = translate_texture;
|
||||
}
|
||||
/* could avoid reuploading already translated textures but this func really isn't used enough anyway */
|
||||
|
@ -542,7 +543,7 @@ This repeats a 64*64 tile graphic to fill the screen around a sized down
|
|||
refresh window.
|
||||
=============
|
||||
*/
|
||||
void R2D_TileClear (int x, int y, int w, int h)
|
||||
void R2D_TileClear (float x, float y, float w, float h)
|
||||
{
|
||||
float newsl, newsh, newtl, newth;
|
||||
newsl = (x)/(float)64;
|
||||
|
@ -588,7 +589,7 @@ void R2D_Conback_Callback(struct cvar_s *var, char *oldvalue)
|
|||
conback = R_RegisterPic(var->string);
|
||||
if (!conback || conback->flags & SHADER_NOIMAGE)
|
||||
{
|
||||
conback = R_RegisterCustom("console", NULL, NULL);
|
||||
conback = R_RegisterCustom("console", SUF_2D, NULL, NULL);
|
||||
if (!conback || conback->flags & SHADER_NOIMAGE)
|
||||
{
|
||||
if (M_GameType() == MGT_HEXEN2)
|
||||
|
|
|
@ -963,7 +963,7 @@ void R_ShutdownRenderer(void)
|
|||
|
||||
RQ_Shutdown();
|
||||
|
||||
S_Shutdown();
|
||||
S_Shutdown(false);
|
||||
}
|
||||
|
||||
void R_GenPaletteLookup(void)
|
||||
|
|
|
@ -228,6 +228,7 @@ enum
|
|||
VOIP_OPUS = 2, //supposed to be better than speex.
|
||||
VOIP_SPEEX_NARROW = 3, //narrowband speex. packed data.
|
||||
VOIP_SPEEX_WIDE = 4, //wideband speex. packed data.
|
||||
VOIP_SPEEX_ULTRAWIDE = 5,//wideband speex. packed data.
|
||||
|
||||
VOIP_INVALID = 16 //not currently generating audio.
|
||||
};
|
||||
|
@ -244,6 +245,7 @@ static struct
|
|||
|
||||
const SpeexMode *modenb;
|
||||
const SpeexMode *modewb;
|
||||
const SpeexMode *modeuwb;
|
||||
} speex;
|
||||
|
||||
struct
|
||||
|
@ -443,6 +445,7 @@ static qboolean S_Speex_Init(void)
|
|||
|
||||
s_voip.speex.modenb = qspeex_lib_get_mode(SPEEX_MODEID_NB);
|
||||
s_voip.speex.modewb = qspeex_lib_get_mode(SPEEX_MODEID_WB);
|
||||
s_voip.speex.modeuwb = qspeex_lib_get_mode(SPEEX_MODEID_UWB);
|
||||
|
||||
s_voip.speex.loaded = true;
|
||||
return s_voip.speex.loaded;
|
||||
|
@ -506,6 +509,7 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un
|
|||
case VOIP_SPEEX_OLD:
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
qspeex_decoder_destroy(s_voip.decoder[sender]);
|
||||
break;
|
||||
case VOIP_RAW:
|
||||
|
@ -528,33 +532,46 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un
|
|||
case VOIP_SPEEX_OLD:
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
if (!S_Speex_Init())
|
||||
return; //speex not usable.
|
||||
if (codec == VOIP_SPEEX_NARROW)
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
{
|
||||
s_voip.decsamplerate[sender] = 8000;
|
||||
s_voip.decframesize[sender] = 160;
|
||||
}
|
||||
else if (codec == VOIP_SPEEX_WIDE)
|
||||
{
|
||||
s_voip.decsamplerate[sender] = 16000;
|
||||
s_voip.decframesize[sender] = 320;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_voip.decsamplerate[sender] = 11025;
|
||||
s_voip.decframesize[sender] = 160;
|
||||
}
|
||||
if (!s_voip.decoder[sender])
|
||||
{
|
||||
qspeex_bits_init(&s_voip.speex.decbits[sender]);
|
||||
qspeex_bits_reset(&s_voip.speex.decbits[sender]);
|
||||
s_voip.decoder[sender] = qspeex_decoder_init((codec==VOIP_SPEEX_WIDE)?s_voip.speex.modewb:s_voip.speex.modenb);
|
||||
const SpeexMode *smode;
|
||||
if (!S_Speex_Init())
|
||||
return; //speex not usable.
|
||||
if (codec == VOIP_SPEEX_NARROW)
|
||||
{
|
||||
s_voip.decsamplerate[sender] = 8000;
|
||||
s_voip.decframesize[sender] = 160;
|
||||
smode = s_voip.speex.modenb;
|
||||
}
|
||||
else if (codec == VOIP_SPEEX_WIDE)
|
||||
{
|
||||
s_voip.decsamplerate[sender] = 16000;
|
||||
s_voip.decframesize[sender] = 320;
|
||||
smode = s_voip.speex.modewb;
|
||||
}
|
||||
else if (codec = VOIP_SPEEX_ULTRAWIDE)
|
||||
{
|
||||
s_voip.decsamplerate[sender] = 32000;
|
||||
s_voip.decframesize[sender] = 640;
|
||||
smode = s_voip.speex.modeuwb;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_voip.decsamplerate[sender] = 11025;
|
||||
s_voip.decframesize[sender] = 160;
|
||||
smode = s_voip.speex.modenb;
|
||||
}
|
||||
if (!s_voip.decoder[sender])
|
||||
return;
|
||||
{
|
||||
qspeex_bits_init(&s_voip.speex.decbits[sender]);
|
||||
qspeex_bits_reset(&s_voip.speex.decbits[sender]);
|
||||
s_voip.decoder[sender] = qspeex_decoder_init(smode);
|
||||
if (!s_voip.decoder[sender])
|
||||
return;
|
||||
}
|
||||
else
|
||||
qspeex_bits_reset(&s_voip.speex.decbits[sender]);
|
||||
}
|
||||
else
|
||||
qspeex_bits_reset(&s_voip.speex.decbits[sender]);
|
||||
break;
|
||||
case VOIP_OPUS:
|
||||
if (!S_Opus_Init())
|
||||
|
@ -606,6 +623,7 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un
|
|||
case VOIP_SPEEX_OLD:
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
qspeex_decode_int(s_voip.decoder[sender], NULL, decodebuf + decodesamps);
|
||||
decodesamps += s_voip.decframesize[sender];
|
||||
break;
|
||||
|
@ -633,6 +651,7 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un
|
|||
case VOIP_SPEEX_OLD:
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
if (codec == VOIP_SPEEX_OLD)
|
||||
{ //older versions support only this, and require this extra bit.
|
||||
bytes--;
|
||||
|
@ -673,7 +692,7 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un
|
|||
decodesamps = 0;
|
||||
}
|
||||
r = qopus_decode(s_voip.decoder[sender], start, len, decodebuf + decodesamps, sizeof(decodebuf)/sizeof(decodebuf[0]) - decodesamps, false);
|
||||
Con_Printf("Decoded %i frames from %i bytes\n", r, len);
|
||||
// Con_Printf("Decoded %i frames from %i bytes\n", r, len);
|
||||
if (r > 0)
|
||||
{
|
||||
decodesamps += r;
|
||||
|
@ -697,6 +716,20 @@ void S_Voip_Decode(unsigned int sender, unsigned int codec, unsigned int gen, un
|
|||
}
|
||||
|
||||
#ifdef SUPPORT_ICE
|
||||
qboolean S_Voip_RTP_CodecOkay(char *codec)
|
||||
{
|
||||
if (!strcmp(codec, "speex@8000") || !strcmp(codec, "speex@11025") || !strcmp(codec, "speex@16000") || !strcmp(codec, "speex@32000"))
|
||||
{
|
||||
if (S_Speex_Init())
|
||||
return true;
|
||||
}
|
||||
else if (!strcmp(codec, "opus"))
|
||||
{
|
||||
if (S_Opus_Init())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void S_Voip_RTP_Parse(unsigned short sequence, char *codec, unsigned char *data, unsigned int datalen)
|
||||
{
|
||||
if (!strcmp(codec, "speex@8000"))
|
||||
|
@ -705,8 +738,12 @@ void S_Voip_RTP_Parse(unsigned short sequence, char *codec, unsigned char *data,
|
|||
S_Voip_Decode(MAX_CLIENTS-1, VOIP_SPEEX_OLD, 0, sequence, datalen, data); //very much non-standard rtp
|
||||
if (!strcmp(codec, "speex@16000"))
|
||||
S_Voip_Decode(MAX_CLIENTS-1, VOIP_SPEEX_WIDE, 0, sequence, datalen, data);
|
||||
if (!strcmp(codec, "speex@32000"))
|
||||
S_Voip_Decode(MAX_CLIENTS-1, VOIP_SPEEX_ULTRAWIDE, 0, sequence, datalen, data);
|
||||
if (!strcmp(codec, "opus"))
|
||||
S_Voip_Decode(MAX_CLIENTS-1, VOIP_OPUS, 0, sequence, datalen, data);
|
||||
}
|
||||
qboolean NET_RTP_Transmit(unsigned int sequence, unsigned int timestamp, char *codec, char *cdata, int clength);
|
||||
qboolean NET_RTP_Transmit(unsigned int sequence, unsigned int timestamp, const char *codec, char *cdata, int clength);
|
||||
qboolean NET_RTP_Active(void);
|
||||
#else
|
||||
#define NET_RTP_Active() false
|
||||
|
@ -754,8 +791,7 @@ static float S_Voip_Preprocess(short *start, unsigned int samples, float micamp)
|
|||
for (i = 0; i < framesize; i++)
|
||||
{
|
||||
f = start[i] * micamp;
|
||||
start[i] = f;
|
||||
f = fabs(start[i]);
|
||||
start[i] = bound(-32768, f, 32767); //clamp it carefully, so it doesn't go to crap when given far too high a mic amp
|
||||
level += f*f;
|
||||
}
|
||||
|
||||
|
@ -795,7 +831,7 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf)
|
|||
voipsendenable = true;
|
||||
//if rtp streaming is enabled, hack the codec to something better supported
|
||||
if (voipcodec == VOIP_SPEEX_OLD)
|
||||
voipcodec = VOIP_SPEEX_NARROW;
|
||||
voipcodec = VOIP_SPEEX_WIDE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -822,6 +858,7 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf)
|
|||
case VOIP_SPEEX_OLD:
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
break;
|
||||
case VOIP_OPUS:
|
||||
qopus_encoder_destroy(s_voip.encoder);
|
||||
|
@ -859,26 +896,38 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf)
|
|||
case VOIP_SPEEX_OLD:
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
if (!S_Speex_Init())
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
{
|
||||
Con_Printf("Unable to use speex codec - not installed\n");
|
||||
return;
|
||||
}
|
||||
const SpeexMode *smode;
|
||||
if (!S_Speex_Init())
|
||||
{
|
||||
Con_Printf("Unable to use speex codec - not installed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
qspeex_bits_init(&s_voip.speex.encbits);
|
||||
qspeex_bits_reset(&s_voip.speex.encbits);
|
||||
s_voip.encoder = qspeex_encoder_init((voipcodec == VOIP_SPEEX_WIDE)?s_voip.speex.modewb:s_voip.speex.modenb);
|
||||
if (!s_voip.encoder)
|
||||
return;
|
||||
qspeex_encoder_ctl(s_voip.encoder, SPEEX_GET_FRAME_SIZE, &s_voip.encframesize);
|
||||
qspeex_encoder_ctl(s_voip.encoder, SPEEX_GET_SAMPLING_RATE, &s_voip.encsamplerate);
|
||||
if (voipcodec == VOIP_SPEEX_NARROW)
|
||||
s_voip.encsamplerate = 8000;
|
||||
else if (voipcodec == VOIP_SPEEX_WIDE)
|
||||
s_voip.encsamplerate = 16000;
|
||||
else
|
||||
s_voip.encsamplerate = 11025;
|
||||
qspeex_encoder_ctl(s_voip.encoder, SPEEX_SET_SAMPLING_RATE, &s_voip.encsamplerate);
|
||||
if (voipcodec == VOIP_SPEEX_ULTRAWIDE)
|
||||
smode = s_voip.speex.modeuwb;
|
||||
else if (voipcodec == VOIP_SPEEX_WIDE)
|
||||
smode = s_voip.speex.modewb;
|
||||
else
|
||||
smode = s_voip.speex.modenb;
|
||||
qspeex_bits_init(&s_voip.speex.encbits);
|
||||
qspeex_bits_reset(&s_voip.speex.encbits);
|
||||
s_voip.encoder = qspeex_encoder_init(smode);
|
||||
if (!s_voip.encoder)
|
||||
return;
|
||||
qspeex_encoder_ctl(s_voip.encoder, SPEEX_GET_FRAME_SIZE, &s_voip.encframesize);
|
||||
qspeex_encoder_ctl(s_voip.encoder, SPEEX_GET_SAMPLING_RATE, &s_voip.encsamplerate);
|
||||
if (voipcodec == VOIP_SPEEX_NARROW)
|
||||
s_voip.encsamplerate = 8000;
|
||||
else if (voipcodec == VOIP_SPEEX_WIDE)
|
||||
s_voip.encsamplerate = 16000;
|
||||
else if (voipcodec == VOIP_SPEEX_ULTRAWIDE)
|
||||
s_voip.encsamplerate = 32000;
|
||||
else
|
||||
s_voip.encsamplerate = 11025;
|
||||
qspeex_encoder_ctl(s_voip.encoder, SPEEX_SET_SAMPLING_RATE, &s_voip.encsamplerate);
|
||||
}
|
||||
break;
|
||||
case VOIP_RAW:
|
||||
s_voip.encsamplerate = 11025;
|
||||
|
@ -955,6 +1004,7 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf)
|
|||
case VOIP_SPEEX_OLD:
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
qspeex_bits_reset(&s_voip.speex.encbits);
|
||||
break;
|
||||
case VOIP_RAW:
|
||||
|
@ -1036,6 +1086,7 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf)
|
|||
break;
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
qspeex_bits_reset(&s_voip.speex.encbits);
|
||||
for (; s_voip.capturepos-encpos >= s_voip.encframesize*2 && sizeof(outbuf)-outpos > 64; )
|
||||
{
|
||||
|
@ -1089,10 +1140,10 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf)
|
|||
Con_Printf("invalid Opus frame size\n");
|
||||
frames = 0;
|
||||
}
|
||||
Con_Printf("Encoding %i frames", frames);
|
||||
// Con_Printf("Encoding %i frames", frames);
|
||||
level += S_Voip_Preprocess(start, frames, micamp);
|
||||
len = qopus_encode(s_voip.encoder, start, frames, outbuf+outpos, sizeof(outbuf) - outpos);
|
||||
Con_Printf(" (%i bytes)\n", len);
|
||||
// Con_Printf(" (%i bytes)\n", len);
|
||||
if (len >= 0)
|
||||
{
|
||||
s_voip.encsequence += frames / s_voip.encframesize;
|
||||
|
@ -1162,6 +1213,7 @@ void S_Voip_Transmit(unsigned char clc, sizebuf_t *buf)
|
|||
{
|
||||
case VOIP_SPEEX_NARROW:
|
||||
case VOIP_SPEEX_WIDE:
|
||||
case VOIP_SPEEX_ULTRAWIDE:
|
||||
case VOIP_SPEEX_OLD:
|
||||
NET_RTP_Transmit(initseq, inittimestamp, va("speex@%i", s_voip.encsamplerate), outbuf, outpos);
|
||||
break;
|
||||
|
@ -1548,7 +1600,7 @@ void S_Startup (void)
|
|||
return;
|
||||
|
||||
if (sound_started)
|
||||
S_Shutdown();
|
||||
S_Shutdown(false);
|
||||
|
||||
snd_blocked = 0;
|
||||
snd_speed = 0;
|
||||
|
@ -1598,7 +1650,7 @@ void S_DoRestart (void)
|
|||
int i;
|
||||
|
||||
S_StopAllSounds (true);
|
||||
S_Shutdown();
|
||||
S_Shutdown(false);
|
||||
|
||||
if (nosound.ival)
|
||||
return;
|
||||
|
@ -1634,7 +1686,7 @@ void S_Control_f (void)
|
|||
|
||||
S_StopAllSounds (true);
|
||||
|
||||
S_Shutdown();
|
||||
S_Shutdown(false);
|
||||
sound_started = 0;
|
||||
}
|
||||
|
||||
|
@ -1825,7 +1877,7 @@ void S_ShutdownCard(soundcardinfo_t *sc)
|
|||
sc->Shutdown(sc);
|
||||
Z_Free(sc);
|
||||
}
|
||||
void S_Shutdown(void)
|
||||
void S_Shutdown(qboolean final)
|
||||
{
|
||||
soundcardinfo_t *sc, *next;
|
||||
|
||||
|
@ -1844,16 +1896,19 @@ void S_Shutdown(void)
|
|||
known_sfx = NULL;
|
||||
num_sfx = 0;
|
||||
|
||||
while (numsoundoutdevices)
|
||||
if (final)
|
||||
{
|
||||
numsoundoutdevices--;
|
||||
free(soundoutdevicenames[numsoundoutdevices]);
|
||||
free(soundoutdevicecodes[numsoundoutdevices]);
|
||||
while (numsoundoutdevices)
|
||||
{
|
||||
numsoundoutdevices--;
|
||||
free(soundoutdevicenames[numsoundoutdevices]);
|
||||
free(soundoutdevicecodes[numsoundoutdevices]);
|
||||
}
|
||||
free(soundoutdevicenames);
|
||||
soundoutdevicenames = NULL;
|
||||
free(soundoutdevicecodes);
|
||||
soundoutdevicecodes = NULL;
|
||||
}
|
||||
free(soundoutdevicenames);
|
||||
soundoutdevicenames = NULL;
|
||||
free(soundoutdevicecodes);
|
||||
soundoutdevicecodes = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -3088,6 +3143,7 @@ void S_RawAudio(int sourceid, qbyte *data, int speed, int samples, int channels,
|
|||
|
||||
if (si->channel[i].pos < 0)
|
||||
si->channel[i].pos = 0;
|
||||
si->channel[i].master_vol = 255 * volume;
|
||||
if (si->ChannelUpdate)
|
||||
si->ChannelUpdate(si, &si->channel[i], false);
|
||||
break;
|
||||
|
|
|
@ -115,7 +115,7 @@ typedef struct soundcardinfo_s soundcardinfo_t;
|
|||
|
||||
void S_Init (void);
|
||||
void S_Startup (void);
|
||||
void S_Shutdown (void);
|
||||
void S_Shutdown (qboolean final);
|
||||
void S_StartSound (int entnum, int entchannel, sfx_t *sfx, vec3_t origin, float fvol, float attenuation, float timeofs, float pitchadj);
|
||||
void S_StaticSound (sfx_t *sfx, vec3_t origin, float vol, float attenuation);
|
||||
void S_StopSound (int entnum, int entchannel);
|
||||
|
|
|
@ -22,7 +22,7 @@ F11 will step through.
|
|||
#else
|
||||
#define editaddcr_default "0"
|
||||
#endif
|
||||
#ifdef ANDROID
|
||||
#if defined(ANDROID) || defined(SERVERONLY)
|
||||
#define debugger_default "0"
|
||||
#else
|
||||
#define debugger_default "1"
|
||||
|
@ -588,7 +588,7 @@ void Editor_Key(int key, int unicode)
|
|||
"F2: Open file named on cursor line\n"
|
||||
"F3: Toggle expression evaluator\n"
|
||||
"F4: Save file\n"
|
||||
"F5: Stop tracing (run)\n"
|
||||
"F5: Stop tracing (resume)\n"
|
||||
"F6: Print stack trace\n"
|
||||
"F7: Save file and recompile\n"
|
||||
"F8: Change current point of execution\n"
|
||||
|
|
|
@ -45,7 +45,7 @@ extern rendererstate_t currentrendererstate;
|
|||
|
||||
typedef struct vrect_s
|
||||
{
|
||||
int x,y,width,height;
|
||||
float x,y,width,height;
|
||||
} vrect_t;
|
||||
|
||||
typedef struct
|
||||
|
|
|
@ -1213,7 +1213,6 @@ V_CalcRefdef
|
|||
void V_CalcRefdef (playerview_t *pv)
|
||||
{
|
||||
entity_t *view;
|
||||
int i;
|
||||
float bob;
|
||||
float viewheight;
|
||||
r_refdef.playerview = pv;
|
||||
|
|
|
@ -236,7 +236,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define CL_MASTER //query master servers and stuff for a dynamic server listing.
|
||||
#define R_XFLIP //allow view to be flipped horizontally
|
||||
#define TEXTEDITOR
|
||||
#define PPL //per pixel lighting (stencil shadowing)
|
||||
#define DDS //a sort of image file format.
|
||||
#define RTLIGHTS //realtime lighting
|
||||
|
||||
|
@ -277,12 +276,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#undef HLSERVER //dlls...
|
||||
#undef CL_MASTER //bah. use the site to specify the servers.
|
||||
#undef SV_MASTER //yeah, because that makes sense in a browser
|
||||
#undef ODE_STATIC //blurgh, too lazy
|
||||
#undef ODE_DYNAMIC //dlls...
|
||||
#undef RAGDOLL //no ode
|
||||
#undef TCPCONNECT //err...
|
||||
#undef IRCCONNECT //not happening
|
||||
#undef RUNTIMELIGHTING //too slow
|
||||
#undef PLUGINS //pointless
|
||||
#undef SUPPORT_ICE //utterly pointless
|
||||
#undef VM_Q1 //no dlls
|
||||
#undef MAP_PROC //meh
|
||||
#undef HALFLIFEMODELS //blurgh
|
||||
|
@ -290,6 +289,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#undef SUPPORT_ICE //kinda requires udp, but whatever
|
||||
|
||||
//extra features stripped to try to reduce memory footprints
|
||||
#undef RUNTIMELIGHTING //too slow anyway
|
||||
#undef Q2CLIENT
|
||||
#undef Q2SERVER //requires a dll anyway.
|
||||
#undef Q3CLIENT
|
||||
|
@ -334,7 +334,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#endif
|
||||
|
||||
#if defined(RTLIGHTS) && !defined(GLQUAKE) && !defined(D3D9QUAKE)
|
||||
#undef RTLIGHTS
|
||||
#undef RTLIGHTS
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
|
|
|
@ -405,7 +405,7 @@ typedef struct q2miptex_s
|
|||
// upper design bounds
|
||||
// leaffaces, leafbrushes, planes, and verts are still bounded by
|
||||
// 16 bit short limits
|
||||
#define MAX_Q2MAP_MODELS 1024
|
||||
#define SANITY_MAX_Q2MAP_MODELS 1024
|
||||
#define MAX_Q2MAP_ENTITIES 2048
|
||||
#define SANITY_MAX_MAP_BRUSHES 0x8000
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ cvar_t rcon_level = SCVAR("rcon_level", "20");
|
|||
cvar_t cmd_maxbuffersize = SCVAR("cmd_maxbuffersize", "65536");
|
||||
cvar_t dpcompat_set = SCVAR("dpcompat_set", "0");
|
||||
int Cmd_ExecLevel;
|
||||
qboolean cmd_didwait;
|
||||
|
||||
void Cmd_ForwardToServer (void);
|
||||
|
||||
|
@ -161,6 +162,9 @@ bind g "impulse 5 ; +attack ; wait ; -attack ; impulse 2"
|
|||
*/
|
||||
void Cmd_Wait_f (void)
|
||||
{
|
||||
if (cmd_didwait && sv.state)
|
||||
Con_DPrintf("waits without server frames\n");
|
||||
cmd_didwait = true;
|
||||
cmd_text[Cmd_ExecLevel].waitattime = realtime;
|
||||
}
|
||||
|
||||
|
@ -932,6 +936,7 @@ void Alias_WriteAliases (vfsfile_t *f)
|
|||
char *s;
|
||||
cmdalias_t *cmd;
|
||||
int num=0;
|
||||
char buf[2048];
|
||||
for (cmd=cmd_alias ; cmd ; cmd=cmd->next)
|
||||
{
|
||||
// if ((cmd->restriction?cmd->restriction:rcon_level.ival) > Cmd_ExecLevel)
|
||||
|
@ -943,7 +948,7 @@ void Alias_WriteAliases (vfsfile_t *f)
|
|||
s = va("\n//////////////////\n//Aliases\n");
|
||||
VFS_WRITE(f, s, strlen(s));
|
||||
}
|
||||
s = va("alias %s \"%s\"\n", cmd->name, cmd->value);
|
||||
s = va("alias %s %s\n", cmd->name, COM_QuotedString(cmd->value, buf, sizeof(buf)));
|
||||
VFS_WRITE(f, s, strlen(s));
|
||||
if (cmd->restriction != 1) //1 is default
|
||||
{
|
||||
|
@ -1913,6 +1918,7 @@ FIXME: lookupnoadd the token to speed search?
|
|||
*/
|
||||
void Cmd_ExecuteString (char *text, int level)
|
||||
{
|
||||
//WARNING: PF_checkcommand should match the order.
|
||||
cmd_function_t *cmd;
|
||||
cmdalias_t *a;
|
||||
|
||||
|
@ -2036,7 +2042,7 @@ void Cmd_ExecuteString (char *text, int level)
|
|||
#ifndef CLIENTONLY
|
||||
if (sv.state)
|
||||
{
|
||||
if (PR_ConsoleCmd())
|
||||
if (PR_ConsoleCmd(text))
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2666,7 +2666,7 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintran
|
|||
|
||||
Q_snprintfz(skinname, sizeof(skinname), "%s_%i", loadname, i);
|
||||
if (skintranstype == 4)
|
||||
shaders[0] = R_RegisterShader(skinname,
|
||||
shaders[0] = R_RegisterShader(skinname, SUF_NONE,
|
||||
"{\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
|
@ -2677,7 +2677,7 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintran
|
|||
"}\n"
|
||||
"}\n");
|
||||
else if (skintranstype == 3)
|
||||
shaders[0] = R_RegisterShader(skinname,
|
||||
shaders[0] = R_RegisterShader(skinname, SUF_NONE,
|
||||
"{\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
|
@ -2687,7 +2687,7 @@ static void *Q1_LoadSkins_GL (daliasskintype_t *pskintype, unsigned int skintran
|
|||
"}\n"
|
||||
"}\n");
|
||||
else if (skintranstype)
|
||||
shaders[0] = R_RegisterShader(skinname,
|
||||
shaders[0] = R_RegisterShader(skinname, SUF_NONE,
|
||||
"{\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
|
|
|
@ -3637,7 +3637,7 @@ skipwhite:
|
|||
if (!c)
|
||||
{
|
||||
token[len] = 0;
|
||||
return (char*)data;
|
||||
return (char*)data-1;
|
||||
}
|
||||
if (c == '\\')
|
||||
{
|
||||
|
|
|
@ -283,7 +283,7 @@ const char *COM_QuotedString(const char *string, char *buf, int buflen); //inver
|
|||
extern int com_argc;
|
||||
extern const char **com_argv;
|
||||
|
||||
int COM_CheckParm (const char *parm);
|
||||
int COM_CheckParm (const char *parm); //WARNING: Legacy arguments should be listed in CL_ArgumentOverrides!
|
||||
int COM_CheckNextParm (const char *parm, int last);
|
||||
void COM_AddParm (const char *parm);
|
||||
|
||||
|
|
|
@ -106,13 +106,16 @@ typedef struct conline_s {
|
|||
float time;
|
||||
} conline_t;
|
||||
|
||||
#define CONF_HIDDEN 1 /*do not show in the console list (unless active)*/
|
||||
#define CONF_NOTIFY 2 /*text printed to console also appears as notify lines*/
|
||||
#define CONF_NOTIFY_BOTTOM 4 /*align the bottom*/
|
||||
#define CONF_HIDDEN 1 /*do not show in the console list (unless active)*/
|
||||
#define CONF_NOTIFY 2 /*text printed to console also appears as notify lines*/
|
||||
#define CONF_NOTIFY_BOTTOM 4 /*align the bottom*/
|
||||
#define CONF_NOTIMES 8
|
||||
#define CONF_KEYFOCUSED 16
|
||||
typedef struct console_s
|
||||
{
|
||||
int id;
|
||||
char name[64];
|
||||
char title[64];
|
||||
int linecount;
|
||||
unsigned int flags;
|
||||
int notif_x;
|
||||
|
@ -132,6 +135,13 @@ typedef struct console_s
|
|||
void (*linebuffered) (struct console_s *con, char *line); //if present, called on enter, causes the standard console input to appear.
|
||||
void (*redirect) (struct console_s *con, int key); //if present, called every character.
|
||||
void *userdata;
|
||||
|
||||
conline_t *footerline; //temp text at the bottom of the console
|
||||
conline_t *selstartline, *selendline;
|
||||
unsigned int selstartoffset, selendoffset;
|
||||
int mousedown[3]; //x,y,buttons
|
||||
int mousecursor[2]; //x,y
|
||||
|
||||
struct console_s *next;
|
||||
} console_t;
|
||||
|
||||
|
@ -162,6 +172,8 @@ void Con_ForceActiveNow(void);
|
|||
void Con_Init (void);
|
||||
void Con_Shutdown (void);
|
||||
void Con_History_Load(void);
|
||||
struct font_s;
|
||||
void Con_DrawOneConsole(console_t *con, struct font_s *font, float fx, float fy, float fsx, float fsy);
|
||||
void Con_DrawConsole (int lines, qboolean noback);
|
||||
char *Con_CopyConsole(qboolean nomarkup);
|
||||
void Con_Print (char *txt);
|
||||
|
@ -173,7 +185,8 @@ void Con_Footerf(qboolean append, char *fmt, ...) LIKEPRINTF(2);
|
|||
void Con_Clear_f (void);
|
||||
void Con_DrawNotify (void);
|
||||
void Con_ClearNotify (void);
|
||||
void Con_ToggleConsole_f (void);
|
||||
void Con_ToggleConsole_f (void);//note: allows csqc to intercept the toggleconsole
|
||||
void Con_ToggleConsole_Force(void);
|
||||
|
||||
void Con_ExecuteLine(console_t *con, char *line); //takes normal console commands
|
||||
|
||||
|
|
|
@ -241,13 +241,13 @@ void FS_Manifest_Print(ftemanifest_t *man)
|
|||
char buffer[1024];
|
||||
int i, j;
|
||||
if (man->updateurl)
|
||||
Con_Printf("updateurl \"%s\"\n", COM_QuotedString(man->updateurl, buffer, sizeof(buffer)));
|
||||
Con_Printf("updateurl %s\n", COM_QuotedString(man->updateurl, buffer, sizeof(buffer)));
|
||||
if (man->installation)
|
||||
Con_Printf("game \"%s\"\n", COM_QuotedString(man->installation, buffer, sizeof(buffer)));
|
||||
Con_Printf("game %s\n", COM_QuotedString(man->installation, buffer, sizeof(buffer)));
|
||||
if (man->formalname)
|
||||
Con_Printf("name \"%s\"\n", COM_QuotedString(man->formalname, buffer, sizeof(buffer)));
|
||||
Con_Printf("name %s\n", COM_QuotedString(man->formalname, buffer, sizeof(buffer)));
|
||||
if (man->protocolname)
|
||||
Con_Printf("protocolname \"%s\"\n", COM_QuotedString(man->protocolname, buffer, sizeof(buffer)));
|
||||
Con_Printf("protocolname %s\n", COM_QuotedString(man->protocolname, buffer, sizeof(buffer)));
|
||||
if (man->defaultexec)
|
||||
Con_Printf("defaultexec %s\n", COM_QuotedString(man->defaultexec, buffer, sizeof(buffer)));
|
||||
|
||||
|
@ -256,9 +256,9 @@ void FS_Manifest_Print(ftemanifest_t *man)
|
|||
if (man->gamepath[i].path)
|
||||
{
|
||||
if (man->gamepath[i].base)
|
||||
Con_Printf("basegame \"%s\"\n", man->gamepath[i].path);
|
||||
Con_Printf("basegame %s\n", COM_QuotedString(man->gamepath[i].path, buffer, sizeof(buffer)));
|
||||
else
|
||||
Con_Printf("gamedir \"%s\"\n", man->gamepath[i].path);
|
||||
Con_Printf("gamedir %s\n", COM_QuotedString(man->gamepath[i].path, buffer, sizeof(buffer)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -267,12 +267,12 @@ void FS_Manifest_Print(ftemanifest_t *man)
|
|||
if (man->package[i].path)
|
||||
{
|
||||
if (man->package[i].crcknown)
|
||||
Con_Printf("package \"%s\" 0x%x", man->package[i].path, man->package[i].crc);
|
||||
Con_Printf("package %s 0x%x", COM_QuotedString(man->package[i].path, buffer, sizeof(buffer)), man->package[i].crc);
|
||||
else
|
||||
Con_Printf("package \"%s\" -", man->package[i].path);
|
||||
Con_Printf("package %s -", COM_QuotedString(man->package[i].path, buffer, sizeof(buffer)));
|
||||
for (j = 0; j < sizeof(man->package[i].mirrors) / sizeof(man->package[i].mirrors[0]); j++)
|
||||
if (man->package[i].mirrors[j])
|
||||
Con_Printf(" \"%s\"", man->package[i].mirrors[j]);
|
||||
Con_Printf(" \"%s\"", COM_QuotedString(man->package[i].mirrors[j], buffer, sizeof(buffer)));
|
||||
Con_Printf("\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -301,7 +301,7 @@ static int numleafbrushes;
|
|||
static int map_leafbrushes[MAX_Q2MAP_LEAFBRUSHES];
|
||||
|
||||
static int numcmodels;
|
||||
static cmodel_t map_cmodels[MAX_Q2MAP_MODELS];
|
||||
static cmodel_t *map_cmodels;
|
||||
|
||||
static int numbrushes;
|
||||
static q2cbrush_t *map_brushes;
|
||||
|
@ -1045,18 +1045,17 @@ qboolean CMod_LoadSubmodels (lump_t *l)
|
|||
Con_Printf (CON_ERROR "Map with no models\n");
|
||||
return false;
|
||||
}
|
||||
if (count > MAX_Q2MAP_MODELS)
|
||||
if (count > SANITY_MAX_Q2MAP_MODELS)
|
||||
{
|
||||
Con_Printf (CON_ERROR "Map has too many models\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
out = map_cmodels = ZG_Malloc(&loadmodel->memgroup, count * sizeof(*map_cmodels));
|
||||
numcmodels = count;
|
||||
|
||||
for ( i=0 ; i<count ; i++, in++, out++)
|
||||
for (i=0 ; i<count ; i++, in++, out++)
|
||||
{
|
||||
out = &map_cmodels[i];
|
||||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{ // spread the mins / maxs by a pixel
|
||||
out->mins[j] = LittleFloat (in->mins[j]) - 1;
|
||||
|
@ -1187,7 +1186,7 @@ texture_t *Mod_LoadWall(char *name, char *sname)
|
|||
if (wal != &replacementwal)
|
||||
BZ_Free(wal);
|
||||
|
||||
tex->shader = R_RegisterCustom (sname, Shader_DefaultBSPQ2, NULL);
|
||||
tex->shader = R_RegisterCustom (sname, SUF_LIGHTMAP, Shader_DefaultBSPQ2, NULL);
|
||||
R_BuildDefaultTexnums(&tn, tex->shader);
|
||||
|
||||
return tex;
|
||||
|
@ -1959,20 +1958,19 @@ qboolean CModQ3_LoadSubmodels (lump_t *l)
|
|||
Con_Printf (CON_ERROR "Map with no models\n");
|
||||
return false;
|
||||
}
|
||||
if (count > MAX_Q2MAP_MODELS)
|
||||
if (count > SANITY_MAX_Q2MAP_MODELS)
|
||||
{
|
||||
Con_Printf (CON_ERROR "Map has too many models\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
out = map_cmodels = ZG_Malloc(&loadmodel->memgroup, count * sizeof(*map_cmodels));
|
||||
numcmodels = count;
|
||||
|
||||
mapisq3 = true;
|
||||
|
||||
for ( i=0 ; i<count ; i++, in++, out++)
|
||||
for (i=0 ; i<count ; i++, in++, out++)
|
||||
{
|
||||
out = &map_cmodels[i];
|
||||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{ // spread the mins / maxs by a pixel
|
||||
out->mins[j] = LittleFloat (in->mins[j]) - 1;
|
||||
|
|
|
@ -5054,7 +5054,8 @@ struct rtpheader_s
|
|||
unsigned int ssrc;
|
||||
unsigned int csrc[1]; //sized according to cc
|
||||
};
|
||||
void S_Voip_RTP_Parse(unsigned short sequence, char *codec, unsigned char *data, unsigned int datalen);
|
||||
void S_Voip_RTP_Parse(unsigned short sequence, const char *codec, const unsigned char *data, unsigned int datalen);
|
||||
qboolean S_Voip_RTP_CodecOkay(char *codec);
|
||||
qboolean NET_RTP_Parse(void)
|
||||
{
|
||||
struct rtpheader_s *rtpheader = (void*)net_message.data;
|
||||
|
@ -5099,7 +5100,7 @@ qboolean NET_RTP_Active(void)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
qboolean NET_RTP_Transmit(unsigned int sequence, unsigned int timestamp, char *codec, char *cdata, int clength)
|
||||
qboolean NET_RTP_Transmit(unsigned int sequence, unsigned int timestamp, const char *codec, char *cdata, int clength)
|
||||
{
|
||||
sizebuf_t buf;
|
||||
char pdata[512];
|
||||
|
@ -5513,8 +5514,12 @@ qboolean QDECL ICE_Set(struct icestate_s *con, char *prop, char *value)
|
|||
int codec = atoi(prop+5);
|
||||
if (codec < 96 || codec > 127)
|
||||
return false;
|
||||
if (strcmp(value, "speex@8000") && strcmp(value, "speex@16000"))// && strcmp(value, "opus"))
|
||||
if (!S_Voip_RTP_CodecOkay(value))
|
||||
{
|
||||
Z_Free(con->codec[codec]);
|
||||
con->codec[codec] = NULL;
|
||||
return false;
|
||||
}
|
||||
codec -= 96;
|
||||
Z_Free(con->codec[codec]);
|
||||
con->codec[codec] = Z_StrDup(value);
|
||||
|
|
|
@ -1132,9 +1132,12 @@ void QCBUILTIN PF_hash_add (pubprogfuncs_t *prinst, struct globalvars_s *pr_glob
|
|||
pf_hashtab_t *tab = PF_hash_findtab(prinst, G_FLOAT(OFS_PARM0));
|
||||
char *name = PR_GetStringOfs(prinst, OFS_PARM1);
|
||||
void *data = G_VECTOR(OFS_PARM2);
|
||||
qboolean replace = (prinst->callargc>3)?G_FLOAT(OFS_PARM3):false;
|
||||
pf_hashentry_t *ent = NULL;
|
||||
if (tab)
|
||||
{
|
||||
if (replace)
|
||||
Hash_Remove(&tab->tab, name);
|
||||
if (tab->dupestrings)
|
||||
{
|
||||
char *value = PR_GetStringOfs(prinst, OFS_PARM2);
|
||||
|
@ -1820,7 +1823,7 @@ void QCBUILTIN PF_writetofile(pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
int buflen;
|
||||
|
||||
buflen = sizeof(buffer);
|
||||
entstr = prinst->saveent(prinst, buffer, &buflen, ed); //will save just one entities vars
|
||||
entstr = prinst->saveent(prinst, buffer, &buflen, sizeof(buffer), ed); //will save just one entities vars
|
||||
if (entstr)
|
||||
{
|
||||
PF_fwrite (prinst, fnum, entstr, buflen);
|
||||
|
@ -3911,7 +3914,7 @@ void QCBUILTIN PF_coredump (pubprogfuncs_t *prinst, struct globalvars_s *pr_glob
|
|||
{
|
||||
int size = 1024*1024*8;
|
||||
char *buffer = BZ_Malloc(size);
|
||||
prinst->save_ents(prinst, buffer, &size, 3);
|
||||
prinst->save_ents(prinst, buffer, &size, size, 3);
|
||||
COM_WriteFile("core.txt", buffer, size);
|
||||
BZ_Free(buffer);
|
||||
}
|
||||
|
@ -3920,7 +3923,7 @@ void QCBUILTIN PF_eprint (pubprogfuncs_t *prinst, struct globalvars_s *pr_global
|
|||
int size = 1024*1024;
|
||||
char *buffer = BZ_Malloc(size);
|
||||
char *buf;
|
||||
buf = prinst->saveent(prinst, buffer, &size, (struct edict_s*)G_WEDICT(prinst, OFS_PARM0));
|
||||
buf = prinst->saveent(prinst, buffer, &size, size, (struct edict_s*)G_WEDICT(prinst, OFS_PARM0));
|
||||
Con_Printf("Entity %i:\n%s\n", G_EDICTNUM(prinst, OFS_PARM0), buf);
|
||||
BZ_Free(buffer);
|
||||
}
|
||||
|
@ -4024,15 +4027,14 @@ void QCBUILTIN PF_calltimeofday (pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
}
|
||||
}
|
||||
|
||||
void QCBUILTIN PF_sprintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
void QCBUILTIN PF_sprintf_internal (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals, char *s, int firstarg, char *outbuf, int outbuflen)
|
||||
{
|
||||
const char *s, *s0;
|
||||
char outbuf[4096];
|
||||
char *o = outbuf, *end = outbuf + sizeof(outbuf), *err;
|
||||
int argpos = 1;
|
||||
const char *s0;
|
||||
char *o = outbuf, *end = outbuf + outbuflen, *err;
|
||||
int width, precision, thisarg, flags;
|
||||
char formatbuf[16];
|
||||
char *f;
|
||||
int argpos = firstarg;
|
||||
int isfloat;
|
||||
static int dummyivec[3] = {0, 0, 0};
|
||||
static float dummyvec[3] = {0, 0, 0};
|
||||
|
@ -4045,13 +4047,11 @@ void QCBUILTIN PF_sprintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globa
|
|||
|
||||
formatbuf[0] = '%';
|
||||
|
||||
s = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
|
||||
#define GETARG_FLOAT(a) (((a)>=1 && (a)<prinst->callargc) ? (G_FLOAT(OFS_PARM0 + 3 * (a))) : 0)
|
||||
#define GETARG_VECTOR(a) (((a)>=1 && (a)<prinst->callargc) ? (G_VECTOR(OFS_PARM0 + 3 * (a))) : dummyvec)
|
||||
#define GETARG_INT(a) (((a)>=1 && (a)<prinst->callargc) ? (G_INT(OFS_PARM0 + 3 * (a))) : 0)
|
||||
#define GETARG_INTVECTOR(a) (((a)>=1 && (a)<prinst->callargc) ? ((int*) G_VECTOR(OFS_PARM0 + 3 * (a))) : dummyivec)
|
||||
#define GETARG_STRING(a) (((a)>=1 && (a)<prinst->callargc) ? (PR_GetStringOfs(prinst, OFS_PARM0 + 3 * (a))) : "")
|
||||
#define GETARG_FLOAT(a) (((a)>=firstarg && (a)<prinst->callargc) ? (G_FLOAT(OFS_PARM0 + 3 * (a))) : 0)
|
||||
#define GETARG_VECTOR(a) (((a)>=firstarg && (a)<prinst->callargc) ? (G_VECTOR(OFS_PARM0 + 3 * (a))) : dummyvec)
|
||||
#define GETARG_INT(a) (((a)>=firstarg && (a)<prinst->callargc) ? (G_INT(OFS_PARM0 + 3 * (a))) : 0)
|
||||
#define GETARG_INTVECTOR(a) (((a)>=firstarg && (a)<prinst->callargc) ? ((int*) G_VECTOR(OFS_PARM0 + 3 * (a))) : dummyivec)
|
||||
#define GETARG_STRING(a) (((a)>=firstarg && (a)<prinst->callargc) ? (PR_GetStringOfs(prinst, OFS_PARM0 + 3 * (a))) : "")
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
@ -4086,7 +4086,7 @@ void QCBUILTIN PF_sprintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globa
|
|||
}
|
||||
if(*err == '$')
|
||||
{
|
||||
thisarg = width;
|
||||
thisarg = width + (firstarg-1);
|
||||
width = -1;
|
||||
s = err + 1;
|
||||
}
|
||||
|
@ -4356,7 +4356,12 @@ verbatim:
|
|||
}
|
||||
finished:
|
||||
*o = 0;
|
||||
}
|
||||
|
||||
void QCBUILTIN PF_sprintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
char outbuf[4096];
|
||||
PF_sprintf_internal(prinst, pr_globals, PR_GetStringOfs(prinst, OFS_PARM0), 1, outbuf, sizeof(outbuf));
|
||||
RETURN_TSTRING(outbuf);
|
||||
}
|
||||
|
||||
|
@ -4428,6 +4433,28 @@ void QCBUILTIN PF_putentityfieldstring (pubprogfuncs_t *prinst, struct globalvar
|
|||
G_FLOAT(OFS_RETURN) = 0;
|
||||
}
|
||||
|
||||
//must match ordering in Cmd_ExecuteString.
|
||||
void QCBUILTIN PF_checkcommand (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||
{
|
||||
char *str = PR_GetStringOfs(prinst, OFS_PARM0);
|
||||
//functions, aliases, cvars. in that order.
|
||||
if (Cmd_Exists(str))
|
||||
{
|
||||
G_FLOAT(OFS_RETURN) = 1;
|
||||
return;
|
||||
}
|
||||
if (Cmd_AliasExist(str, RESTRICT_INSECURE))
|
||||
{
|
||||
G_FLOAT(OFS_RETURN) = 2;
|
||||
return;
|
||||
}
|
||||
if (Cvar_FindVar(str))
|
||||
{
|
||||
G_FLOAT(OFS_RETURN) = 3;
|
||||
return;
|
||||
}
|
||||
G_FLOAT(OFS_RETURN) = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -4711,8 +4738,12 @@ lh_extension_t QSG_Extensions[] = {
|
|||
{"EXT_DIMENSION_GHOST"},
|
||||
{"FRIK_FILE", 11, NULL, {"stof", "fopen","fclose","fgets","fputs","strlen","strcat","substring","stov","strzone","strunzone"}},
|
||||
{"FTE_CALLTIMEOFDAY", 1, NULL, {"calltimeofday"}},
|
||||
{"FTE_CSQC_HALFLIFE_MODELS"}, //hl-specific skeletal model control
|
||||
{"FTE_CSQC_ALTCONSOLES_WIP", 4, NULL, {"con_getset", "con_print", "con_draw", "con_input"}},
|
||||
{"FTE_CSQC_BASEFRAME"}, //control for all skeletal models
|
||||
{"FTE_CSQC_HALFLIFE_MODELS"}, //hl-specific skeletal model control
|
||||
{"FTE_CSQC_SERVERBROWSER", 12, NULL, { "gethostcachevalue", "gethostcachestring", "resethostcachemasks", "sethostcachemaskstring", "sethostcachemasknumber",
|
||||
"resorthostcache", "sethostcachesort", "refreshhostcache", "gethostcachenumber", "gethostcacheindexforkey",
|
||||
"addwantedhostcachekey", "getextresponse"}}, //normally only available to the menu. this also adds them to csqc.
|
||||
{"FTE_ENT_SKIN_CONTENTS"}, //self.skin = CONTENTS_WATER; makes a brush entity into water. use -16 for a ladder.
|
||||
{"FTE_ENT_UNIQUESPAWNID"},
|
||||
{"FTE_EXTENDEDTEXTCODES"},
|
||||
|
@ -4734,6 +4765,7 @@ lh_extension_t QSG_Extensions[] = {
|
|||
#ifdef SVCHAT
|
||||
{"FTE_NPCCHAT", 1, NULL, {"chat"}}, //server looks at chat files. It automagically branches through calling qc functions as requested.
|
||||
#endif
|
||||
{"FTE_QC_CHECKCOMMAND", 1, NULL, {"checkcommand"}},
|
||||
{"FTE_QC_CHECKPVS", 1, NULL, {"checkpvs"}},
|
||||
{"FTE_QC_HASHTABLES", 6, NULL, {"hash_createtab", "hash_destroytab", "hash_add", "hash_get", "hash_delete", "hash_getkey"}},
|
||||
{"FTE_QC_MATCHCLIENTNAME", 1, NULL, {"matchclientname"}},
|
||||
|
|
|
@ -130,6 +130,7 @@ void QCBUILTIN PF_atan (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
|||
void QCBUILTIN PF_atan2 (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_tan (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_localcmd (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_sprintf_internal (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals, char *s, int firstarg, char *outbuf, int outbuflen);
|
||||
void QCBUILTIN PF_sprintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_random (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_fclose (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
|
@ -177,6 +178,7 @@ void QCBUILTIN PF_entityfieldname (pubprogfuncs_t *prinst, struct globalvars_s *
|
|||
void QCBUILTIN PF_entityfieldtype (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_getentityfieldstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_putentityfieldstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_checkcommand (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
|
||||
|
||||
void QCBUILTIN PF_getsurfacenumpoints(pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
|
@ -296,7 +298,11 @@ void QCBUILTIN PF_num_for_edict (pubprogfuncs_t *prinst, struct globalvars_s *pr
|
|||
void QCBUILTIN PF_cvar_defstring (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_cvar_description (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
|
||||
//these functions are from pr_menu.dat
|
||||
//these functions are from pr_menu.c
|
||||
void QCBUILTIN PF_SubConGetSet (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_SubConPrintf (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_SubConDraw (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_SubConInput (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_CL_is_cached_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_CL_precache_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
void QCBUILTIN PF_CL_free_pic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals);
|
||||
|
@ -576,11 +582,12 @@ enum lightfield_e
|
|||
enum csqc_input_event
|
||||
{
|
||||
/*devid is the player id (on android, its the multitouch id and is always present even in single player)*/
|
||||
CSIE_KEYDOWN = 0, /*syscode, unicode, devid*/
|
||||
CSIE_KEYUP = 1, /*syscode, unicode, devid*/
|
||||
CSIE_MOUSEDELTA = 2, /*x, y, devid*/
|
||||
CSIE_MOUSEABS = 3, /*x, y, devid*/
|
||||
CSIE_ACCELEROMETER = 4 /*x, y, z*/
|
||||
CSIE_KEYDOWN = 0, /*syscode, unicode, devid the two codes are not both guarenteed to be set at the same time, and may happen as separate events*/
|
||||
CSIE_KEYUP = 1, /*syscode, unicode, devid as keydown, unicode up events are not guarenteed*/
|
||||
CSIE_MOUSEDELTA = 2, /*x, y, devid mouse motion. x+y are relative*/
|
||||
CSIE_MOUSEABS = 3, /*x, y, devid */
|
||||
CSIE_ACCELEROMETER = 4, /*x, y, z*/
|
||||
CSIE_FOCUS = 5, /*mouse, key, devid. if has, the game window has focus. (true/false/-1)*/
|
||||
};
|
||||
|
||||
enum terrainedit_e
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
SmallerTypeCheck="true"
|
||||
RuntimeLibrary="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
|
|
|
@ -257,6 +257,7 @@ Global
|
|||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLDebug|x64.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|Win32.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|Win32.Build.0 = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.GLRelease|x64.ActiveCfg = Release|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|Win32.ActiveCfg = Debug|Win32
|
||||
{4877586B-E85B-4DF8-BCCE-59D31514D240}.MDebug|x64.ActiveCfg = Release|Win32
|
||||
|
|
|
@ -430,7 +430,7 @@ static shader_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum, e
|
|||
{
|
||||
int i, j;
|
||||
unsigned translate32[256];
|
||||
static unsigned pixels[512*512];
|
||||
static unsigned pixels[512*512]; //FIXME: too big for stack, so lets just chuck it in the bss, yay! because that sounds like a good idea! not.
|
||||
unsigned *out;
|
||||
unsigned frac, fracstep;
|
||||
|
||||
|
@ -1842,7 +1842,7 @@ static void R_Sprite_GenerateBatch(entity_t *e, batch_t **batches, void (*drawfu
|
|||
{
|
||||
shader = e->forcedshader;
|
||||
if (!shader)
|
||||
shader = R_RegisterShader("q2beam",
|
||||
shader = R_RegisterShader("q2beam", SUF_NONE,
|
||||
"{\n"
|
||||
"{\n"
|
||||
"map $whiteimage\n"
|
||||
|
|
|
@ -3163,7 +3163,7 @@ void GLBE_SelectMode(backendmode_t mode)
|
|||
case BEM_CREPUSCULAR:
|
||||
if (!shaderstate.crepopaqueshader)
|
||||
{
|
||||
shaderstate.crepopaqueshader = R_RegisterShader("crepuscular_opaque",
|
||||
shaderstate.crepopaqueshader = R_RegisterShader("crepuscular_opaque", SUF_NONE,
|
||||
"{\n"
|
||||
"program crepuscular_opaque\n"
|
||||
"}\n"
|
||||
|
@ -3171,7 +3171,7 @@ void GLBE_SelectMode(backendmode_t mode)
|
|||
}
|
||||
if (!shaderstate.crepskyshader)
|
||||
{
|
||||
shaderstate.crepskyshader = R_RegisterShader("crepuscular_sky",
|
||||
shaderstate.crepskyshader = R_RegisterShader("crepuscular_sky", SUF_NONE,
|
||||
"{\n"
|
||||
"program crepuscular_sky\n"
|
||||
"{\n"
|
||||
|
@ -3254,7 +3254,7 @@ static qboolean GLBE_RegisterLightShader(int mode)
|
|||
(mode & (1u<<LSHADER_CUBE))?"#CUBE":"");
|
||||
|
||||
shaderstate.inited_shader_light[mode] = true;
|
||||
shaderstate.shader_light[mode] = R_RegisterCustom(name, Shader_LightPass, NULL);
|
||||
shaderstate.shader_light[mode] = R_RegisterCustom(name, SUF_NONE, Shader_LightPass, NULL);
|
||||
|
||||
//make sure it has a program and forget it if it doesn't, to save a compare.
|
||||
if (!shaderstate.shader_light[mode] || !shaderstate.shader_light[mode]->prog)
|
||||
|
@ -4334,7 +4334,7 @@ void GLBE_DrawLightPrePass(qbyte *vis)
|
|||
if (!shaderstate.initeddepthnorm)
|
||||
{
|
||||
shaderstate.initeddepthnorm = true;
|
||||
shaderstate.depthnormshader = R_RegisterShader("lpp_depthnorm",
|
||||
shaderstate.depthnormshader = R_RegisterShader("lpp_depthnorm", SUF_NONE,
|
||||
"{\n"
|
||||
"program lpp_depthnorm\n"
|
||||
"{\n"
|
||||
|
|
|
@ -124,7 +124,7 @@ static void R_SetupBloomTextures(int w, int h)
|
|||
}
|
||||
|
||||
|
||||
bloomfilter = R_RegisterShader("bloom_filter",
|
||||
bloomfilter = R_RegisterShader("bloom_filter", SUF_NONE,
|
||||
"{\n"
|
||||
"cull none\n"
|
||||
"program bloom_filter\n"
|
||||
|
@ -132,7 +132,7 @@ static void R_SetupBloomTextures(int w, int h)
|
|||
"map $sourcecolour\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
bloomrescale = R_RegisterShader("bloom_rescale",
|
||||
bloomrescale = R_RegisterShader("bloom_rescale", SUF_NONE,
|
||||
"{\n"
|
||||
"cull none\n"
|
||||
"program default2d\n"
|
||||
|
@ -140,7 +140,7 @@ static void R_SetupBloomTextures(int w, int h)
|
|||
"map $sourcecolour\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
bloomblur = R_RegisterShader("bloom_blur",
|
||||
bloomblur = R_RegisterShader("bloom_blur", SUF_NONE,
|
||||
"{\n"
|
||||
"cull none\n"
|
||||
"program bloom_blur\n"
|
||||
|
@ -148,7 +148,7 @@ static void R_SetupBloomTextures(int w, int h)
|
|||
"map $sourcecolour\n"
|
||||
"}\n"
|
||||
"}\n");
|
||||
bloomfinal = R_RegisterShader("bloom_final",
|
||||
bloomfinal = R_RegisterShader("bloom_final", SUF_NONE,
|
||||
"{\n"
|
||||
"cull none\n"
|
||||
"program bloom_final\n"
|
||||
|
|
|
@ -30,11 +30,11 @@ mpic_t *R2D_SafeCachePic (char *path);
|
|||
mpic_t *R2D_SafePicFromWad (char *name);
|
||||
void R2D_ImageColours(float r, float g, float b, float a);
|
||||
void R2D_Image(float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic);
|
||||
void R2D_ScalePic (int x, int y, int width, int height, mpic_t *pic);
|
||||
void R2D_SubPic(int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
|
||||
void R2D_ScalePic (float x, float y, float width, float height, mpic_t *pic);
|
||||
void R2D_SubPic(float x, float y, float width, float height, mpic_t *pic, float srcx, float srcy, float srcwidth, float srcheight);
|
||||
void R2D_ConsoleBackground (int firstline, int lastline, qboolean forceopaque);
|
||||
void R2D_EditorBackground (void);
|
||||
void R2D_TileClear (int x, int y, int w, int h);
|
||||
void R2D_TileClear (float x, float y, float w, float h);
|
||||
void R2D_FadeScreen (void);
|
||||
void R2D_Init(void);
|
||||
void R2D_Shutdown(void);
|
||||
|
|
|
@ -265,7 +265,7 @@ void Font_Init(void)
|
|||
TEXASSIGN(fontplanes.texnum[i], R_AllocNewTexture("***fontplane***", PLANEWIDTH, PLANEHEIGHT, IF_UIPIC|IF_NEAREST|IF_NOPICMIP|IF_NOMIPMAP|IF_NOGAMMA));
|
||||
}
|
||||
|
||||
fontplanes.shader = R_RegisterShader("ftefont",
|
||||
fontplanes.shader = R_RegisterShader("ftefont", SUF_NONE,
|
||||
"{\n"
|
||||
"if $nofixed\n"
|
||||
"program default2d\n"
|
||||
|
@ -280,7 +280,7 @@ void Font_Init(void)
|
|||
"}\n"
|
||||
);
|
||||
|
||||
fontplanes.backshader = R_RegisterShader("ftefontback",
|
||||
fontplanes.backshader = R_RegisterShader("ftefontback", SUF_NONE,
|
||||
"{\n"
|
||||
"nomipmaps\n"
|
||||
"{\n"
|
||||
|
|
|
@ -3241,9 +3241,9 @@ void Terr_FinishTerrain(heightmap_t *hm, char *shadername, char *skyname)
|
|||
#ifndef SERVERONLY
|
||||
if (qrenderer != QR_NONE)
|
||||
{
|
||||
hm->skyshader = R_RegisterCustom(va("skybox_%s", skyname), Shader_DefaultSkybox, NULL);
|
||||
hm->skyshader = R_RegisterCustom(va("skybox_%s", skyname), SUF_NONE, Shader_DefaultSkybox, NULL);
|
||||
if (hm->tiled)
|
||||
hm->shader = R_RegisterShader("terraintileshader",
|
||||
hm->shader = R_RegisterShader("terraintileshader", SUF_NONE,
|
||||
"{\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
|
@ -3251,7 +3251,7 @@ void Terr_FinishTerrain(heightmap_t *hm, char *shadername, char *skyname)
|
|||
"}\n"
|
||||
);
|
||||
else
|
||||
hm->shader = R_RegisterShader(shadername,
|
||||
hm->shader = R_RegisterShader(shadername, SUF_LIGHTMAP,
|
||||
"{\n"
|
||||
"{\n"
|
||||
"map $diffuse\n"
|
||||
|
@ -3276,7 +3276,7 @@ void Terr_FinishTerrain(heightmap_t *hm, char *shadername, char *skyname)
|
|||
);
|
||||
|
||||
|
||||
hm->watershader = R_RegisterCustom ("warp/terrain", Shader_DefaultBSPQ2, NULL);
|
||||
hm->watershader = R_RegisterCustom ("warp/terrain", SUF_NONE, Shader_DefaultBSPQ2, NULL);
|
||||
if (!TEXVALID(hm->watershader->defaulttextures.base))
|
||||
hm->watershader->defaulttextures.base = R_LoadHiResTexture("terwater", NULL, IF_NOALPHA);
|
||||
if (!TEXVALID(hm->watershader->defaulttextures.bump))
|
||||
|
|
|
@ -207,10 +207,10 @@ void Mod_BlockTextureColour_f (void)
|
|||
|
||||
sprintf(texname, "8*8_%i_%i_%i", (int)((char *)&rgba)[0], (int)((char *)&rgba)[1], (int)((char *)&rgba)[2]);
|
||||
|
||||
s = R_RegisterCustom(Cmd_Argv(2), NULL, NULL);
|
||||
s = R_RegisterCustom(Cmd_Argv(2), SUF_LIGHTMAP, NULL, NULL);
|
||||
if (!s)
|
||||
{
|
||||
s = R_RegisterCustom (texname, Shader_DefaultBSPQ1, NULL);
|
||||
s = R_RegisterCustom (texname, SUF_LIGHTMAP, Shader_DefaultBSPQ1, NULL);
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(colour)/sizeof(colour[0]); i++)
|
||||
|
@ -1196,19 +1196,19 @@ void Mod_FinishTexture(texture_t *tx, texnums_t tn)
|
|||
char *star;
|
||||
/*skies? just replace with the override sky*/
|
||||
if (!strncmp(tx->name, "sky", 3) && *cl.skyname)
|
||||
tx->shader = R_RegisterCustom (va("skybox_%s", cl.skyname), Shader_DefaultSkybox, NULL); //just load the regular name.
|
||||
tx->shader = R_RegisterCustom (va("skybox_%s", cl.skyname), SUF_NONE, Shader_DefaultSkybox, NULL); //just load the regular name.
|
||||
//find the *
|
||||
else if (!*gl_shadeq1_name.string || !strcmp(gl_shadeq1_name.string, "*"))
|
||||
tx->shader = R_RegisterCustom (tx->name, Shader_DefaultBSPQ1, NULL); //just load the regular name.
|
||||
tx->shader = R_RegisterCustom (tx->name, SUF_LIGHTMAP, Shader_DefaultBSPQ1, NULL); //just load the regular name.
|
||||
else if (!(star = strchr(gl_shadeq1_name.string, '*')) || (strlen(gl_shadeq1_name.string)+strlen(tx->name)+1>=sizeof(altname))) //it's got to fit.
|
||||
tx->shader = R_RegisterCustom (gl_shadeq1_name.string, Shader_DefaultBSPQ1, NULL);
|
||||
tx->shader = R_RegisterCustom (gl_shadeq1_name.string, SUF_LIGHTMAP, Shader_DefaultBSPQ1, NULL);
|
||||
else
|
||||
{
|
||||
strncpy(altname, gl_shadeq1_name.string, star-gl_shadeq1_name.string); //copy the left
|
||||
altname[star-gl_shadeq1_name.string] = '\0';
|
||||
strcat(altname, tx->name); //insert the *
|
||||
strcat(altname, star+1); //add any final text.
|
||||
tx->shader = R_RegisterCustom (altname, Shader_DefaultBSPQ1, NULL);
|
||||
tx->shader = R_RegisterCustom (altname, SUF_LIGHTMAP, Shader_DefaultBSPQ1, NULL);
|
||||
}
|
||||
|
||||
R_BuildDefaultTexnums(&tn, tx->shader);
|
||||
|
@ -4334,7 +4334,7 @@ static void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int fra
|
|||
|
||||
Q_strncpyz(name, loadmodel->name, sizeof(name));
|
||||
Q_strncatz(name, va("_%i.tga", framenum), sizeof(name));
|
||||
pspriteframe->shader = R_RegisterShader(name,
|
||||
pspriteframe->shader = R_RegisterShader(name, SUF_NONE,
|
||||
"{\n"
|
||||
"if gl_blendsprites\n"
|
||||
"program defaultsprite\n"
|
||||
|
@ -4734,7 +4734,7 @@ static void LoadDoomSpriteFrame(char *imagename, mspriteframedesc_t *pdesc, int
|
|||
}
|
||||
}
|
||||
|
||||
pframe->shader = R_RegisterShader(imagename,
|
||||
pframe->shader = R_RegisterShader(imagename, SUF_NONE,
|
||||
"{\n{\nmap $diffuse\nblendfunc blend\n}\n}\n");
|
||||
pframe->shader->defaulttextures.base = R_LoadTexture8Pal24(imagename, header->width, header->height, image, palette, IF_CLAMP);
|
||||
R_BuildDefaultTexnums(&pframe->shader->defaulttextures, pframe->shader);
|
||||
|
|
|
@ -171,7 +171,7 @@ void R_FrameTimeGraph (int frametime)
|
|||
void R_NetgraphInit(void)
|
||||
{
|
||||
TEXASSIGN(netgraphtexture, R_AllocNewTexture("***netgraph***", NET_TIMINGS, NET_GRAPHHEIGHT, IF_UIPIC|IF_NOMIPMAP));
|
||||
netgraphshader = R_RegisterShader("netgraph",
|
||||
netgraphshader = R_RegisterShader("netgraph", SUF_NONE,
|
||||
"{\n"
|
||||
"program default2d\n"
|
||||
"{\n"
|
||||
|
|
|
@ -186,7 +186,7 @@ void R_InitFlashblends(void)
|
|||
|
||||
R_GenerateFlashblendTexture();
|
||||
|
||||
flashblend_shader = R_RegisterShader("flashblend",
|
||||
flashblend_shader = R_RegisterShader("flashblend", SUF_NONE,
|
||||
"{\n"
|
||||
"program defaultadditivesprite\n"
|
||||
"{\n"
|
||||
|
@ -356,7 +356,7 @@ void R_GenDlightBatches(batch_t *batches[])
|
|||
dlight_t *l;
|
||||
batch_t *b;
|
||||
if (!lpplight_shader)
|
||||
lpplight_shader = R_RegisterShader("lpp_light",
|
||||
lpplight_shader = R_RegisterShader("lpp_light", SUF_NONE,
|
||||
"{\n"
|
||||
"program lpp_light\n"
|
||||
"{\n"
|
||||
|
|
|
@ -108,7 +108,7 @@ void GL_InitSceneProcessingShaders_WaterWarp (void)
|
|||
scenepp_waterwarp = NULL;
|
||||
if (gl_config.arb_shader_objects)
|
||||
{
|
||||
scenepp_waterwarp = R_RegisterShader("waterwarp",
|
||||
scenepp_waterwarp = R_RegisterShader("waterwarp", SUF_NONE,
|
||||
"{\n"
|
||||
"program underwaterwarp\n"
|
||||
"{\n"
|
||||
|
@ -1107,7 +1107,7 @@ static void R_RenderMotionBlur(void)
|
|||
vt *= gl_motionblurscale.value;
|
||||
|
||||
//render using our texture
|
||||
shader = R_RegisterShader("postproc_motionblur",
|
||||
shader = R_RegisterShader("postproc_motionblur", SUF_NONE,
|
||||
"{\n"
|
||||
"program default2d\n"
|
||||
"{\n"
|
||||
|
@ -1158,7 +1158,7 @@ qboolean R_RenderScene_Cubemap(void)
|
|||
facemask = 0;
|
||||
if (ffov.value < 0)
|
||||
{
|
||||
shader = R_RegisterShader("postproc_panorama",
|
||||
shader = R_RegisterShader("postproc_panorama", SUF_NONE,
|
||||
"{\n"
|
||||
"program postproc_panorama\n"
|
||||
"{\n"
|
||||
|
@ -1178,7 +1178,7 @@ qboolean R_RenderScene_Cubemap(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
shader = R_RegisterShader("postproc_fisheye",
|
||||
shader = R_RegisterShader("postproc_fisheye", SUF_NONE,
|
||||
"{\n"
|
||||
"program postproc_fisheye\n"
|
||||
"{\n"
|
||||
|
@ -1415,7 +1415,7 @@ void GLR_RenderView (void)
|
|||
|
||||
if (*r_postprocshader.string)
|
||||
{
|
||||
shader_t *postproc = R_RegisterCustom(r_postprocshader.string, NULL, NULL);
|
||||
shader_t *postproc = R_RegisterCustom(r_postprocshader.string, SUF_NONE, NULL, NULL);
|
||||
if (postproc)
|
||||
{
|
||||
R2D_ScalePic(0, 0, vid.width, vid.height, postproc);
|
||||
|
|
|
@ -3163,6 +3163,7 @@ void Shader_Reset(shader_t *s)
|
|||
texnums_t dt = s->defaulttextures;
|
||||
int w = s->width;
|
||||
int h = s->height;
|
||||
unsigned int uf = s->usageflags;
|
||||
Q_strncpyz(name, s->name, sizeof(name));
|
||||
s->genargs = NULL;
|
||||
Shader_Free(s);
|
||||
|
@ -3173,6 +3174,7 @@ void Shader_Reset(shader_t *s)
|
|||
s->defaulttextures = dt;
|
||||
s->generator = defaultgen;
|
||||
s->genargs = genargs;
|
||||
s->usageflags = uf;
|
||||
s->uses = uses;
|
||||
Q_strncpyz(s->name, name, sizeof(s->name));
|
||||
Hash_Add(&shader_active_hash, s->name, s, &s->bucket);
|
||||
|
@ -3731,7 +3733,7 @@ void Shader_Finish (shader_t *s)
|
|||
s->sort = SHADER_SORT_DECAL;
|
||||
}
|
||||
|
||||
if (r_vertexlight.value && !s->prog)
|
||||
if ((r_vertexlight.value || !(s->flags & SUF_LIGHTMAP)) && !s->prog)
|
||||
{
|
||||
// do we have a lightmap pass?
|
||||
pass = s->passes;
|
||||
|
@ -4770,6 +4772,9 @@ qboolean Shader_ReadShaderTerms(shader_t *s, char **shadersource, int parsemode,
|
|||
#define COND_IGNOREPARENT 2
|
||||
#define COND_ALLOWELSE 4
|
||||
|
||||
if (!shadersource)
|
||||
return false;
|
||||
|
||||
token = COM_ParseExt (shadersource, true, true);
|
||||
|
||||
if ( !token[0] )
|
||||
|
@ -4933,7 +4938,7 @@ void R_UnloadShader(shader_t *shader)
|
|||
if (shader->uses-- == 1)
|
||||
Shader_Free(shader);
|
||||
}
|
||||
static int R_LoadShader ( char *name, shader_gen_t *defaultgen, const char *genargs)
|
||||
static int R_LoadShader (char *name, unsigned int usageflags, shader_gen_t *defaultgen, const char *genargs)
|
||||
{
|
||||
int i, f = -1;
|
||||
char shortname[MAX_QPATH];
|
||||
|
@ -4956,11 +4961,18 @@ static int R_LoadShader ( char *name, shader_gen_t *defaultgen, const char *gena
|
|||
|
||||
// check the hash first
|
||||
s = Hash_Get(&shader_active_hash, shortname);
|
||||
if (s)
|
||||
while (s)
|
||||
{
|
||||
i = s - r_shaders;
|
||||
r_shaders[i].uses++;
|
||||
return i;
|
||||
//make sure the same texture can be used as either a lightmap or vertexlit shader
|
||||
//if it has an explicit shader overriding it then that still takes precidence. we might just have multiple copies of it.
|
||||
//q3 has a separate (internal) shader for every lightmap.
|
||||
if (!defaultgen || (s->generator == defaultgen && !s->genargs == !genargs && (!genargs || !strcmp(s->genargs, genargs))))
|
||||
{
|
||||
i = s - r_shaders;
|
||||
r_shaders[i].uses++;
|
||||
return i;
|
||||
}
|
||||
s = Hash_GetNext(&shader_active_hash, shortname, s);
|
||||
}
|
||||
|
||||
// not loaded, find a free slot
|
||||
|
@ -4985,6 +4997,7 @@ static int R_LoadShader ( char *name, shader_gen_t *defaultgen, const char *gena
|
|||
s = &r_shaders[f];
|
||||
|
||||
Q_strncpyz(s->name, shortname, sizeof(s->name));
|
||||
s->usageflags = usageflags;
|
||||
s->generator = defaultgen;
|
||||
if (genargs)
|
||||
s->genargs = strdup(genargs);
|
||||
|
@ -5196,7 +5209,7 @@ shader_t *R_RegisterPic (char *name)
|
|||
image_width = 64;
|
||||
image_height = 64;
|
||||
|
||||
shader = &r_shaders[R_LoadShader (name, Shader_Default2D, NULL)];
|
||||
shader = &r_shaders[R_LoadShader (name, SUF_2D, Shader_Default2D, NULL)];
|
||||
|
||||
/*worth a try*/
|
||||
if (shader->width <= 0)
|
||||
|
@ -5212,24 +5225,24 @@ shader_t *R_RegisterPic (char *name)
|
|||
return shader;
|
||||
}
|
||||
|
||||
shader_t *R_RegisterShader (char *name, const char *shaderscript)
|
||||
shader_t *R_RegisterShader (char *name, unsigned int usageflags, const char *shaderscript)
|
||||
{
|
||||
return &r_shaders[R_LoadShader (name, Shader_DefaultScript, shaderscript)];
|
||||
return &r_shaders[R_LoadShader (name, usageflags, Shader_DefaultScript, shaderscript)];
|
||||
}
|
||||
|
||||
shader_t *R_RegisterShader_Lightmap (char *name)
|
||||
{
|
||||
return &r_shaders[R_LoadShader (name, Shader_DefaultBSPLM, NULL)];
|
||||
return &r_shaders[R_LoadShader (name, SUF_LIGHTMAP, Shader_DefaultBSPLM, NULL)];
|
||||
}
|
||||
|
||||
shader_t *R_RegisterShader_Vertex (char *name)
|
||||
{
|
||||
return &r_shaders[R_LoadShader (name, Shader_DefaultBSPVertex, NULL)];
|
||||
return &r_shaders[R_LoadShader (name, 0, Shader_DefaultBSPVertex, NULL)];
|
||||
}
|
||||
|
||||
shader_t *R_RegisterShader_Flare (char *name)
|
||||
{
|
||||
return &r_shaders[R_LoadShader (name, Shader_DefaultBSPFlare, NULL)];
|
||||
return &r_shaders[R_LoadShader (name, 0, Shader_DefaultBSPFlare, NULL)];
|
||||
}
|
||||
|
||||
shader_t *R_RegisterSkin (char *shadername, char *modname)
|
||||
|
@ -5244,7 +5257,7 @@ shader_t *R_RegisterSkin (char *shadername, char *modname)
|
|||
memcpy(newsname, modname, b - modname);
|
||||
memcpy(newsname + (b-modname), shadername, strlen(shadername)+1);
|
||||
/*if the specified shader does not contain a path, try and load one relative to the name of the model*/
|
||||
shader = &r_shaders[R_LoadShader (newsname, Shader_DefaultSkin, NULL)];
|
||||
shader = &r_shaders[R_LoadShader (newsname, 0, Shader_DefaultSkin, NULL)];
|
||||
|
||||
R_BuildDefaultTexnums(&shader->defaulttextures, shader);
|
||||
|
||||
|
@ -5253,13 +5266,13 @@ shader_t *R_RegisterSkin (char *shadername, char *modname)
|
|||
return shader;
|
||||
}
|
||||
}
|
||||
shader = &r_shaders[R_LoadShader (shadername, Shader_DefaultSkin, NULL)];
|
||||
shader = &r_shaders[R_LoadShader (shadername, 0, Shader_DefaultSkin, NULL)];
|
||||
return shader;
|
||||
}
|
||||
shader_t *R_RegisterCustom (char *name, shader_gen_t *defaultgen, const void *args)
|
||||
shader_t *R_RegisterCustom (char *name, unsigned int usageflags, shader_gen_t *defaultgen, const void *args)
|
||||
{
|
||||
int i;
|
||||
i = R_LoadShader (name, defaultgen, args);
|
||||
i = R_LoadShader (name, usageflags, defaultgen, args);
|
||||
if (i < 0)
|
||||
return NULL;
|
||||
return &r_shaders[i];
|
||||
|
|
|
@ -2894,7 +2894,7 @@ void Sh_DrawCrepuscularLight(dlight_t *dl, float *colours)
|
|||
if (!crepuscular_texture_id.num)
|
||||
{
|
||||
/*FIXME: requires npot*/
|
||||
crepuscular_shader = R_RegisterShader("crepuscular_screen",
|
||||
crepuscular_shader = R_RegisterShader("crepuscular_screen", SUF_NONE,
|
||||
"{\n"
|
||||
"program crepuscular_rays\n"
|
||||
"{\n"
|
||||
|
|
|
@ -47,11 +47,11 @@ static shader_t *skyboxface;
|
|||
void R_SetSky(char *skyname)
|
||||
{
|
||||
if (*skyname)
|
||||
forcedskyshader = R_RegisterCustom(va("skybox_%s", skyname), Shader_DefaultSkybox, NULL);
|
||||
forcedskyshader = R_RegisterCustom(va("skybox_%s", skyname), SUF_NONE, Shader_DefaultSkybox, NULL);
|
||||
else
|
||||
forcedskyshader = NULL;
|
||||
|
||||
skyboxface = R_RegisterShader("skyboxface",
|
||||
skyboxface = R_RegisterShader("skyboxface", SUF_NONE,
|
||||
"{\n"
|
||||
"program default2d\n"
|
||||
"{\n"
|
||||
|
|
|
@ -431,6 +431,11 @@ typedef struct {
|
|||
struct shader_s
|
||||
{
|
||||
char name[MAX_QPATH];
|
||||
enum {
|
||||
SUF_NONE = 0,
|
||||
SUF_LIGHTMAP = 1<<0, //$lightmap passes are valid. otherwise collapsed to an rgbgen
|
||||
SUF_2D = 1<<1 //any loaded textures will obey 2d picmips rather than 3d picmips
|
||||
} usageflags; //
|
||||
int uses;
|
||||
int width;
|
||||
int height;
|
||||
|
@ -498,12 +503,12 @@ extern int be_maxpasses;
|
|||
|
||||
void R_UnloadShader(shader_t *shader);
|
||||
shader_t *R_RegisterPic (char *name);
|
||||
shader_t *R_RegisterShader (char *name, const char *shaderscript);
|
||||
shader_t *R_RegisterShader (char *name, unsigned int usageflags, const char *shaderscript);
|
||||
shader_t *R_RegisterShader_Lightmap (char *name);
|
||||
shader_t *R_RegisterShader_Vertex (char *name);
|
||||
shader_t *R_RegisterShader_Flare (char *name);
|
||||
shader_t *R_RegisterSkin (char *shadername, char *modname);
|
||||
shader_t *R_RegisterCustom (char *name, shader_gen_t *defaultgen, const void *args);
|
||||
shader_t *R_RegisterCustom (char *name, unsigned int usageflags, shader_gen_t *defaultgen, const void *args);
|
||||
void R_BuildDefaultTexnums(texnums_t *tn, shader_t *shader);
|
||||
|
||||
cin_t *R_ShaderGetCinematic(shader_t *s);
|
||||
|
|
|
@ -1231,6 +1231,18 @@ void NPP_NQWriteLong(int dest, long data) //replacement write func (nq to qw)
|
|||
NPP_NQWriteByte(dest, u.b[2]);
|
||||
NPP_NQWriteByte(dest, u.b[3]);
|
||||
}
|
||||
void NPP_NQWriteFloat(int dest, float data) //replacement write func (nq to qw)
|
||||
{
|
||||
union {
|
||||
qbyte b[4];
|
||||
float f;
|
||||
} u;
|
||||
u.f = LittleFloat(data);
|
||||
NPP_NQWriteByte(dest, u.b[0]);
|
||||
NPP_NQWriteByte(dest, u.b[1]);
|
||||
NPP_NQWriteByte(dest, u.b[2]);
|
||||
NPP_NQWriteByte(dest, u.b[3]);
|
||||
}
|
||||
void NPP_NQWriteAngle(int dest, float in) //replacement write func (nq to qw)
|
||||
{
|
||||
char data = (int)(in*256/360) & 255;
|
||||
|
|
|
@ -1115,7 +1115,7 @@ void PR_ApplyCompilation_f (void)
|
|||
}
|
||||
|
||||
Con_Printf("Saving state\n");
|
||||
s = PR_SaveEnts(svprogfuncs, NULL, &len, 1);
|
||||
s = PR_SaveEnts(svprogfuncs, NULL, &len, 0, 1);
|
||||
|
||||
|
||||
PR_Configure(svprogfuncs, pr_ssqc_memsize.ival, MAX_PROGS);
|
||||
|
@ -1174,6 +1174,7 @@ void PR_BreakPoint_f(void)
|
|||
else
|
||||
Con_Printf("Breakpoint has been cleared\n");
|
||||
|
||||
Cvar_Set(Cvar_FindVar("debugger"), "1");
|
||||
}
|
||||
void PR_WatchPoint_f(void)
|
||||
{
|
||||
|
@ -1209,6 +1210,8 @@ void PR_WatchPoint_f(void)
|
|||
else
|
||||
Con_Printf("Watchpoint cleared\n");
|
||||
pr_global_struct->self = oldself;
|
||||
|
||||
Cvar_Set(Cvar_FindVar("debugger"), "1");
|
||||
}
|
||||
|
||||
void PR_SSCoreDump_f(void)
|
||||
|
@ -1222,7 +1225,7 @@ void PR_SSCoreDump_f(void)
|
|||
{
|
||||
int size = 1024*1024*8;
|
||||
char *buffer = BZ_Malloc(size);
|
||||
svprogfuncs->save_ents(svprogfuncs, buffer, &size, 3);
|
||||
svprogfuncs->save_ents(svprogfuncs, buffer, &size, size, 3);
|
||||
COM_WriteFile("ssqccore.txt", buffer, size);
|
||||
BZ_Free(buffer);
|
||||
}
|
||||
|
@ -1881,7 +1884,7 @@ qboolean PR_UserCmd(char *s)
|
|||
|
||||
return false;
|
||||
}
|
||||
qboolean PR_ConsoleCmd(void)
|
||||
qboolean PR_ConsoleCmd(char *command)
|
||||
{
|
||||
globalvars_t *pr_globals;
|
||||
extern redirect_t sv_redirected;
|
||||
|
@ -1889,22 +1892,10 @@ qboolean PR_ConsoleCmd(void)
|
|||
if (Cmd_ExecLevel < cmd_gamecodelevel.value)
|
||||
return false;
|
||||
|
||||
#ifdef Q2SERVER
|
||||
if (ge)
|
||||
{ //server command
|
||||
if (!strcmp(Cmd_Argv(0), "sv"))
|
||||
{
|
||||
ge->ServerCommand();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (svprogfuncs)
|
||||
{
|
||||
pr_globals = PR_globals(svprogfuncs, PR_CURRENT);
|
||||
if (gfuncs.ConsoleCmd && pr_imitatemvdsv.value >= 0)
|
||||
if (gfuncs.ConsoleCmd)
|
||||
{
|
||||
if (sv_redirected != RD_OBLIVION)
|
||||
{
|
||||
|
@ -1912,6 +1903,7 @@ qboolean PR_ConsoleCmd(void)
|
|||
pr_global_struct->self = EDICT_TO_PROG(svprogfuncs, sv.world.edicts);
|
||||
}
|
||||
|
||||
G_INT(OFS_PARM0) = PR_TempString(svprogfuncs, command);
|
||||
PR_ExecuteProgram (svprogfuncs, gfuncs.ConsoleCmd);
|
||||
return (int) G_FLOAT(OFS_RETURN);
|
||||
}
|
||||
|
@ -4800,7 +4792,36 @@ void QCBUILTIN PF_WriteFloat (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
|
|||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
if (qc_nonetaccess.value)
|
||||
return;
|
||||
#ifdef SERVER_DEMO_PLAYBACK
|
||||
if (sv.demofile)
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (progstype == PROG_NQ || progstype == PROG_H2)
|
||||
{
|
||||
NPP_NQWriteFloat(dest, G_FLOAT(OFS_PARM1));
|
||||
return;
|
||||
}
|
||||
#ifdef NQPROT
|
||||
else
|
||||
{
|
||||
NPP_QWWriteFloat(dest, G_FLOAT(OFS_PARM1));
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (dest == MSG_ONE)
|
||||
{
|
||||
client_t *cl = Write_GetClient();
|
||||
if (!cl)
|
||||
return;
|
||||
ClientReliableCheckBlock(cl, 4);
|
||||
ClientReliableWrite_Float(cl, G_FLOAT(OFS_PARM1));
|
||||
}
|
||||
else
|
||||
MSG_WriteFloat (QWWriteDest(dest), G_FLOAT(OFS_PARM1));
|
||||
#endif
|
||||
}
|
||||
|
||||
void PF_WriteString_Internal (int target, char *str)
|
||||
|
@ -7712,7 +7733,7 @@ static void QCBUILTIN PF_sv_trailparticles(pubprogfuncs_t *prinst, struct global
|
|||
MSG_WriteCoord(&sv.nqmulticast, end[1]);
|
||||
MSG_WriteCoord(&sv.nqmulticast, end[2]);
|
||||
|
||||
SV_MulticastProtExt(start, MULTICAST_PHS, ~0, PEXT_CSQC, 0);
|
||||
SV_MulticastProtExt(start, MULTICAST_PHS, pr_global_struct->dimension_send, PEXT_CSQC, 0);
|
||||
#endif
|
||||
}
|
||||
//void(float effectnum, vector origin [, vector dir, float count]) pointparticles (EXT_CSQC)
|
||||
|
@ -7763,7 +7784,7 @@ static void QCBUILTIN PF_sv_pointparticles(pubprogfuncs_t *prinst, struct global
|
|||
MSG_WriteCoord(&sv.nqmulticast, vel[2]);
|
||||
MSG_WriteShort(&sv.nqmulticast, count);
|
||||
}
|
||||
SV_MulticastProtExt(org, MULTICAST_PHS, ~0, PEXT_CSQC, 0);
|
||||
SV_MulticastProtExt(org, MULTICAST_PHS, pr_global_struct->dimension_send, PEXT_CSQC, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -9100,7 +9121,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"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.")},
|
||||
{"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)", "QW: 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, 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.")},
|
||||
|
@ -9446,11 +9467,12 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
// {"cvar_setlatch", PF_cvar_setlatch, 0, 0, 0, 286, "void(string cvarname, optional string value)"},
|
||||
{"hash_createtab", PF_hash_createtab, 0, 0, 0, 287, D("float(float tabsize, float stringsonly)", "Creates a hash table object with at least 'tabsize' slots. stringsonly affects the behaviour of the other hash builtins. hash table with index 0 is a game-persistant table and will NEVER be returned by this builtin (except as an error return)")},
|
||||
{"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, float replace)", "Adds the given key with the given value to the table. stringsonly=1: the value MUST be a string type, and will be internally copied. stringsonly=0: the value can be any type including vectors with the single exception that temp strings are not supported if their scope doesn't last as long as the string table. Its always okay to pass temp strings for 'name' though.\nreplace=0: Multiple values may be added for a single key, they won't overwrite.\nreplace=1: previous values with this key will be discarded first.")},
|
||||
{"hash_add", PF_hash_add, 0, 0, 0, 289, D("void(float table, string name, __variant value, optional float replace)", "Adds the given key with the given value to the table. stringsonly=1: the value MUST be a string type, and will be internally copied. stringsonly=0: the value can be any type including vectors with the single exception that temp strings are not supported if their scope doesn't last as long as the string table. Its always okay to pass temp strings for 'name' though.\nreplace=0: Multiple values may be added for a single key, they won't overwrite.\nreplace=1: previous values with this key will be discarded first.")},
|
||||
{"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. If stringsonly=1, the return value will be in the form of a tempstring, otherwise it'll be the original value argument exactly as it was.")},
|
||||
{"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, so don't blindly increment the key index if you're removing all.")},
|
||||
{"hash_getcb", PF_hash_getcb, 0, 0, 0, 293, D("void(float table, void(string keyname, __variant val) callback, optional string name)", "For each item in the table that matches the name, call the callback. if name is omitted, will enumerate ALL keys.")},
|
||||
{"checkcommand", PF_checkcommand, 0, 0, 0, 294, D("float(string name)", "Checks to see if the supplied name is a valid command, cvar, or alias. Returns 0 if it does not exist.")},
|
||||
|
||||
|
||||
{"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)
|
||||
|
@ -9563,7 +9585,10 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
|||
{"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.")},
|
||||
|
||||
|
||||
{"con_getset", PF_Fixme, 0, 0, 0, 391, D("string(string conname, string field, optional string newvalue)", "Reads or sets a property from a console object. The old value is returned. Iterrate through consoles with the 'next' field.")},
|
||||
{"con_printf", PF_Fixme, 0, 0, 0, 392, D("void(string conname, string messagefmt, ...)", "Prints onto a named console.")},
|
||||
{"con_draw", PF_Fixme, 0, 0, 0, 393, D("void(string conname, vector pos, vector size, float fontsize)", "Draws the named console.")},
|
||||
{"con_input", PF_Fixme, 0, 0, 0, 394, D("float(string conname, float inevtype, float parama, float paramb, float paramc)", "Forwards input events to the named console. Mouse updates should be absolute only.")},
|
||||
//end fte extras
|
||||
|
||||
//DP extras
|
||||
|
@ -10090,11 +10115,11 @@ int pr_numbuiltins = sizeof(pr_builtin)/sizeof(pr_builtin[0]);
|
|||
|
||||
void PR_RegisterFields(void) //it's just easier to do it this way.
|
||||
{
|
||||
#define comfieldfloat(name) PR_RegisterFieldVar(svprogfuncs, ev_float, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name) PR_RegisterFieldVar(svprogfuncs, ev_vector, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name) PR_RegisterFieldVar(svprogfuncs, ev_entity, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name) PR_RegisterFieldVar(svprogfuncs, ev_string, (((size_t)&((stdentvars_t*)0)->name==(size_t)&((stdentvars_t*)0)->message)?"_"#name:#name), (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr) PR_RegisterFieldVar(svprogfuncs, ev_function, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldfloat(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_float, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_vector, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_entity, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_string, (((size_t)&((stdentvars_t*)0)->name==(size_t)&((stdentvars_t*)0)->message)?"_"#name:#name), (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr,desc) PR_RegisterFieldVar(svprogfuncs, ev_function, #name, (size_t)&((stdentvars_t*)0)->name, -1);
|
||||
comqcfields
|
||||
#undef comfieldfloat
|
||||
#undef comfieldvector
|
||||
|
@ -10102,17 +10127,17 @@ comqcfields
|
|||
#undef comfieldstring
|
||||
#undef comfieldfunction
|
||||
#ifdef VM_Q1
|
||||
#define comfieldfloat(name) PR_RegisterFieldVar(svprogfuncs, ev_float, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name) PR_RegisterFieldVar(svprogfuncs, ev_vector, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name) PR_RegisterFieldVar(svprogfuncs, ev_entity, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name) PR_RegisterFieldVar(svprogfuncs, ev_string, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr) PR_RegisterFieldVar(svprogfuncs, ev_function, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldfloat(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_float, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldvector(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_vector, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldentity(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_entity, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldstring(name,desc) PR_RegisterFieldVar(svprogfuncs, ev_string, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#define comfieldfunction(name, typestr,desc) PR_RegisterFieldVar(svprogfuncs, ev_function, #name, sizeof(stdentvars_t) + (size_t)&((extentvars_t*)0)->name, -1);
|
||||
#else
|
||||
#define comfieldfloat(ssqcname) PR_RegisterFieldVar(svprogfuncs, ev_float, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldvector(ssqcname) PR_RegisterFieldVar(svprogfuncs, ev_vector, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldentity(ssqcname) PR_RegisterFieldVar(svprogfuncs, ev_entity, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldstring(ssqcname) PR_RegisterFieldVar(svprogfuncs, ev_string, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldfunction(ssqcname, typestr) PR_RegisterFieldVar(svprogfuncs, ev_function, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldfloat(ssqcname,desc) PR_RegisterFieldVar(svprogfuncs, ev_float, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldvector(ssqcname,desc) PR_RegisterFieldVar(svprogfuncs, ev_vector, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldentity(ssqcname,desc) PR_RegisterFieldVar(svprogfuncs, ev_entity, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldstring(ssqcname,desc) PR_RegisterFieldVar(svprogfuncs, ev_string, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#define comfieldfunction(ssqcname, typestr,desc) PR_RegisterFieldVar(svprogfuncs, ev_function, #ssqcname, (size_t)&((stdentvars_t*)0)->ssqcname, -1);
|
||||
#endif
|
||||
|
||||
comextqcfields
|
||||
|
@ -10139,7 +10164,7 @@ svextqcfields
|
|||
#define H2 16
|
||||
//mere flags
|
||||
#define FTE 32
|
||||
#define ALL (QW|NQ|CS|MENU)
|
||||
#define ALL (QW|NQ|H2|CS|MENU)
|
||||
#define CORE
|
||||
typedef struct
|
||||
{
|
||||
|
@ -10313,11 +10338,11 @@ void PR_DumpPlatform_f(void)
|
|||
{"noise3", ".string", QW|NQ},
|
||||
{"end_sys_fields", "void", QW|NQ|CS|MENU},
|
||||
|
||||
#define comfieldfloat(name) {#name, ".float", FL},
|
||||
#define comfieldvector(name) {#name, ".vector", FL},
|
||||
#define comfieldentity(name) {#name, ".entity", FL},
|
||||
#define comfieldstring(name) {#name, ".string", FL},
|
||||
#define comfieldfunction(name, typestr) {#name, typestr, FL},
|
||||
#define comfieldfloat(name,desc) {#name, ".float", FL, desc},
|
||||
#define comfieldvector(name,desc) {#name, ".vector", FL, desc},
|
||||
#define comfieldentity(name,desc) {#name, ".entity", FL, desc},
|
||||
#define comfieldstring(name,desc) {#name, ".string", FL, desc},
|
||||
#define comfieldfunction(name,typestr,desc) {#name, typestr, FL, desc},
|
||||
#define FL QW|NQ
|
||||
comqcfields
|
||||
#undef FL
|
||||
|
@ -10509,9 +10534,9 @@ void PR_DumpPlatform_f(void)
|
|||
{"FL_WATERJUMP", "const float", QW|NQ|CS, NULL, FL_WATERJUMP},
|
||||
{"FL_JUMPRELEASED", "const float", NQ|CS, NULL, FL_JUMPRELEASED},
|
||||
{"FL_FINDABLE_NONSOLID","const float", QW|NQ|CS, "Allows this entity to be found with findradius", FL_FINDABLE_NONSOLID},
|
||||
// {"FL_MOVECHAIN_ANGLE", "const float", QW|NQ, NULL, FL_MOVECHAIN_ANGLE},
|
||||
{"FL_MOVECHAIN_ANGLE", "const float", H2, NULL, FL_MOVECHAIN_ANGLE},
|
||||
{"FL_LAGGEDMOVE", "const float", QW|NQ, "Enables anti-lag on rockets etc.", FLQW_LAGGEDMOVE},
|
||||
// {"FL_CLASS_DEPENDENT", "const float", QW|NQ, NULL, FL_CLASS_DEPENDENT},
|
||||
{"FL_CLASS_DEPENDENT", "const float", H2, NULL, FL_CLASS_DEPENDENT},
|
||||
|
||||
{"MOVE_NORMAL", "const float", QW|NQ|CS, NULL, MOVE_NORMAL},
|
||||
{"MOVE_NOMONSTERS", "const float", QW|NQ|CS, NULL, MOVE_NOMONSTERS},
|
||||
|
@ -10625,6 +10650,7 @@ void PR_DumpPlatform_f(void)
|
|||
{"IE_MOUSEDELTA", "const float", CS, "Specifies that a mouse was moved (touch screens and tablets typically give IE_MOUSEABS events instead, use _windowed_mouse 0 to test code to cope with either). Second argument is the X displacement, third argument is the Y displacement. Fourth argument is which mouse or touch event triggered the event.", CSIE_MOUSEDELTA},
|
||||
{"IE_MOUSEABS", "const float", CS, "Specifies that a mouse cursor or touch event was moved to a specific location relative to the virtual screen space. Second argument is the new X position, third argument is the new Y position. Fourth argument is which mouse or touch event triggered the event.", CSIE_MOUSEABS},
|
||||
{"IE_ACCELEROMETER", "const float", CS, NULL, CSIE_ACCELEROMETER},
|
||||
{"IE_FOCUS", "const float", CS, "Specifies that input focus was given. parama says mouse focus, paramb says keyboard focus. If either are -1, then it is unchanged.", CSIE_FOCUS},
|
||||
|
||||
{"CLIENTTYPE_DISCONNECTED","const float", QW|NQ, NULL, CLIENTTYPE_DISCONNECTED},
|
||||
{"CLIENTTYPE_REAL", "const float", QW|NQ, NULL, CLIENTTYPE_REAL},
|
||||
|
@ -10764,8 +10790,18 @@ void PR_DumpPlatform_f(void)
|
|||
VFS_PRINTF(f, "#pragma warning enable F301 /*non-utf-8 strings*/\n");
|
||||
VFS_PRINTF(f, "#pragma warning enable F302 /*uninitialised locals*/\n");
|
||||
|
||||
if (targ&FTE)
|
||||
VFS_PRINTF(f, "#pragma target FTE\n");
|
||||
if ((targ&ALL) == H2)
|
||||
{
|
||||
if (targ&FTE)
|
||||
VFS_PRINTF(f, "#pragma target FTEH2\n");
|
||||
else
|
||||
VFS_PRINTF(f, "#pragma target H2\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targ&FTE)
|
||||
VFS_PRINTF(f, "#pragma target FTE\n");
|
||||
}
|
||||
if ((targ&ALL) == CS)
|
||||
VFS_PRINTF(f, "#ifndef CSQC\n"
|
||||
"#define CSQC\n"
|
||||
|
@ -11015,7 +11051,53 @@ void PR_DumpPlatform_f(void)
|
|||
case NQ|CS|MENU:
|
||||
VFS_PRINTF(f, "#if defined(CSQC) || defined(NQSSQC) || defined(MENU)\n");
|
||||
break;
|
||||
case H2:
|
||||
VFS_PRINTF(f, "#ifdef H2\n");
|
||||
break;
|
||||
case H2|QW:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(QWSSQC)\n");
|
||||
break;
|
||||
case H2|NQ:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(NQSSQC)\n");
|
||||
break;
|
||||
case H2|QW|NQ:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(SSQC)\n");
|
||||
break;
|
||||
case H2|CS:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(CSQC)\n");
|
||||
break;
|
||||
case H2|QW|CS:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(CSQC) || defined(QWSSQC)\n");
|
||||
break;
|
||||
case H2|NQ|CS:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(CSQC) || defined(NQSSQC)\n");
|
||||
break;
|
||||
case H2|NQ|CS|QW:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(CSQC) || defined(SSQC)\n");
|
||||
break;
|
||||
case H2|MENU:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(MENU)\n");
|
||||
break;
|
||||
case H2|QW|MENU:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(QWSSQC) || defined(MENU)\n");
|
||||
break;
|
||||
case H2|NQ|MENU:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(NQSSQC) || defined(MENU)\n");
|
||||
break;
|
||||
case H2|QW|NQ|MENU:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(SSQC) || defined(MENU)\n");
|
||||
break;
|
||||
case H2|CS|MENU:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(CSQC) || defined(MENU)\n");
|
||||
break;
|
||||
case H2|QW|CS|MENU:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(CSQC) || defined(QWSSQC) || defined(MENU)\n");
|
||||
break;
|
||||
case H2|NQ|CS|MENU:
|
||||
VFS_PRINTF(f, "#if defined(H2) || defined(CSQC) || defined(NQSSQC) || defined(MENU)\n");
|
||||
break;
|
||||
case ALL:
|
||||
VFS_PRINTF(f, "#if 1\n");
|
||||
break;
|
||||
default:
|
||||
VFS_PRINTF(f, "#if 0 //???\n");
|
||||
|
|
|
@ -108,193 +108,193 @@ and the extension fields are added on the end and can have extra vm-specific stu
|
|||
*/
|
||||
/*DO NOT ADD TO THIS STRUCTURE (base-qw-compat for q1qvm)*/
|
||||
#define comqcfields \
|
||||
comfieldfloat(modelindex)\
|
||||
comfieldvector(absmin)\
|
||||
comfieldvector(absmax)\
|
||||
comfieldfloat(ltime)\
|
||||
comfieldfloat(lastruntime) /*type doesn't match the qc, we use a hidden double instead. this is dead.*/ \
|
||||
comfieldfloat(movetype)\
|
||||
comfieldfloat(solid)\
|
||||
comfieldvector(origin)\
|
||||
comfieldvector(oldorigin)\
|
||||
comfieldvector(velocity)\
|
||||
comfieldvector(angles)\
|
||||
comfieldvector(avelocity)\
|
||||
comfieldstring(classname)\
|
||||
comfieldstring(model)\
|
||||
comfieldfloat(frame)\
|
||||
comfieldfloat(skin)\
|
||||
comfieldfloat(effects)\
|
||||
comfieldvector(mins)\
|
||||
comfieldvector(maxs)\
|
||||
comfieldvector(size)\
|
||||
comfieldfunction(touch, ".void()")\
|
||||
comfieldfunction(use, ".void()")\
|
||||
comfieldfunction(think, ".void()")\
|
||||
comfieldfunction(blocked, ".void()")\
|
||||
comfieldfloat(nextthink)\
|
||||
comfieldentity(groundentity)\
|
||||
comfieldfloat(health)\
|
||||
comfieldfloat(frags)\
|
||||
comfieldfloat(weapon)\
|
||||
comfieldstring(weaponmodel)\
|
||||
comfieldfloat(weaponframe)\
|
||||
comfieldfloat(currentammo)\
|
||||
comfieldfloat(ammo_shells)\
|
||||
comfieldfloat(ammo_nails)\
|
||||
comfieldfloat(ammo_rockets)\
|
||||
comfieldfloat(ammo_cells)\
|
||||
comfieldfloat(items)\
|
||||
comfieldfloat(takedamage)\
|
||||
comfieldentity(chain)\
|
||||
comfieldfloat(deadflag)\
|
||||
comfieldvector(view_ofs)\
|
||||
comfieldfloat(button0)\
|
||||
comfieldfloat(button1) /*dead field in nq mode*/ \
|
||||
comfieldfloat(button2)\
|
||||
comfieldfloat(impulse)\
|
||||
comfieldfloat(fixangle)\
|
||||
comfieldvector(v_angle)\
|
||||
comfieldstring(netname)\
|
||||
comfieldentity(enemy)\
|
||||
comfieldfloat(flags)\
|
||||
comfieldfloat(colormap)\
|
||||
comfieldfloat(team)\
|
||||
comfieldfloat(max_health)\
|
||||
comfieldfloat(teleport_time)\
|
||||
comfieldfloat(armortype)\
|
||||
comfieldfloat(armorvalue)\
|
||||
comfieldfloat(waterlevel)\
|
||||
comfieldfloat(watertype)\
|
||||
comfieldfloat(ideal_yaw)\
|
||||
comfieldfloat(yaw_speed)\
|
||||
comfieldentity(aiment)\
|
||||
comfieldentity(goalentity)\
|
||||
comfieldfloat(spawnflags)\
|
||||
comfieldstring(target)\
|
||||
comfieldstring(targetname)\
|
||||
comfieldfloat(dmg_take)\
|
||||
comfieldfloat(dmg_save)\
|
||||
comfieldentity(dmg_inflictor)\
|
||||
comfieldentity(owner)\
|
||||
comfieldvector(movedir)\
|
||||
comfieldstring(message) /*don't use directly, hexen2 uses floats, so we go via qclib for message*/\
|
||||
comfieldfloat(sounds)\
|
||||
comfieldstring(noise)\
|
||||
comfieldstring(noise1)\
|
||||
comfieldstring(noise2)\
|
||||
comfieldstring(noise3)
|
||||
comfieldfloat(modelindex,NULL)\
|
||||
comfieldvector(absmin,NULL)\
|
||||
comfieldvector(absmax,NULL)\
|
||||
comfieldfloat(ltime,NULL)\
|
||||
comfieldfloat(lastruntime,NULL) /*type doesn't match the qc, we use a hidden double instead. this is dead.*/ \
|
||||
comfieldfloat(movetype,NULL)\
|
||||
comfieldfloat(solid,NULL)\
|
||||
comfieldvector(origin,NULL)\
|
||||
comfieldvector(oldorigin,NULL)\
|
||||
comfieldvector(velocity,NULL)\
|
||||
comfieldvector(angles,NULL)\
|
||||
comfieldvector(avelocity,NULL)\
|
||||
comfieldstring(classname,NULL)\
|
||||
comfieldstring(model,NULL)\
|
||||
comfieldfloat(frame,NULL)\
|
||||
comfieldfloat(skin,NULL)\
|
||||
comfieldfloat(effects,NULL)\
|
||||
comfieldvector(mins,NULL)\
|
||||
comfieldvector(maxs,NULL)\
|
||||
comfieldvector(size,NULL)\
|
||||
comfieldfunction(touch, ".void()",NULL)\
|
||||
comfieldfunction(use, ".void()",NULL)\
|
||||
comfieldfunction(think, ".void()",NULL)\
|
||||
comfieldfunction(blocked, ".void()",NULL)\
|
||||
comfieldfloat(nextthink,NULL)\
|
||||
comfieldentity(groundentity,NULL)\
|
||||
comfieldfloat(health,NULL)\
|
||||
comfieldfloat(frags,NULL)\
|
||||
comfieldfloat(weapon,NULL)\
|
||||
comfieldstring(weaponmodel,NULL)\
|
||||
comfieldfloat(weaponframe,NULL)\
|
||||
comfieldfloat(currentammo,NULL)\
|
||||
comfieldfloat(ammo_shells,NULL)\
|
||||
comfieldfloat(ammo_nails,NULL)\
|
||||
comfieldfloat(ammo_rockets,NULL)\
|
||||
comfieldfloat(ammo_cells,NULL)\
|
||||
comfieldfloat(items,NULL)\
|
||||
comfieldfloat(takedamage,NULL)\
|
||||
comfieldentity(chain,NULL)\
|
||||
comfieldfloat(deadflag,NULL)\
|
||||
comfieldvector(view_ofs,NULL)\
|
||||
comfieldfloat(button0,NULL)\
|
||||
comfieldfloat(button1,NULL) /*dead field in nq mode*/ \
|
||||
comfieldfloat(button2,NULL)\
|
||||
comfieldfloat(impulse,NULL)\
|
||||
comfieldfloat(fixangle,NULL)\
|
||||
comfieldvector(v_angle,NULL)\
|
||||
comfieldstring(netname,NULL)\
|
||||
comfieldentity(enemy,NULL)\
|
||||
comfieldfloat(flags,NULL)\
|
||||
comfieldfloat(colormap,NULL)\
|
||||
comfieldfloat(team,NULL)\
|
||||
comfieldfloat(max_health,NULL)\
|
||||
comfieldfloat(teleport_time,NULL)\
|
||||
comfieldfloat(armortype,NULL)\
|
||||
comfieldfloat(armorvalue,NULL)\
|
||||
comfieldfloat(waterlevel,NULL)\
|
||||
comfieldfloat(watertype,NULL)\
|
||||
comfieldfloat(ideal_yaw,NULL)\
|
||||
comfieldfloat(yaw_speed,NULL)\
|
||||
comfieldentity(aiment,NULL)\
|
||||
comfieldentity(goalentity,NULL)\
|
||||
comfieldfloat(spawnflags,NULL)\
|
||||
comfieldstring(target,NULL)\
|
||||
comfieldstring(targetname,NULL)\
|
||||
comfieldfloat(dmg_take,NULL)\
|
||||
comfieldfloat(dmg_save,NULL)\
|
||||
comfieldentity(dmg_inflictor,NULL)\
|
||||
comfieldentity(owner,NULL)\
|
||||
comfieldvector(movedir,NULL)\
|
||||
comfieldstring(message,NULL) /*don't use directly, hexen2 uses floats, so we go via qclib for message*/\
|
||||
comfieldfloat(sounds,NULL)\
|
||||
comfieldstring(noise,NULL)\
|
||||
comfieldstring(noise1,NULL)\
|
||||
comfieldstring(noise2,NULL)\
|
||||
comfieldstring(noise3,NULL)
|
||||
/*DO NOT ADD TO THE ABOVE STRUCTURE*/
|
||||
|
||||
#define comextqcfields \
|
||||
comfieldvector(punchangle) /*std in nq*/\
|
||||
comfieldfloat(gravity) /*added in quake 1.09 (for hipnotic)*/\
|
||||
comfieldfloat(hull)/*PEXT_HEXEN2*/\
|
||||
comfieldentity(movechain)/*hexen2*/\
|
||||
comfieldfunction(chainmoved, ".void()")/*hexen2*/\
|
||||
comfieldfunction(contentstransition, ".void(float old, float new)")/*ENTITYCONTENTSTRANSITION*/\
|
||||
comfieldfloat(dimension_solid)/*EXT_DIMENSION_PHYSICS*/\
|
||||
comfieldfloat(dimension_hit)/*EXT_DIMENSION_PHYSICS*/\
|
||||
comfieldfloat(hitcontentsmask)\
|
||||
comfieldfloat(scale)/*DP_ENT_SCALE*/\
|
||||
comfieldfloat(fatness)/*FTE_PEXT_FATNESS*/\
|
||||
comfieldfloat(alpha)/*DP_ENT_ALPHA*/\
|
||||
comfieldentity(tag_entity)\
|
||||
comfieldfloat(skeletonindex) /*FTE_CSQC_SKELETONOBJECTS*/\
|
||||
comfieldvector(colormod)\
|
||||
comfieldvector(glowmod)\
|
||||
comfieldvector(gravitydir)\
|
||||
comfieldfloat(pmove_flags)/*EXT_CSQC_1*/\
|
||||
comfieldfloat(friction)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(erp)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(jointtype)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(mass)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(bouncefactor)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(bouncestop)/*DP_...PHYSICS*/
|
||||
comfieldvector(punchangle,NULL) /*std in nq*/\
|
||||
comfieldfloat(gravity,NULL) /*added in quake 1.09 (for hipnotic)*/\
|
||||
comfieldfloat(hull,NULL)/*PEXT_HEXEN2*/\
|
||||
comfieldentity(movechain,NULL)/*hexen2*/\
|
||||
comfieldfunction(chainmoved, ".void()",NULL)/*hexen2*/\
|
||||
comfieldfunction(contentstransition, ".void(float old, float new)",NULL)/*ENTITYCONTENTSTRANSITION*/\
|
||||
comfieldfloat(dimension_solid,NULL)/*EXT_DIMENSION_PHYSICS*/\
|
||||
comfieldfloat(dimension_hit,NULL)/*EXT_DIMENSION_PHYSICS*/\
|
||||
comfieldfloat(hitcontentsmask,NULL)\
|
||||
comfieldfloat(scale,NULL)/*DP_ENT_SCALE*/\
|
||||
comfieldfloat(fatness,NULL)/*FTE_PEXT_FATNESS*/\
|
||||
comfieldfloat(alpha,NULL)/*DP_ENT_ALPHA*/\
|
||||
comfieldentity(tag_entity,NULL)\
|
||||
comfieldfloat(skeletonindex,NULL) /*FTE_CSQC_SKELETONOBJECTS*/\
|
||||
comfieldvector(colormod,NULL)\
|
||||
comfieldvector(glowmod,NULL)\
|
||||
comfieldvector(gravitydir,NULL)\
|
||||
comfieldfloat(pmove_flags,NULL)/*EXT_CSQC_1*/\
|
||||
comfieldfloat(friction,NULL)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(erp,NULL)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(jointtype,NULL)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(mass,NULL)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(bouncefactor,NULL)/*DP_...PHYSICS*/\
|
||||
comfieldfloat(bouncestop,NULL)/*DP_...PHYSICS*/
|
||||
|
||||
#define svextqcfields \
|
||||
comfieldfloat(maxspeed)/*added in quake 1.09*/\
|
||||
comfieldfloat(items2) /*added in quake 1.09 (for hipnotic)*/\
|
||||
comfieldentity(view2)/*FTE_PEXT_VIEW2*/\
|
||||
comfieldvector(movement)\
|
||||
comfieldfloat(vw_index)\
|
||||
comfieldentity(nodrawtoclient)\
|
||||
comfieldentity(drawonlytoclient)\
|
||||
comfieldentity(viewmodelforclient)/*DP_ENT_VIEWMODEL*/\
|
||||
comfieldentity(exteriormodeltoclient)\
|
||||
comfieldfloat(button3) /*DP_INPUTBUTTONS (note in qw, we set 1 to equal 3, to match zquake/fuhquake/mvdsv)*/\
|
||||
comfieldfloat(button4)\
|
||||
comfieldfloat(button5)\
|
||||
comfieldfloat(button6)\
|
||||
comfieldfloat(button7)\
|
||||
comfieldfloat(button8)\
|
||||
comfieldfloat(viewzoom)/*DP_VIEWZOOM*/\
|
||||
comfieldfloat(tag_index)\
|
||||
comfieldfloat(glow_size)\
|
||||
comfieldfloat(glow_color)\
|
||||
comfieldfloat(glow_trail)\
|
||||
comfieldfloat(traileffectnum)/*DP_ENT_TRAILEFFECTNUM*/\
|
||||
comfieldvector(color)/*Hexen2 has a .float color, the warnings should be benign*/ \
|
||||
comfieldfloat(light_lev)\
|
||||
comfieldfloat(style)\
|
||||
comfieldfloat(pflags)\
|
||||
comfieldfloat(clientcolors)\
|
||||
comfieldfloat(dimension_see)/*EXT_DIMENSION_VISIBLE*/\
|
||||
comfieldfloat(dimension_seen)/*EXT_DIMENSION_VISIBLE*/\
|
||||
comfieldfloat(dimension_ghost)/*EXT_DIMENSION_GHOST*/\
|
||||
comfieldfloat(dimension_ghost_alpha)/*EXT_DIMENSION_GHOST*/\
|
||||
comfieldfloat(playerclass)/*hexen2 requirements*/\
|
||||
comfieldfloat(drawflags)/*hexen2*/\
|
||||
comfieldfloat(hasted)/*hexen2 uses this AS WELL as maxspeed*/\
|
||||
comfieldfloat(light_level)/*hexen2's grabbing light level from client*/\
|
||||
comfieldfloat(abslight)/*hexen2's force a lightlevel*/\
|
||||
comfieldfunction(SendEntity, ".float(entity playerent, float changedflags)")/*EXT_CSQC*/\
|
||||
comfieldfloat(SendFlags)/*EXT_CSQC_1 (one of the DP guys came up with it)*/\
|
||||
comfieldfloat(Version)/*EXT_CSQC (obsolete)*/\
|
||||
comfieldfloat(pvsflags)/*EXT_CSQC_1*/\
|
||||
comfieldfloat(modelflags)\
|
||||
comfieldfloat(uniquespawnid)/*FTE_ENT_UNIQUESPAWNID*/\
|
||||
comfieldfunction(customizeentityforclient, ".float()")
|
||||
comfieldfloat(maxspeed,NULL)/*added in quake 1.09*/\
|
||||
comfieldfloat(items2,NULL) /*added in quake 1.09 (for hipnotic)*/\
|
||||
comfieldentity(view2,NULL)/*FTE_PEXT_VIEW2*/\
|
||||
comfieldvector(movement,NULL)\
|
||||
comfieldfloat(vw_index,NULL)\
|
||||
comfieldentity(nodrawtoclient,NULL)\
|
||||
comfieldentity(drawonlytoclient,NULL)\
|
||||
comfieldentity(viewmodelforclient,NULL)/*DP_ENT_VIEWMODEL*/\
|
||||
comfieldentity(exteriormodeltoclient,NULL)\
|
||||
comfieldfloat(button3,"DP_INPUTBUTTONS (note in qw, we set 1 to equal 3, to match zquake/fuhquake/mvdsv)")\
|
||||
comfieldfloat(button4,NULL)\
|
||||
comfieldfloat(button5,NULL)\
|
||||
comfieldfloat(button6,NULL)\
|
||||
comfieldfloat(button7,NULL)\
|
||||
comfieldfloat(button8,NULL)\
|
||||
comfieldfloat(viewzoom,NULL)/*DP_VIEWZOOM*/\
|
||||
comfieldfloat(tag_index,NULL)\
|
||||
comfieldfloat(glow_size,NULL)\
|
||||
comfieldfloat(glow_color,NULL)\
|
||||
comfieldfloat(glow_trail,NULL)\
|
||||
comfieldfloat(traileffectnum,NULL)/*DP_ENT_TRAILEFFECTNUM*/\
|
||||
comfieldvector(color,NULL)/*Hexen2 has a .float color, the warnings should be benign*/ \
|
||||
comfieldfloat(light_lev,NULL)\
|
||||
comfieldfloat(style,NULL)\
|
||||
comfieldfloat(pflags,NULL)\
|
||||
comfieldfloat(clientcolors,NULL)\
|
||||
comfieldfloat(dimension_see,NULL)/*EXT_DIMENSION_VISIBLE*/\
|
||||
comfieldfloat(dimension_seen,NULL)/*EXT_DIMENSION_VISIBLE*/\
|
||||
comfieldfloat(dimension_ghost,NULL)/*EXT_DIMENSION_GHOST*/\
|
||||
comfieldfloat(dimension_ghost_alpha,NULL)/*EXT_DIMENSION_GHOST*/\
|
||||
comfieldfloat(playerclass,NULL)/*hexen2 requirements*/\
|
||||
comfieldfloat(drawflags,NULL)/*hexen2*/\
|
||||
comfieldfloat(hasted,NULL)/*hexen2 uses this AS WELL as maxspeed*/\
|
||||
comfieldfloat(light_level,NULL)/*hexen2's grabbing light level from client*/\
|
||||
comfieldfloat(abslight,NULL)/*hexen2's force a lightlevel*/\
|
||||
comfieldfunction(SendEntity, ".float(entity playerent, float changedflags)",NULL)/*EXT_CSQC*/\
|
||||
comfieldfloat(SendFlags,NULL)/*EXT_CSQC_1 (one of the DP guys came up with it)*/\
|
||||
comfieldfloat(Version,NULL)/*EXT_CSQC (obsolete)*/\
|
||||
comfieldfloat(pvsflags,NULL)/*EXT_CSQC_1*/\
|
||||
comfieldfloat(modelflags,NULL)\
|
||||
comfieldfloat(uniquespawnid,NULL)/*FTE_ENT_UNIQUESPAWNID*/\
|
||||
comfieldfunction(customizeentityforclient, ".float()",NULL)
|
||||
|
||||
//this is the list for all the csqc fields.
|
||||
//(the #define is so the list always matches the ones pulled out)
|
||||
#define csqcextfields \
|
||||
comfieldfloat(entnum) \
|
||||
comfieldfloat(frame2) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(frame1time) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(frame2time) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(lerpfrac) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(renderflags)\
|
||||
comfieldfloat(forceshader)/*FTE_CSQC_SHADERS*/\
|
||||
comfieldfloat(entnum,NULL) \
|
||||
comfieldfloat(frame2,NULL) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(frame1time,NULL) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(frame2time,NULL) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(lerpfrac,NULL) /*EXT_CSQC_1*/\
|
||||
comfieldfloat(renderflags,NULL)\
|
||||
comfieldfloat(forceshader,NULL)/*FTE_CSQC_SHADERS*/\
|
||||
\
|
||||
comfieldfloat(baseframe) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baseframe2) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baseframe1time) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baseframe2time) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baselerpfrac) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(basebone) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baseframe,NULL) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baseframe2,NULL) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baseframe1time,NULL) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baseframe2time,NULL) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(baselerpfrac,NULL) /*FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(basebone,NULL) /*FTE_CSQC_BASEFRAME*/\
|
||||
\
|
||||
comfieldfloat(bonecontrol1) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol2) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol3) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol4) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol5) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(subblendfrac) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(basesubblendfrac) /*FTE_CSQC_HALFLIFE_MODELS+FTE_CSQC_BASEFRAME*/\
|
||||
comfieldfloat(bonecontrol1,NULL) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol2,NULL) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol3,NULL) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol4,NULL) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(bonecontrol5,NULL) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(subblendfrac,NULL) /*FTE_CSQC_HALFLIFE_MODELS*/\
|
||||
comfieldfloat(basesubblendfrac,NULL) /*FTE_CSQC_HALFLIFE_MODELS+FTE_CSQC_BASEFRAME*/\
|
||||
\
|
||||
comfieldfloat(drawmask) /*So that the qc can specify all rockets at once or all bannanas at once*/ \
|
||||
comfieldfunction(predraw, ".void()") /*If present, is called just before it's drawn.*/ \
|
||||
comfieldfloat(drawmask,NULL) /*So that the qc can specify all rockets at once or all bannanas at once*/ \
|
||||
comfieldfunction(predraw, ".void()",NULL) /*If present, is called just before it's drawn.*/ \
|
||||
\
|
||||
comfieldfloat(ideal_pitch)\
|
||||
comfieldfloat(pitch_speed)
|
||||
comfieldfloat(ideal_pitch,NULL)\
|
||||
comfieldfloat(pitch_speed,NULL)
|
||||
|
||||
typedef struct stdentvars_s //standard = standard for qw
|
||||
{
|
||||
#define comfieldfloat(sharedname) float sharedname;
|
||||
#define comfieldvector(sharedname) vec3_t sharedname;
|
||||
#define comfieldentity(sharedname) int sharedname;
|
||||
#define comfieldstring(sharedname) string_t sharedname;
|
||||
#define comfieldfunction(sharedname, typestr) func_t sharedname;
|
||||
#define comfieldfloat(sharedname,desc) float sharedname;
|
||||
#define comfieldvector(sharedname,desc) vec3_t sharedname;
|
||||
#define comfieldentity(sharedname,desc) int sharedname;
|
||||
#define comfieldstring(sharedname,desc) string_t sharedname;
|
||||
#define comfieldfunction(sharedname, typestr,desc) func_t sharedname;
|
||||
comqcfields
|
||||
#undef comfieldfloat
|
||||
#undef comfieldvector
|
||||
|
@ -307,11 +307,11 @@ comqcfields
|
|||
typedef struct extentvars_s
|
||||
{
|
||||
#endif
|
||||
#define comfieldfloat(name) float name;
|
||||
#define comfieldvector(name) vec3_t name;
|
||||
#define comfieldentity(name) int name;
|
||||
#define comfieldstring(name) string_t name;
|
||||
#define comfieldfunction(name, typestr) func_t name;
|
||||
#define comfieldfloat(name,desc) float name;
|
||||
#define comfieldvector(name,desc) vec3_t name;
|
||||
#define comfieldentity(name,desc) int name;
|
||||
#define comfieldstring(name,desc) string_t name;
|
||||
#define comfieldfunction(name, typestr,desc) func_t name;
|
||||
comextqcfields
|
||||
svextqcfields
|
||||
#undef comfieldfloat
|
||||
|
@ -327,11 +327,11 @@ svextqcfields
|
|||
#endif
|
||||
|
||||
typedef struct {
|
||||
#define comfieldfloat(sharedname) float sharedname;
|
||||
#define comfieldvector(sharedname) vec3_t sharedname;
|
||||
#define comfieldentity(sharedname) int sharedname;
|
||||
#define comfieldstring(sharedname) string_t sharedname;
|
||||
#define comfieldfunction(sharedname, typestr) func_t sharedname;
|
||||
#define comfieldfloat(sharedname,desc) float sharedname;
|
||||
#define comfieldvector(sharedname,desc) vec3_t sharedname;
|
||||
#define comfieldentity(sharedname,desc) int sharedname;
|
||||
#define comfieldstring(sharedname,desc) string_t sharedname;
|
||||
#define comfieldfunction(sharedname, typestr,desc) func_t sharedname;
|
||||
comqcfields
|
||||
#undef comfieldfloat
|
||||
#undef comfieldvector
|
||||
|
@ -344,11 +344,11 @@ comqcfields
|
|||
typedef struct {
|
||||
#endif
|
||||
|
||||
#define comfieldfloat(name) float name;
|
||||
#define comfieldvector(name) vec3_t name;
|
||||
#define comfieldentity(name) int name;
|
||||
#define comfieldstring(name) string_t name;
|
||||
#define comfieldfunction(name, typestr) func_t name;
|
||||
#define comfieldfloat(name,desc) float name;
|
||||
#define comfieldvector(name,desc) vec3_t name;
|
||||
#define comfieldentity(name,desc) int name;
|
||||
#define comfieldstring(name,desc) string_t name;
|
||||
#define comfieldfunction(name, typestr,desc) func_t name;
|
||||
comextqcfields
|
||||
#undef comfieldfloat
|
||||
#undef comfieldvector
|
||||
|
|
|
@ -39,7 +39,7 @@ void QDECL ED_Spawned (struct edict_s *ent, int loading);
|
|||
qboolean SV_RunFullQCMovement(struct client_s *client, usercmd_t *ucmd);
|
||||
qboolean PR_KrimzonParseCommand(char *s);
|
||||
qboolean PR_UserCmd(char *cmd);
|
||||
qboolean PR_ConsoleCmd(void);
|
||||
qboolean PR_ConsoleCmd(const char *cmd);
|
||||
|
||||
void PRSV_RunThreads(void);
|
||||
|
||||
|
|
|
@ -942,7 +942,7 @@ void SV_SaveLevelCache(char *savedir, qboolean dontharmgame)
|
|||
}
|
||||
VFS_PRINTF (f,"\n");
|
||||
|
||||
s = PR_SaveEnts(svprogfuncs, NULL, &len, 1);
|
||||
s = PR_SaveEnts(svprogfuncs, NULL, &len, 0, 1);
|
||||
VFS_PUTS(f, s);
|
||||
VFS_PUTS(f, "\n");
|
||||
svprogfuncs->parms->memfree(s);
|
||||
|
|
|
@ -1212,6 +1212,7 @@ void NPP_NQWriteShort(int dest, short data);
|
|||
void NPP_NQWriteLong(int dest, long data);
|
||||
void NPP_NQWriteAngle(int dest, float data);
|
||||
void NPP_NQWriteCoord(int dest, float data);
|
||||
void NPP_NQWriteFloat(int dest, float data);
|
||||
void NPP_NQWriteString(int dest, char *data);
|
||||
void NPP_NQWriteEntity(int dest, short data);
|
||||
|
||||
|
@ -1221,6 +1222,7 @@ void NPP_QWWriteShort(int dest, short data);
|
|||
void NPP_QWWriteLong(int dest, long data);
|
||||
void NPP_QWWriteAngle(int dest, float data);
|
||||
void NPP_QWWriteCoord(int dest, float data);
|
||||
void NPP_QWWriteFloat(int dest, float data);
|
||||
void NPP_QWWriteString(int dest, char *data);
|
||||
void NPP_QWWriteEntity(int dest, short data);
|
||||
|
||||
|
|
|
@ -306,6 +306,9 @@ void SV_Give_f (void)
|
|||
char *t;
|
||||
int v;
|
||||
|
||||
if (!svprogfuncs)
|
||||
return;
|
||||
|
||||
if (!SV_MayCheat())
|
||||
{
|
||||
Con_TPrintf (STL_NEEDCHEATPARM);
|
||||
|
@ -328,9 +331,6 @@ void SV_Give_f (void)
|
|||
|
||||
SV_LogPlayer(host_client, "give cheat");
|
||||
|
||||
if (!svprogfuncs)
|
||||
return;
|
||||
|
||||
t = Cmd_Argv(2);
|
||||
v = atoi (Cmd_Argv(3));
|
||||
|
||||
|
@ -634,6 +634,8 @@ void SV_Map_f (void)
|
|||
SV_StuffcmdToClient(host_client, va("reconnect \"%s\"\n", level));
|
||||
else
|
||||
SV_StuffcmdToClient(host_client, va("changing \"%s\"\n", level));
|
||||
host_client->prespawn_stage = PRESPAWN_INVALID;
|
||||
host_client->prespawn_idx = 0;
|
||||
}
|
||||
SV_SendMessagesToAll ();
|
||||
|
||||
|
@ -2199,6 +2201,9 @@ void SV_SendGameCommand_f(void)
|
|||
return;
|
||||
#endif
|
||||
|
||||
if (PR_ConsoleCmd(Cmd_Args()))
|
||||
return;
|
||||
|
||||
#ifdef Q2SERVER
|
||||
if (ge)
|
||||
{
|
||||
|
|
|
@ -331,7 +331,7 @@ void SV_SaveSpawnparms (qboolean dontsave)
|
|||
for (j=0 ; j<NUM_SPAWN_PARMS ; j++)
|
||||
host_client->spawn_parms[j] = 0;
|
||||
|
||||
buf = svprogfuncs->saveent(svprogfuncs, buffer, &bufsize, host_client->edict);
|
||||
buf = svprogfuncs->saveent(svprogfuncs, buffer, &bufsize, sizeof(buffer), host_client->edict);
|
||||
|
||||
if (host_client->spawninfo)
|
||||
Z_Free(host_client->spawninfo);
|
||||
|
@ -1287,7 +1287,6 @@ void SV_SpawnServer (char *server, char *startspot, qboolean noents, qboolean us
|
|||
}
|
||||
else if (!deathmatch.value) //decide if we are to inhibit single player game ents instead
|
||||
{
|
||||
spawnflagmask = SPAWNFLAG_NOT_DEATHMATCH;
|
||||
if (skill.value < 0.5)
|
||||
spawnflagmask = SPAWNFLAG_NOT_EASY;
|
||||
else if (skill.value > 1.5)
|
||||
|
|
|
@ -300,7 +300,7 @@ void VARGS SV_Error (char *error, ...)
|
|||
{
|
||||
int size = 1024*1024*8;
|
||||
char *buffer = BZ_Malloc(size);
|
||||
svprogfuncs->save_ents(svprogfuncs, buffer, &size, 3);
|
||||
svprogfuncs->save_ents(svprogfuncs, buffer, &size, size, 3);
|
||||
COM_WriteFile("ssqccore.txt", buffer, size);
|
||||
BZ_Free(buffer);
|
||||
}
|
||||
|
|
|
@ -510,7 +510,7 @@ typedef struct
|
|||
vec3_t angles;
|
||||
// float deltayaw;
|
||||
} pushed_t;
|
||||
static pushed_t pushed[MAX_EDICTS], *pushed_p;
|
||||
static pushed_t pushed[1024], *pushed_p;
|
||||
|
||||
/*
|
||||
============
|
||||
|
@ -594,6 +594,8 @@ static qboolean WPhys_PushAngles (world_t *w, wedict_t *pusher, vec3_t move, vec
|
|||
|
||||
if ((pusher->v->movetype == MOVETYPE_PUSH) || (PROG_TO_WEDICT(w->progs, check->v->groundentity) == pusher))
|
||||
{
|
||||
if (pushed_p == (pushed+(sizeof(pushed)/sizeof(pushed[0]))))
|
||||
continue;
|
||||
// move this entity
|
||||
pushed_p->ent = check;
|
||||
VectorCopy (check->v->origin, pushed_p->origin);
|
||||
|
|
|
@ -524,7 +524,7 @@ queryresult_t *SQL_GetQueryResult (sqlserver_t *server, int queryidx, int row)
|
|||
|
||||
qreq = SQL_GetQueryRequest(server, queryidx);
|
||||
for (qres = qreq->results; qres; qres = qres->next)
|
||||
if (qres->request && qres->request->num == queryidx && row >= qres->firstrow && row < qres->firstrow + qres->rows)
|
||||
if (qres->request && qres->request->num == queryidx && (row >= qres->firstrow || row == -1 && !qres->firstrow) && row < qres->firstrow + qres->rows)
|
||||
return qres;
|
||||
|
||||
return NULL;
|
||||
|
|
|
@ -55,7 +55,7 @@ cvar_t sv_protocol_nq = CVARD("sv_protocol_nq", "0", "Specifies the default pro
|
|||
|
||||
cvar_t sv_cmdlikercon = SCVAR("sv_cmdlikercon", "0"); //set to 1 to allow a password of username:password instead of the correct rcon password.
|
||||
cvar_t cmd_allowaccess = SCVAR("cmd_allowaccess", "0"); //set to 1 to allow cmd to execute console commands on the server.
|
||||
cvar_t cmd_gamecodelevel = SCVAR("cmd_gamecodelevel", "50"); //execution level which gamecode is told about (for unrecognised commands)
|
||||
cvar_t cmd_gamecodelevel = SCVAR("cmd_gamecodelevel", STRINGIFY(RESTRICT_LOCAL)); //execution level which gamecode is told about (for unrecognised commands)
|
||||
|
||||
cvar_t sv_pure = CVARFD("sv_pure", "", CVAR_SERVERINFO, "The most evil cvar in the world, many clients will ignore this.\n0=standard quake rules.\n1=clients should prefer files within packages present on the server.\n2=clients should use *only* files within packages present on the server.\nDue to quake 1.01/1.06 differences, a setting of 2 only works in total conversions.");
|
||||
cvar_t sv_nqplayerphysics = CVARAD("sv_nqplayerphysics", "0", "sv_nomsec", "Disregard player prediction and run NQ-style player physics instead. This can be used for compatibility with mods that expect exact behaviour.");
|
||||
|
@ -424,6 +424,10 @@ void SVNQ_New_f (void)
|
|||
int maxplayers = 0;
|
||||
int op;
|
||||
unsigned int protext1 = 0, protext2 = 0, protmain = 0, protfl = 0;
|
||||
char *protoname;
|
||||
|
||||
host_client->prespawn_stage = PRESPAWN_INVALID;
|
||||
host_client->prespawn_idx = 0;
|
||||
|
||||
host_client->send_message = true;
|
||||
if (host_client->redirect)
|
||||
|
@ -442,41 +446,12 @@ void SVNQ_New_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_print);
|
||||
Q_snprintfz (message, sizeof(message), "%c\n%s server\n", 2, version_string());
|
||||
MSG_WriteString (&host_client->netchan.message,message);
|
||||
|
||||
|
||||
Z_Free(host_client->csqcentversions);
|
||||
host_client->csqcentversions = NULL;
|
||||
Z_Free(host_client->csqcentsequence);
|
||||
host_client->csqcentsequence = NULL;
|
||||
host_client->csqcactive = false;
|
||||
if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)
|
||||
{
|
||||
extern cvar_t allow_download;
|
||||
char *f;
|
||||
|
||||
if (allow_download.value)
|
||||
{
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, "cl_serverextension_download 1\n");
|
||||
}
|
||||
|
||||
f = COM_LoadTempFile("csprogs.dat");
|
||||
if (f)
|
||||
{
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, va("csqc_progname %s\n", "csprogs.dat"));
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, va("csqc_progsize %i\n", com_filesize));
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, va("csqc_progcrc %i\n", QCRC_Block(f, com_filesize)));
|
||||
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, "cmd enablecsqc\n");
|
||||
}
|
||||
}
|
||||
|
||||
protext1 = host_client->fteprotocolextensions;
|
||||
protext2 = host_client->fteprotocolextensions2;
|
||||
|
@ -507,33 +482,73 @@ void SVNQ_New_f (void)
|
|||
{
|
||||
protext1 &= ~PEXT_FLOATCOORDS; //never report floatcoords when using rmq protocol, as the base protocol allows us to be more specific anyway.
|
||||
protmain = RMQ_PROTOCOL_VERSION;
|
||||
protoname = "RMQ";
|
||||
}
|
||||
else
|
||||
{
|
||||
protmain = FITZ_PROTOCOL_VERSION;
|
||||
protoname = "666";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
host_client->protocol = (host_client->protocol==SCP_PROQUAKE)?SCP_PROQUAKE:SCP_NETQUAKE; //identical other than the client->server angles
|
||||
protmain = NQ_PROTOCOL_VERSION;
|
||||
protoname = "NQ";
|
||||
}
|
||||
maxplayers = 16;
|
||||
break;
|
||||
case SCP_DARKPLACES6:
|
||||
SV_LogPlayer(host_client, "new (DP6)");
|
||||
protmain = DP6_PROTOCOL_VERSION;
|
||||
protext1 &= ~PEXT_FLOATCOORDS; //always enabled, try not to break things
|
||||
maxplayers = 255;
|
||||
protoname = "DPP6";
|
||||
break;
|
||||
case SCP_DARKPLACES7:
|
||||
SV_LogPlayer(host_client, "new (DP7)");
|
||||
protmain = DP7_PROTOCOL_VERSION;
|
||||
protext1 &= ~PEXT_FLOATCOORDS; //always enabled, try not to break things
|
||||
maxplayers = 255;
|
||||
protoname = "DPP7";
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
host_client->drop = true;
|
||||
protoname = "?""?""?";
|
||||
break;
|
||||
}
|
||||
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_print);
|
||||
Q_snprintfz (message, sizeof(message), "%c\n%s %s%s%s%s server\n", 2, version_string(), (protext2&PEXT2_REPLACEMENTDELTAS)?"FTE":"", protoname, (protext1||(protext2&~(PEXT2_REPLACEMENTDELTAS|PEXT2_VOICECHAT)))?"+":"", (protext2&PEXT2_VOICECHAT)?"V":"");
|
||||
MSG_WriteString (&host_client->netchan.message,message);
|
||||
|
||||
if (host_client->protocol == SCP_DARKPLACES6 || host_client->protocol == SCP_DARKPLACES7)
|
||||
{
|
||||
extern cvar_t allow_download;
|
||||
char *f;
|
||||
|
||||
if (allow_download.value)
|
||||
{
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, "cl_serverextension_download 1\n");
|
||||
}
|
||||
|
||||
f = COM_LoadTempFile("csprogs.dat");
|
||||
if (f)
|
||||
{
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, va("csqc_progname %s\n", "csprogs.dat"));
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, va("csqc_progsize %i\n", com_filesize));
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, va("csqc_progcrc %i\n", QCRC_Block(f, com_filesize)));
|
||||
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_stufftext);
|
||||
MSG_WriteString (&host_client->netchan.message, "cmd enablecsqc\n");
|
||||
}
|
||||
}
|
||||
|
||||
MSG_WriteByte (&host_client->netchan.message, svc_serverdata);
|
||||
if (protext1)
|
||||
{
|
||||
|
@ -1949,6 +1964,7 @@ void SV_DarkPlacesDownloadAck(client_t *cl)
|
|||
ClientReliableWrite_String(cl, s);
|
||||
|
||||
VFS_CLOSE(host_client->download);
|
||||
host_client->send_message = true;
|
||||
host_client->download = NULL;
|
||||
host_client->downloadsize = 0;
|
||||
}
|
||||
|
@ -2946,6 +2962,7 @@ void SV_BeginDownload_f(void)
|
|||
char *s = va("\ncl_downloadbegin %i %s\n", host_client->downloadsize, host_client->downloadfn);
|
||||
ClientReliableWrite_Begin (host_client, svc_stufftext, 2+strlen(s));
|
||||
ClientReliableWrite_String (host_client, s);
|
||||
host_client->send_message = true;
|
||||
}
|
||||
else
|
||||
SV_NextDownload_f ();
|
||||
|
|
Loading…
Reference in a new issue