Fixed a couple of warnings.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3728 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4fb854e261
commit
dc2212aa84
19 changed files with 184 additions and 168 deletions
|
@ -723,24 +723,27 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
case UI_CVAR_SET:
|
||||
{
|
||||
cvar_t *var;
|
||||
if (!strcmp(VM_POINTER(arg[0]), "fs_game"))
|
||||
char *vname = VM_POINTER(arg[0]);
|
||||
char *vval = VM_POINTER(arg[1]);
|
||||
if (!strcmp(vname, "fs_game"))
|
||||
{
|
||||
Cbuf_AddText(va("gamedir %s\nui_restart\n", (char*)VM_POINTER(arg[1])), RESTRICT_SERVER);
|
||||
Cbuf_AddText(va("gamedir %s\nui_restart\n", (char*)vval), RESTRICT_SERVER);
|
||||
}
|
||||
else
|
||||
{
|
||||
var = Cvar_FindVar(VM_POINTER(arg[0]));
|
||||
var = Cvar_FindVar(vname);
|
||||
if (var)
|
||||
Cvar_Set(var, VM_POINTER(arg[1])); //set it
|
||||
Cvar_Set(var, vval); //set it
|
||||
else
|
||||
Cvar_Get(VM_POINTER(arg[0]), VM_POINTER(arg[1]), 0, "UI created"); //create one
|
||||
Cvar_Get(vname, vval, 0, "UI created"); //create one
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UI_CVAR_VARIABLEVALUE:
|
||||
{
|
||||
cvar_t *var;
|
||||
var = Cvar_FindVar(VM_POINTER(arg[0]));
|
||||
char *vname = VM_POINTER(arg[0]);
|
||||
var = Cvar_FindVar(vname);
|
||||
if (var)
|
||||
VM_FLOAT(ret) = var->value;
|
||||
else
|
||||
|
@ -750,7 +753,8 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
case UI_CVAR_VARIABLESTRINGBUFFER:
|
||||
{
|
||||
cvar_t *var;
|
||||
var = Cvar_FindVar(VM_POINTER(arg[0]));
|
||||
char *vname = VM_POINTER(arg[0]);
|
||||
var = Cvar_FindVar(vname);
|
||||
if (!VM_LONG(arg[2]))
|
||||
VM_LONG(ret) = 0;
|
||||
else if (!var)
|
||||
|
@ -775,40 +779,44 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
case UI_CVAR_RESET: //cvar reset
|
||||
{
|
||||
cvar_t *var;
|
||||
var = Cvar_FindVar((char *)VM_POINTER(arg[0]));
|
||||
char *vname = VM_POINTER(arg[0]);
|
||||
var = Cvar_FindVar(vname);
|
||||
if (var)
|
||||
Cvar_Set(var, var->defaultstr);
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_CMD_EXECUTETEXT:
|
||||
if (!strncmp((char*)VM_POINTER(arg[1]), "ping ", 5))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_PINGREQUESTS; i++)
|
||||
if (ui_pings[i].type == NA_INVALID)
|
||||
{
|
||||
serverinfo_t *info;
|
||||
NET_StringToAdr((char *)VM_POINTER(arg[1]) + 5, &ui_pings[i]);
|
||||
info = Master_InfoForServer(ui_pings[i]);
|
||||
if (info)
|
||||
char *cmdtext = VM_POINTER(arg[1]);
|
||||
if (!strncmp(cmdtext, "ping ", 5))
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < MAX_PINGREQUESTS; i++)
|
||||
if (ui_pings[i].type == NA_INVALID)
|
||||
{
|
||||
info->special |= SS_KEEPINFO;
|
||||
Master_QueryServer(info);
|
||||
serverinfo_t *info;
|
||||
NET_StringToAdr(cmdtext + 5, &ui_pings[i]);
|
||||
info = Master_InfoForServer(ui_pings[i]);
|
||||
if (info)
|
||||
{
|
||||
info->special |= SS_KEEPINFO;
|
||||
Master_QueryServer(info);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (!strncmp(cmdtext, "localservers", 12))
|
||||
{
|
||||
MasterInfo_Begin();
|
||||
}
|
||||
/* else if (!strncmp(cmdtext, "r_vidmode", 12))
|
||||
{
|
||||
MasterInfo_Begin();
|
||||
}
|
||||
*/ else
|
||||
Cbuf_AddText(cmdtext, RESTRICT_SERVER);
|
||||
}
|
||||
else if (!strncmp(VM_POINTER(arg[1]), "localservers", 12))
|
||||
{
|
||||
MasterInfo_Begin();
|
||||
}
|
||||
/* else if (!strncmp(VM_POINTER(arg[1]), "r_vidmode", 12))
|
||||
{
|
||||
MasterInfo_Begin();
|
||||
}
|
||||
*/ else
|
||||
Cbuf_AddText(VM_POINTER(arg[1]), RESTRICT_SERVER);
|
||||
break;
|
||||
|
||||
case UI_FS_FOPENFILE: //fopen
|
||||
|
@ -973,15 +981,20 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
break;
|
||||
|
||||
case UI_GETGLCONFIG: //get glconfig
|
||||
if ((int)arg[0] + 11332/*sizeof(glconfig_t)*/ >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
{
|
||||
char *cfg;
|
||||
if ((int)arg[0] + 11332/*sizeof(glconfig_t)*/ >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
cfg = VM_POINTER(arg[0]);
|
||||
|
||||
|
||||
//do any needed work
|
||||
memset(VM_POINTER(arg[0]), 0, 11304);
|
||||
*(int *)VM_POINTER(arg[0]+11304) = vid.width;
|
||||
*(int *)VM_POINTER(arg[0]+11308) = vid.height;
|
||||
*(float *)VM_POINTER(arg[0]+11312) = (float)vid.width/vid.height;
|
||||
memset(VM_POINTER(arg[0]+11316), 0, 11332-11316);
|
||||
memset(cfg, 0, 11304);
|
||||
*(int *)(cfg+11304) = vid.width;
|
||||
*(int *)(cfg+11308) = vid.height;
|
||||
*(float *)(cfg+11312) = (float)vid.width/vid.height;
|
||||
memset(cfg+11316, 0, 11332-11316);
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_GETCLIENTSTATE: //get client state
|
||||
|
@ -1091,17 +1104,21 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
break;
|
||||
|
||||
case UI_GET_CDKEY: //get cd key
|
||||
if ((int)arg[0] + VM_LONG(arg[1]) >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
strncpy(VM_POINTER(arg[0]), Cvar_VariableString("cl_cdkey"), VM_LONG(arg[1]));
|
||||
{
|
||||
char *keydest = VM_POINTER(arg[0]);
|
||||
if ((int)arg[0] + VM_LONG(arg[1]) >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
strncpy(keydest, Cvar_VariableString("cl_cdkey"), VM_LONG(arg[1]));
|
||||
}
|
||||
break;
|
||||
case UI_SET_CDKEY: //set cd key
|
||||
if ((int)arg[0] + strlen(VM_POINTER(arg[0])) >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
{
|
||||
char *keysrc = VM_POINTER(arg[0]);
|
||||
cvar_t *cvar;
|
||||
if ((int)arg[0] + strlen(keysrc) >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
cvar = Cvar_Get("cl_cdkey", "", 0, "Quake3 auth");
|
||||
Cvar_Set(cvar, VM_POINTER(arg[0]));
|
||||
Cvar_Set(cvar, keysrc);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1155,19 +1172,30 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
|
||||
// standard Q3
|
||||
case UI_MEMSET:
|
||||
if ((int)arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
memset(VM_POINTER(arg[0]), arg[1], arg[2]);
|
||||
{
|
||||
void *dest = VM_POINTER(arg[0]);
|
||||
if ((int)arg[0] + arg[2] >= mask || dest < offset)
|
||||
break; //out of bounds.
|
||||
memset(dest, arg[1], arg[2]);
|
||||
}
|
||||
break;
|
||||
case UI_MEMCPY:
|
||||
if ((int)arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
memcpy(VM_POINTER(arg[0]), VM_POINTER(arg[1]), arg[2]);
|
||||
{
|
||||
void *dest = VM_POINTER(arg[0]);
|
||||
void *src = VM_POINTER(arg[1]);
|
||||
if ((int)arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
memcpy(dest, src, arg[2]);
|
||||
}
|
||||
break;
|
||||
case UI_STRNCPY:
|
||||
if (arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
Q_strncpyS(VM_POINTER(arg[0]), VM_POINTER(arg[1]), arg[2]);
|
||||
{
|
||||
void *dest = VM_POINTER(arg[0]);
|
||||
void *src = VM_POINTER(arg[1]);
|
||||
if (arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset)
|
||||
break; //out of bounds.
|
||||
Q_strncpyS(dest, src, arg[2]);
|
||||
}
|
||||
break;
|
||||
case UI_SIN:
|
||||
VM_FLOAT(ret)=(float)sin(VM_FLOAT(arg[0]));
|
||||
|
@ -1319,26 +1347,23 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
|
|||
|
||||
static int UI_SystemCallsVM(void *offset, quintptr_t mask, int fn, const int *arg)
|
||||
{ //this is so we can use edit and continue properly (vc doesn't like function pointers for edit+continue)
|
||||
if (sizeof(int) == sizeof(qintptr_t))
|
||||
{
|
||||
return UI_SystemCalls(offset, mask, fn, arg);
|
||||
}
|
||||
else
|
||||
{
|
||||
qintptr_t args[9];
|
||||
#if __WORDSIZE == 32
|
||||
return UI_SystemCalls(offset, mask, fn, (qintptr_t*)arg);
|
||||
#else
|
||||
qintptr_t args[9];
|
||||
|
||||
args[0]=arg[0];
|
||||
args[1]=arg[1];
|
||||
args[2]=arg[2];
|
||||
args[3]=arg[3];
|
||||
args[4]=arg[4];
|
||||
args[5]=arg[5];
|
||||
args[6]=arg[6];
|
||||
args[7]=arg[7];
|
||||
args[8]=arg[8];
|
||||
args[0]=arg[0];
|
||||
args[1]=arg[1];
|
||||
args[2]=arg[2];
|
||||
args[3]=arg[3];
|
||||
args[4]=arg[4];
|
||||
args[5]=arg[5];
|
||||
args[6]=arg[6];
|
||||
args[7]=arg[7];
|
||||
args[8]=arg[8];
|
||||
|
||||
return UI_SystemCalls(offset, mask, fn, args);
|
||||
}
|
||||
return UI_SystemCalls(offset, mask, fn, args);
|
||||
#endif
|
||||
}
|
||||
|
||||
//I'm not keen on this.
|
||||
|
|
|
@ -251,8 +251,6 @@ qboolean Cmd_IsCommand (char *line)
|
|||
|
||||
int PaddedPrint (char *s, int x)
|
||||
{
|
||||
int nextcolx = 0;
|
||||
|
||||
Con_Printf ("%s\t", s);
|
||||
x+=strlen(s);
|
||||
|
||||
|
@ -1305,7 +1303,7 @@ qboolean Key_MouseShouldBeFree(void)
|
|||
|
||||
//if true, the input code is expected to return mouse cursor positions rather than deltas
|
||||
extern cvar_t cl_prydoncursor;
|
||||
extern int mouseusedforgui;
|
||||
// extern int mouseusedforgui;
|
||||
// if (mouseusedforgui) //I don't like this
|
||||
// return true;
|
||||
|
||||
|
|
|
@ -367,11 +367,11 @@ typedef struct csqcedict_s
|
|||
|
||||
static void CSQC_InitFields(void)
|
||||
{ //CHANGING THIS FUNCTION REQUIRES CHANGES TO csqcentvars_t
|
||||
#define comfieldfloat(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldvector(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldentity(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldstring(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldfunction(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldfloat(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldvector(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldentity(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldstring(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldfunction(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
|
||||
comqcfields
|
||||
#undef comfieldfloat
|
||||
#undef comfieldvector
|
||||
|
@ -380,17 +380,17 @@ comqcfields
|
|||
#undef comfieldfunction
|
||||
|
||||
#ifdef VM_Q1
|
||||
#define comfieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #name, sizeof(csqcentvars_t) + (int)&((csqcextentvars_t*)0)->name, -1)
|
||||
#define comfieldvector(name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, sizeof(csqcentvars_t) + (int)&((csqcextentvars_t*)0)->name, -1)
|
||||
#define comfieldentity(name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, sizeof(csqcentvars_t) + (int)&((csqcextentvars_t*)0)->name, -1)
|
||||
#define comfieldstring(name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, sizeof(csqcentvars_t) + (int)&((csqcextentvars_t*)0)->name, -1)
|
||||
#define comfieldfunction(name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, sizeof(csqcentvars_t) + (int)&((csqcextentvars_t*)0)->name, -1)
|
||||
#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) 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, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldvector(name) PR_RegisterFieldVar(csqcprogs, ev_vector, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldentity(name) PR_RegisterFieldVar(csqcprogs, ev_entity, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldstring(name) PR_RegisterFieldVar(csqcprogs, ev_string, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#define comfieldfunction(name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (int)&((csqcentvars_t*)0)->name, -1)
|
||||
#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) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
|
||||
#endif
|
||||
comextqcfields
|
||||
csqcextfields
|
||||
|
@ -5060,7 +5060,7 @@ void CSQC_Shutdown(void)
|
|||
}
|
||||
|
||||
//when the qclib needs a file, it calls out to this function.
|
||||
qbyte *CSQC_PRLoadFile (char *path, void *buffer, int bufsize)
|
||||
qbyte *CSQC_PRLoadFile (const char *path, void *buffer, int bufsize)
|
||||
{
|
||||
qbyte *file;
|
||||
|
||||
|
@ -5115,7 +5115,7 @@ qbyte *CSQC_PRLoadFile (char *path, void *buffer, int bufsize)
|
|||
return COM_LoadStackFile(path, buffer, bufsize);
|
||||
}
|
||||
|
||||
int CSQC_PRFileSize (char *path)
|
||||
int CSQC_PRFileSize (const char *path)
|
||||
{
|
||||
qbyte *file;
|
||||
|
||||
|
|
|
@ -973,7 +973,6 @@ void QCBUILTIN QCBUILTIN PF_cl_getmousepos (progfuncs_t *prinst, struct globalva
|
|||
{
|
||||
float *ret = G_VECTOR(OFS_RETURN);
|
||||
extern int mousemove_x, mousemove_y;
|
||||
extern int mousecursor_x, mousecursor_y;
|
||||
|
||||
ret[0] = mousemove_x;
|
||||
ret[1] = mousemove_y;
|
||||
|
@ -981,6 +980,7 @@ void QCBUILTIN QCBUILTIN PF_cl_getmousepos (progfuncs_t *prinst, struct globalva
|
|||
mousemove_x=0;
|
||||
mousemove_y=0;
|
||||
|
||||
// extern int mousecursor_x, mousecursor_y;
|
||||
// ret[0] = mousecursor_x;
|
||||
// ret[1] = mousecursor_y;
|
||||
ret[2] = 0;
|
||||
|
@ -1770,7 +1770,7 @@ void MP_Shutdown (void)
|
|||
}
|
||||
}
|
||||
|
||||
pbool QC_WriteFile(char *name, void *data, int len);
|
||||
pbool QC_WriteFile(const char *name, void *data, int len);
|
||||
void *VARGS PR_CB_Malloc(int size); //these functions should be tracked by the library reliably, so there should be no need to track them ourselves.
|
||||
void VARGS PR_CB_Free(void *mem);
|
||||
|
||||
|
|
|
@ -2307,8 +2307,6 @@ static int Surf_LM_FillBlock (int texnum, int w, int h, int x, int y)
|
|||
return texnum;
|
||||
}
|
||||
|
||||
static int nColinElim;
|
||||
|
||||
/*
|
||||
================
|
||||
BuildSurfaceDisplayList
|
||||
|
|
|
@ -59,7 +59,9 @@ static Security_Supported_Binaries_t Security_Supported_Binaries;
|
|||
static Security_Shutdown_t Security_Shutdown;
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
static void *secmodule;
|
||||
#endif
|
||||
|
||||
static void Validation_Version(void)
|
||||
{
|
||||
|
|
|
@ -2585,7 +2585,7 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
|
|||
//flare
|
||||
int r, g, b;
|
||||
extern index_t r_quad_indexes[6];
|
||||
static vec2_t st[4] = {0,0,0,1,1,1,1,0};
|
||||
static vec2_t st[4] = {{0,0},{0,1},{1,1},{1,0}};
|
||||
|
||||
mesh = out->mesh = (mesh_t *)Hunk_Alloc(sizeof(mesh_t));
|
||||
mesh->xyz_array = (vecV_t *)Hunk_Alloc(sizeof(vecV_t)*4);
|
||||
|
@ -2741,7 +2741,7 @@ qboolean CModRBSP_LoadRFaces (lump_t *l)
|
|||
{
|
||||
// int r, g, b;
|
||||
extern index_t r_quad_indexes[6];
|
||||
static vec2_t st[4] = {0,0,0,1,1,1,1,0};
|
||||
static vec2_t st[4] = {{0,0},{0,1},{1,1},{1,0}};
|
||||
|
||||
mesh = out->mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
|
||||
mesh->xyz_array = (vecV_t *)Hunk_Alloc ( sizeof(vecV_t));
|
||||
|
@ -3277,7 +3277,7 @@ qbyte *ReadPCXPalette(qbyte *buf, int len, qbyte *out);
|
|||
int CM_GetQ2Palette (void)
|
||||
{
|
||||
char *f;
|
||||
FS_LoadFile("pics/colormap.pcx", &f);
|
||||
FS_LoadFile("pics/colormap.pcx", (void**)&f);
|
||||
if (!f)
|
||||
{
|
||||
Con_Printf (CON_WARNING "Couldn't find pics/colormap.pcx\n");
|
||||
|
|
|
@ -1038,12 +1038,12 @@ qboolean NET_CompareAdrMasked(netadr_t a, netadr_t b, netadr_t mask)
|
|||
if (a.type == NA_IPV6 && b.type == NA_IP)
|
||||
{
|
||||
for (i = 0; i < 10; i++)
|
||||
if (a.address.ip[i] != 0)
|
||||
if (a.address.ip6[i] != 0)
|
||||
return false; //only matches if they're 0s, otherwise its not an ipv4 address there
|
||||
|
||||
for (; i < 12; i++)
|
||||
if (a.address.ip[i] != 0xff && a.address.ip[i] != 0x00) //0x00 is depricated
|
||||
return false; //only matches if they're 0s, otherwise its not an ipv4 address there
|
||||
if (a.address.ip6[i] != 0xff && a.address.ip6[i] != 0x00) //0x00 is depricated
|
||||
return false; //only matches if they're 0s or ffs, otherwise its not an ipv4 address there
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
|
|
|
@ -222,24 +222,27 @@ static void Plug_RegisterBuiltinIndex(char *name, Plug_Builtin_t bi, int flags,
|
|||
}
|
||||
*/
|
||||
|
||||
qintptr_t VARGS Plug_FindBuiltin(void *offset, quintptr_t mask, const qintptr_t *args)
|
||||
static qintptr_t Plug_FindBuiltin(qboolean native, char *p)
|
||||
{
|
||||
int i;
|
||||
char *p = (char *)VM_POINTER(args[0]);
|
||||
|
||||
for (i = 0; i < numplugbuiltins; i++)
|
||||
if (plugbuiltins[i].name)
|
||||
if (p && !strcmp(plugbuiltins[i].name, p))
|
||||
{
|
||||
if (offset && plugbuiltins[i].flags & PLUG_BIF_DLLONLY)
|
||||
if (!native && plugbuiltins[i].flags & PLUG_BIF_DLLONLY)
|
||||
return 0; //block it, if not native
|
||||
if (!offset && plugbuiltins[i].flags & PLUG_BIF_QVMONLY)
|
||||
if (native && plugbuiltins[i].flags & PLUG_BIF_QVMONLY)
|
||||
return 0; //block it, if not native
|
||||
return -i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
qintptr_t VARGS Plug_GetBuiltin(void *offset, quintptr_t mask, const qintptr_t *args)
|
||||
{
|
||||
char *p = (char *)VM_POINTER(args[0]);
|
||||
return Plug_FindBuiltin(!offset, p);
|
||||
}
|
||||
|
||||
int Plug_SystemCallsVM(void *offset, quintptr_t mask, int fn, const int *arg)
|
||||
{
|
||||
|
@ -300,7 +303,6 @@ static qintptr_t EXPORT_FN Plug_SystemCallsNative(qintptr_t arg, ...)
|
|||
plugin_t *Plug_Load(char *file)
|
||||
{
|
||||
plugin_t *newplug;
|
||||
qintptr_t argarray;
|
||||
|
||||
for (newplug = plugs; newplug; newplug = newplug->next)
|
||||
{
|
||||
|
@ -321,8 +323,7 @@ plugin_t *Plug_Load(char *file)
|
|||
newplug->next = plugs;
|
||||
plugs = newplug;
|
||||
|
||||
argarray = 4;
|
||||
if (!VM_Call(newplug->vm, 0, Plug_FindBuiltin("Plug_GetEngineFunction"-4, ~0, &argarray)))
|
||||
if (!VM_Call(newplug->vm, 0, Plug_FindBuiltin(true, "Plug_GetEngineFunction")))
|
||||
{
|
||||
Plug_Close(newplug);
|
||||
return NULL;
|
||||
|
@ -1429,7 +1430,7 @@ void Plug_Init(void)
|
|||
Cmd_AddCommand("plug_load", Plug_Load_f);
|
||||
Cmd_AddCommand("plug_list", Plug_List_f);
|
||||
|
||||
Plug_RegisterBuiltin("Plug_GetEngineFunction", Plug_FindBuiltin, 0);//plugin wishes to find a builtin number.
|
||||
Plug_RegisterBuiltin("Plug_GetEngineFunction", Plug_GetBuiltin, 0);//plugin wishes to find a builtin number.
|
||||
Plug_RegisterBuiltin("Plug_ExportToEngine", Plug_ExportToEngine, 0); //plugin has a call back that we might be interested in.
|
||||
Plug_RegisterBuiltin("Plug_ExportNative", Plug_ExportNative, PLUG_BIF_DLLONLY);
|
||||
Plug_RegisterBuiltin("Con_Print", Plug_Con_Print, 0); //printf is not possible - qvm floats are never doubles, vararg floats in a cdecl call are always converted to doubles.
|
||||
|
|
|
@ -197,8 +197,6 @@ LINE TESTING IN HULLS
|
|||
===============================================================================
|
||||
*/
|
||||
|
||||
static vec3_t trace_extents;
|
||||
|
||||
/*returns if it actually did a trace*/
|
||||
static qboolean PM_TransformedHullCheck (model_t *model, vec3_t start, vec3_t end, trace_t *trace, vec3_t origin, vec3_t angles)
|
||||
{
|
||||
|
|
|
@ -156,7 +156,7 @@ void VARGS PR_BIError(progfuncs_t *progfuncs, char *format, ...)
|
|||
}
|
||||
|
||||
|
||||
pbool QC_WriteFile(char *name, void *data, int len)
|
||||
pbool QC_WriteFile(const char *name, void *data, int len)
|
||||
{
|
||||
char buffer[256];
|
||||
sprintf(buffer, "%s", name);
|
||||
|
|
|
@ -81,7 +81,7 @@ typedef struct lh_extension_s {
|
|||
extern lh_extension_t QSG_Extensions[];
|
||||
extern unsigned int QSG_Extensions_count;
|
||||
|
||||
pbool QC_WriteFile(char *name, void *data, int len);
|
||||
pbool QC_WriteFile(const char *name, void *data, int len);
|
||||
void *VARGS PR_CB_Malloc(int size); //these functions should be tracked by the library reliably, so there should be no need to track them ourselves.
|
||||
void VARGS PR_CB_Free(void *mem);
|
||||
|
||||
|
|
|
@ -855,11 +855,11 @@ typedef struct {
|
|||
|
||||
// field declarations
|
||||
#ifdef MSG_SHOWNET
|
||||
# define PS_FIELD(n,b) { #n, ((int)&(((q3playerState_t *)0)->n)), b }
|
||||
# define ES_FIELD(n,b) { #n, ((int)&(((q3entityState_t *)0)->n)), b }
|
||||
# define PS_FIELD(n,b) { #n, ((size_t)&(((q3playerState_t *)0)->n)), b }
|
||||
# define ES_FIELD(n,b) { #n, ((size_t)&(((q3entityState_t *)0)->n)), b }
|
||||
#else
|
||||
# define PS_FIELD(n,b) { ((int)&(((q3playerState_t *)0)->n)), b }
|
||||
# define ES_FIELD(n,b) { ((int)&(((q3entityState_t *)0)->n)), b }
|
||||
# define PS_FIELD(n,b) { ((size_t)&(((q3playerState_t *)0)->n)), b }
|
||||
# define ES_FIELD(n,b) { ((size_t)&(((q3entityState_t *)0)->n)), b }
|
||||
#endif
|
||||
|
||||
// field data accessing
|
||||
|
|
|
@ -573,10 +573,10 @@ static void inline QVM_Return(qvm_t *vm, int size)
|
|||
Sys_Error("VM run time error: freed too much stack\n");
|
||||
|
||||
if(fp[1]>=vm->len_cs*2)
|
||||
if ((int)(vm->cs+fp[1]) != (int)RETURNOFFSETMARKER) //this being false causes the program to quit.
|
||||
if ((size_t)(vm->cs+fp[1]) != (size_t)RETURNOFFSETMARKER) //this being false causes the program to quit.
|
||||
Sys_Error("VM run time error: program returned to hyperspace (%p, %p)\n", (char*)vm->cs, (char*)fp[1]);
|
||||
if(fp[1]<0)
|
||||
if ((int)(vm->cs+fp[1]) != (int)RETURNOFFSETMARKER)
|
||||
if ((size_t)(vm->cs+fp[1]) != (size_t)RETURNOFFSETMARKER)
|
||||
Sys_Error("VM run time error: program returned to negative hyperspace\n");
|
||||
|
||||
if (vm->sp-vm->max_sp != fp[0])
|
||||
|
@ -657,7 +657,7 @@ int QVM_ExecVM(register qvm_t *qvm, int command, int arg0, int arg1, int arg2, i
|
|||
case OP_LEAVE:
|
||||
QVM_Return(qvm, param);
|
||||
|
||||
if ((int)qvm->pc == (int)RETURNOFFSETMARKER)
|
||||
if ((size_t)qvm->pc == (size_t)RETURNOFFSETMARKER)
|
||||
{
|
||||
// pick return value from stack
|
||||
qvm->pc = oldpc;
|
||||
|
|
|
@ -1143,7 +1143,7 @@ static void GenerateTCMods(const shaderpass_t *pass, int passnum)
|
|||
|
||||
//source is always packed
|
||||
//dest is packed too
|
||||
static void colourgen(const shaderpass_t *pass, int cnt, const vec4_t *src, vec4_t *dst, const mesh_t *mesh)
|
||||
static void colourgen(const shaderpass_t *pass, int cnt, vec4_t *src, vec4_t *dst, const mesh_t *mesh)
|
||||
{
|
||||
switch (pass->rgbgen)
|
||||
{
|
||||
|
@ -1287,7 +1287,7 @@ static void colourgen(const shaderpass_t *pass, int cnt, const vec4_t *src, vec4
|
|||
}
|
||||
}
|
||||
|
||||
static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV_t *dst, const mesh_t *mesh)
|
||||
static void deformgen(const deformv_t *deformv, int cnt, vecV_t *src, vecV_t *dst, const mesh_t *mesh)
|
||||
{
|
||||
float *table;
|
||||
int j, k;
|
||||
|
@ -1297,14 +1297,14 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV
|
|||
{
|
||||
default:
|
||||
case DEFORMV_NONE:
|
||||
if (src != (const avec4_t*)dst)
|
||||
if (src != dst)
|
||||
memcpy(dst, src, sizeof(*src)*cnt);
|
||||
break;
|
||||
|
||||
case DEFORMV_WAVE:
|
||||
if (!mesh->normals_array)
|
||||
{
|
||||
if (src != (const avec4_t*)dst)
|
||||
if (src != dst)
|
||||
memcpy(dst, src, sizeof(*src)*cnt);
|
||||
return;
|
||||
}
|
||||
|
@ -1326,7 +1326,7 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV
|
|||
case DEFORMV_NORMAL:
|
||||
//normal does not actually move the verts, but it does change the normals array
|
||||
//we don't currently support that.
|
||||
if (src != (const avec4_t*)dst)
|
||||
if (src != dst)
|
||||
memcpy(dst, src, sizeof(*src)*cnt);
|
||||
/*
|
||||
args[0] = deformv->args[1] * shaderstate.curtime;
|
||||
|
@ -1546,7 +1546,7 @@ static void GenerateVertexDeforms(const shader_t *shader)
|
|||
|
||||
/*======================================alpha ===============================*/
|
||||
|
||||
static void alphagen(const shaderpass_t *pass, int cnt, const avec4_t *src, avec4_t *dst, const mesh_t *mesh)
|
||||
static void alphagen(const shaderpass_t *pass, int cnt, avec4_t *const src, avec4_t *dst, const mesh_t *mesh)
|
||||
{
|
||||
float *table;
|
||||
float t;
|
||||
|
@ -2790,7 +2790,6 @@ void BE_DrawPolys(qboolean decalsset)
|
|||
}
|
||||
void GLBE_SubmitBatch(batch_t *batch)
|
||||
{
|
||||
model_t *model = cl.worldmodel;
|
||||
int lm;
|
||||
|
||||
if (batch->texture)
|
||||
|
@ -3047,6 +3046,8 @@ void BE_GenModelBatches(batch_t **batches)
|
|||
continue;
|
||||
R_GAlias_GenerateBatches(ent, batches);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,8 +130,6 @@ int sizeofuploadmemorybuffer;
|
|||
qbyte *uploadmemorybufferintermediate;
|
||||
int sizeofuploadmemorybufferintermediate;
|
||||
|
||||
static index_t r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
|
||||
|
||||
extern qbyte gammatable[256];
|
||||
|
||||
#ifdef GL_USE8BITTEX
|
||||
|
@ -738,9 +736,6 @@ void GLR_Menutint_Callback (struct cvar_s *var, char *oldvalue)
|
|||
|
||||
void GLDraw_FadeScreen (void)
|
||||
{
|
||||
extern cvar_t gl_menutint_shader;
|
||||
extern texid_t scenepp_texture;
|
||||
extern int scenepp_mt_program, scenepp_mt_parm_colorf, scenepp_mt_parm_inverti;
|
||||
extern shader_t *scenepp_mt_shader;
|
||||
|
||||
if (!faderender)
|
||||
|
|
|
@ -84,6 +84,9 @@ qboolean GenerateNormalisationCubeMap()
|
|||
unsigned char * bytePtr;
|
||||
|
||||
int i, j;
|
||||
|
||||
normalisationCubeMap = GL_AllocNewTexture();
|
||||
GL_BindType(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
|
||||
|
||||
//positive x
|
||||
bytePtr=data;
|
||||
|
@ -222,6 +225,13 @@ qboolean GenerateNormalisationCubeMap()
|
|||
}
|
||||
qglTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
|
||||
0, GL_RGBA8, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
|
||||
|
||||
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -237,27 +247,14 @@ R_Init
|
|||
*/
|
||||
void GLR_ReInit (void)
|
||||
{
|
||||
extern int gl_bumpmappingpossible;
|
||||
|
||||
|
||||
netgraphtexture = GL_AllocNewTexture(0, 0);
|
||||
|
||||
#if 0
|
||||
extern int gl_bumpmappingpossible;
|
||||
if (gl_bumpmappingpossible)
|
||||
{
|
||||
//Create normalisation cube map
|
||||
normalisationCubeMap = GL_AllocNewTexture();
|
||||
GL_BindType(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
|
||||
GenerateNormalisationCubeMap();
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
qglTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
}
|
||||
else
|
||||
normalisationCubeMap = 0;
|
||||
#endif
|
||||
netgraphtexture = GL_AllocNewTexture(0, 0);
|
||||
|
||||
R_InitBloomTextures();
|
||||
R_InitFlashblends();
|
||||
|
|
|
@ -56,7 +56,6 @@ typedef struct shadowmesh_s {
|
|||
/*state of the current shadow mesh*/
|
||||
#define inc 128
|
||||
int sh_shadowframe;
|
||||
static int sh_type;
|
||||
static int sh_firstindex;
|
||||
static int sh_vertnum; //vertex number (set to 0 at SH_Begin)
|
||||
static shadowmesh_t *sh_shmesh, sh_tempshmesh;
|
||||
|
@ -1130,7 +1129,18 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs)
|
|||
// clipped by nearclip plane
|
||||
// this is nasty and crude...
|
||||
// create viewspace bbox
|
||||
for (i = 0;i < 8;i++)
|
||||
i = 0;
|
||||
/*unrolled the first iteration to avoid warnings*/
|
||||
v[0] = ((i & 1) ? mins[0] : maxs[0]) - r_refdef.vieworg[0];
|
||||
v[1] = ((i & 2) ? mins[1] : maxs[1]) - r_refdef.vieworg[1];
|
||||
v[2] = ((i & 4) ? mins[2] : maxs[2]) - r_refdef.vieworg[2];
|
||||
v2[0] = DotProduct(v, vright);
|
||||
v2[1] = DotProduct(v, vup);
|
||||
v2[2] = DotProduct(v, vpn);
|
||||
smins[0] = smaxs[0] = v2[0];
|
||||
smins[1] = smaxs[1] = v2[1];
|
||||
smins[2] = smaxs[2] = v2[2];
|
||||
for (i = 1;i < 8;i++)
|
||||
{
|
||||
v[0] = ((i & 1) ? mins[0] : maxs[0]) - r_refdef.vieworg[0];
|
||||
v[1] = ((i & 2) ? mins[1] : maxs[1]) - r_refdef.vieworg[1];
|
||||
|
@ -1138,21 +1148,12 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs)
|
|||
v2[0] = DotProduct(v, vright);
|
||||
v2[1] = DotProduct(v, vup);
|
||||
v2[2] = DotProduct(v, vpn);
|
||||
if (i)
|
||||
{
|
||||
if (smins[0] > v2[0]) smins[0] = v2[0];
|
||||
if (smaxs[0] < v2[0]) smaxs[0] = v2[0];
|
||||
if (smins[1] > v2[1]) smins[1] = v2[1];
|
||||
if (smaxs[1] < v2[1]) smaxs[1] = v2[1];
|
||||
if (smins[2] > v2[2]) smins[2] = v2[2];
|
||||
if (smaxs[2] < v2[2]) smaxs[2] = v2[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
smins[0] = smaxs[0] = v2[0];
|
||||
smins[1] = smaxs[1] = v2[1];
|
||||
smins[2] = smaxs[2] = v2[2];
|
||||
}
|
||||
if (smins[0] > v2[0]) smins[0] = v2[0];
|
||||
if (smaxs[0] < v2[0]) smaxs[0] = v2[0];
|
||||
if (smins[1] > v2[1]) smins[1] = v2[1];
|
||||
if (smaxs[1] < v2[1]) smaxs[1] = v2[1];
|
||||
if (smins[2] > v2[2]) smins[2] = v2[2];
|
||||
if (smaxs[2] < v2[2]) smaxs[2] = v2[2];
|
||||
}
|
||||
// now we have a bbox in viewspace
|
||||
// clip it to the view plane
|
||||
|
|
|
@ -142,9 +142,9 @@ struct progfuncs_s {
|
|||
typedef struct progexterns_s {
|
||||
int progsversion; //PROGSTRUCT_VERSION
|
||||
|
||||
unsigned char *(*ReadFile) (char *fname, void *buffer, int len);
|
||||
int (*FileSize) (char *fname); //-1 if file does not exist
|
||||
pbool (*WriteFile) (char *name, void *data, int len);
|
||||
unsigned char *(*ReadFile) (const char *fname, void *buffer, int len);
|
||||
int (*FileSize) (const char *fname); //-1 if file does not exist
|
||||
pbool (*WriteFile) (const char *name, void *data, int len);
|
||||
int (VARGS *printf) (const char *, ...) LIKEPRINTF(1);
|
||||
void (VARGS *Sys_Error) (const char *, ...) LIKEPRINTF(1);
|
||||
void (VARGS *Abort) (char *, ...) LIKEPRINTF(1);
|
||||
|
|
Loading…
Reference in a new issue