1
0
Fork 0
forked from fte/fteqw

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:
Spoike 2011-01-29 21:01:40 +00:00
parent 4fb854e261
commit dc2212aa84
19 changed files with 184 additions and 168 deletions

View file

@ -723,24 +723,27 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
case UI_CVAR_SET: case UI_CVAR_SET:
{ {
cvar_t *var; 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 else
{ {
var = Cvar_FindVar(VM_POINTER(arg[0])); var = Cvar_FindVar(vname);
if (var) if (var)
Cvar_Set(var, VM_POINTER(arg[1])); //set it Cvar_Set(var, vval); //set it
else 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; break;
case UI_CVAR_VARIABLEVALUE: case UI_CVAR_VARIABLEVALUE:
{ {
cvar_t *var; cvar_t *var;
var = Cvar_FindVar(VM_POINTER(arg[0])); char *vname = VM_POINTER(arg[0]);
var = Cvar_FindVar(vname);
if (var) if (var)
VM_FLOAT(ret) = var->value; VM_FLOAT(ret) = var->value;
else else
@ -750,7 +753,8 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
case UI_CVAR_VARIABLESTRINGBUFFER: case UI_CVAR_VARIABLESTRINGBUFFER:
{ {
cvar_t *var; 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])) if (!VM_LONG(arg[2]))
VM_LONG(ret) = 0; VM_LONG(ret) = 0;
else if (!var) 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 case UI_CVAR_RESET: //cvar reset
{ {
cvar_t *var; cvar_t *var;
var = Cvar_FindVar((char *)VM_POINTER(arg[0])); char *vname = VM_POINTER(arg[0]);
var = Cvar_FindVar(vname);
if (var) if (var)
Cvar_Set(var, var->defaultstr); Cvar_Set(var, var->defaultstr);
} }
break; break;
case UI_CMD_EXECUTETEXT: case UI_CMD_EXECUTETEXT:
if (!strncmp((char*)VM_POINTER(arg[1]), "ping ", 5))
{ {
int i; char *cmdtext = VM_POINTER(arg[1]);
for (i = 0; i < MAX_PINGREQUESTS; i++) if (!strncmp(cmdtext, "ping ", 5))
if (ui_pings[i].type == NA_INVALID) {
{ int i;
serverinfo_t *info; for (i = 0; i < MAX_PINGREQUESTS; i++)
NET_StringToAdr((char *)VM_POINTER(arg[1]) + 5, &ui_pings[i]); if (ui_pings[i].type == NA_INVALID)
info = Master_InfoForServer(ui_pings[i]);
if (info)
{ {
info->special |= SS_KEEPINFO; serverinfo_t *info;
Master_QueryServer(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; break;
case UI_FS_FOPENFILE: //fopen case UI_FS_FOPENFILE: //fopen
@ -973,15 +981,20 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
break; break;
case UI_GETGLCONFIG: //get glconfig 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 //do any needed work
memset(VM_POINTER(arg[0]), 0, 11304); memset(cfg, 0, 11304);
*(int *)VM_POINTER(arg[0]+11304) = vid.width; *(int *)(cfg+11304) = vid.width;
*(int *)VM_POINTER(arg[0]+11308) = vid.height; *(int *)(cfg+11308) = vid.height;
*(float *)VM_POINTER(arg[0]+11312) = (float)vid.width/vid.height; *(float *)(cfg+11312) = (float)vid.width/vid.height;
memset(VM_POINTER(arg[0]+11316), 0, 11332-11316); memset(cfg+11316, 0, 11332-11316);
}
break; break;
case UI_GETCLIENTSTATE: //get client state 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; break;
case UI_GET_CDKEY: //get cd key 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. char *keydest = VM_POINTER(arg[0]);
strncpy(VM_POINTER(arg[0]), Cvar_VariableString("cl_cdkey"), VM_LONG(arg[1])); 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; break;
case UI_SET_CDKEY: //set cd key 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; 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 = Cvar_Get("cl_cdkey", "", 0, "Quake3 auth");
Cvar_Set(cvar, VM_POINTER(arg[0])); Cvar_Set(cvar, keysrc);
} }
break; break;
@ -1155,19 +1172,30 @@ static qintptr_t UI_SystemCalls(void *offset, quintptr_t mask, qintptr_t fn, con
// standard Q3 // standard Q3
case UI_MEMSET: case UI_MEMSET:
if ((int)arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset) {
break; //out of bounds. void *dest = VM_POINTER(arg[0]);
memset(VM_POINTER(arg[0]), arg[1], arg[2]); if ((int)arg[0] + arg[2] >= mask || dest < offset)
break; //out of bounds.
memset(dest, arg[1], arg[2]);
}
break; break;
case UI_MEMCPY: case UI_MEMCPY:
if ((int)arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset) {
break; //out of bounds. void *dest = VM_POINTER(arg[0]);
memcpy(VM_POINTER(arg[0]), VM_POINTER(arg[1]), arg[2]); 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; break;
case UI_STRNCPY: case UI_STRNCPY:
if (arg[0] + arg[2] >= mask || VM_POINTER(arg[0]) < offset) {
break; //out of bounds. void *dest = VM_POINTER(arg[0]);
Q_strncpyS(VM_POINTER(arg[0]), VM_POINTER(arg[1]), arg[2]); 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; break;
case UI_SIN: case UI_SIN:
VM_FLOAT(ret)=(float)sin(VM_FLOAT(arg[0])); 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) 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) { //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)) #if __WORDSIZE == 32
{ return UI_SystemCalls(offset, mask, fn, (qintptr_t*)arg);
return UI_SystemCalls(offset, mask, fn, arg); #else
} qintptr_t args[9];
else
{
qintptr_t args[9];
args[0]=arg[0]; args[0]=arg[0];
args[1]=arg[1]; args[1]=arg[1];
args[2]=arg[2]; args[2]=arg[2];
args[3]=arg[3]; args[3]=arg[3];
args[4]=arg[4]; args[4]=arg[4];
args[5]=arg[5]; args[5]=arg[5];
args[6]=arg[6]; args[6]=arg[6];
args[7]=arg[7]; args[7]=arg[7];
args[8]=arg[8]; 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. //I'm not keen on this.

View file

@ -251,8 +251,6 @@ qboolean Cmd_IsCommand (char *line)
int PaddedPrint (char *s, int x) int PaddedPrint (char *s, int x)
{ {
int nextcolx = 0;
Con_Printf ("%s\t", s); Con_Printf ("%s\t", s);
x+=strlen(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 //if true, the input code is expected to return mouse cursor positions rather than deltas
extern cvar_t cl_prydoncursor; extern cvar_t cl_prydoncursor;
extern int mouseusedforgui; // extern int mouseusedforgui;
// if (mouseusedforgui) //I don't like this // if (mouseusedforgui) //I don't like this
// return true; // return true;

View file

@ -367,11 +367,11 @@ typedef struct csqcedict_s
static void CSQC_InitFields(void) static void CSQC_InitFields(void)
{ //CHANGING THIS FUNCTION REQUIRES CHANGES TO csqcentvars_t { //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 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, (int)&((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, (int)&((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, (int)&((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, (int)&((csqcentvars_t*)0)->name, -1) #define comfieldfunction(ssqcname,wname,name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
comqcfields comqcfields
#undef comfieldfloat #undef comfieldfloat
#undef comfieldvector #undef comfieldvector
@ -380,17 +380,17 @@ comqcfields
#undef comfieldfunction #undef comfieldfunction
#ifdef VM_Q1 #ifdef VM_Q1
#define comfieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #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) + (int)&((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) + (int)&((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) + (int)&((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) + (int)&((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 #else
#define comfieldfloat(name) PR_RegisterFieldVar(csqcprogs, ev_float, #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, (int)&((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, (int)&((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, (int)&((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, (int)&((csqcentvars_t*)0)->name, -1) #define comfieldfunction(name) PR_RegisterFieldVar(csqcprogs, ev_function, #name, (size_t)&((csqcentvars_t*)0)->name, -1)
#endif #endif
comextqcfields comextqcfields
csqcextfields csqcextfields
@ -5060,7 +5060,7 @@ void CSQC_Shutdown(void)
} }
//when the qclib needs a file, it calls out to this function. //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; qbyte *file;
@ -5115,7 +5115,7 @@ qbyte *CSQC_PRLoadFile (char *path, void *buffer, int bufsize)
return COM_LoadStackFile(path, buffer, bufsize); return COM_LoadStackFile(path, buffer, bufsize);
} }
int CSQC_PRFileSize (char *path) int CSQC_PRFileSize (const char *path)
{ {
qbyte *file; qbyte *file;

View file

@ -973,7 +973,6 @@ void QCBUILTIN QCBUILTIN PF_cl_getmousepos (progfuncs_t *prinst, struct globalva
{ {
float *ret = G_VECTOR(OFS_RETURN); float *ret = G_VECTOR(OFS_RETURN);
extern int mousemove_x, mousemove_y; extern int mousemove_x, mousemove_y;
extern int mousecursor_x, mousecursor_y;
ret[0] = mousemove_x; ret[0] = mousemove_x;
ret[1] = mousemove_y; ret[1] = mousemove_y;
@ -981,6 +980,7 @@ void QCBUILTIN QCBUILTIN PF_cl_getmousepos (progfuncs_t *prinst, struct globalva
mousemove_x=0; mousemove_x=0;
mousemove_y=0; mousemove_y=0;
// extern int mousecursor_x, mousecursor_y;
// ret[0] = mousecursor_x; // ret[0] = mousecursor_x;
// ret[1] = mousecursor_y; // ret[1] = mousecursor_y;
ret[2] = 0; 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_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); void VARGS PR_CB_Free(void *mem);

View file

@ -2307,8 +2307,6 @@ static int Surf_LM_FillBlock (int texnum, int w, int h, int x, int y)
return texnum; return texnum;
} }
static int nColinElim;
/* /*
================ ================
BuildSurfaceDisplayList BuildSurfaceDisplayList

View file

@ -59,7 +59,9 @@ static Security_Supported_Binaries_t Security_Supported_Binaries;
static Security_Shutdown_t Security_Shutdown; static Security_Shutdown_t Security_Shutdown;
#ifdef _WIN32
static void *secmodule; static void *secmodule;
#endif
static void Validation_Version(void) static void Validation_Version(void)
{ {

View file

@ -2585,7 +2585,7 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
//flare //flare
int r, g, b; int r, g, b;
extern index_t r_quad_indexes[6]; 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 = out->mesh = (mesh_t *)Hunk_Alloc(sizeof(mesh_t));
mesh->xyz_array = (vecV_t *)Hunk_Alloc(sizeof(vecV_t)*4); 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; // int r, g, b;
extern index_t r_quad_indexes[6]; 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 = out->mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
mesh->xyz_array = (vecV_t *)Hunk_Alloc ( sizeof(vecV_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) int CM_GetQ2Palette (void)
{ {
char *f; char *f;
FS_LoadFile("pics/colormap.pcx", &f); FS_LoadFile("pics/colormap.pcx", (void**)&f);
if (!f) if (!f)
{ {
Con_Printf (CON_WARNING "Couldn't find pics/colormap.pcx\n"); Con_Printf (CON_WARNING "Couldn't find pics/colormap.pcx\n");

View file

@ -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) if (a.type == NA_IPV6 && b.type == NA_IP)
{ {
for (i = 0; i < 10; i++) 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 return false; //only matches if they're 0s, otherwise its not an ipv4 address there
for (; i < 12; i++) for (; i < 12; i++)
if (a.address.ip[i] != 0xff && a.address.ip[i] != 0x00) //0x00 is depricated if (a.address.ip6[i] != 0xff && a.address.ip6[i] != 0x00) //0x00 is depricated
return false; //only matches if they're 0s, otherwise its not an ipv4 address there return false; //only matches if they're 0s or ffs, otherwise its not an ipv4 address there
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {

View file

@ -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; int i;
char *p = (char *)VM_POINTER(args[0]);
for (i = 0; i < numplugbuiltins; i++) for (i = 0; i < numplugbuiltins; i++)
if (plugbuiltins[i].name) if (plugbuiltins[i].name)
if (p && !strcmp(plugbuiltins[i].name, p)) 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 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 0; //block it, if not native
return -i; return -i;
} }
return 0; 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) 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 *Plug_Load(char *file)
{ {
plugin_t *newplug; plugin_t *newplug;
qintptr_t argarray;
for (newplug = plugs; newplug; newplug = newplug->next) for (newplug = plugs; newplug; newplug = newplug->next)
{ {
@ -321,8 +323,7 @@ plugin_t *Plug_Load(char *file)
newplug->next = plugs; newplug->next = plugs;
plugs = newplug; plugs = newplug;
argarray = 4; if (!VM_Call(newplug->vm, 0, Plug_FindBuiltin(true, "Plug_GetEngineFunction")))
if (!VM_Call(newplug->vm, 0, Plug_FindBuiltin("Plug_GetEngineFunction"-4, ~0, &argarray)))
{ {
Plug_Close(newplug); Plug_Close(newplug);
return NULL; return NULL;
@ -1429,7 +1430,7 @@ void Plug_Init(void)
Cmd_AddCommand("plug_load", Plug_Load_f); Cmd_AddCommand("plug_load", Plug_Load_f);
Cmd_AddCommand("plug_list", Plug_List_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_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("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. 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.

View file

@ -197,8 +197,6 @@ LINE TESTING IN HULLS
=============================================================================== ===============================================================================
*/ */
static vec3_t trace_extents;
/*returns if it actually did a trace*/ /*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) static qboolean PM_TransformedHullCheck (model_t *model, vec3_t start, vec3_t end, trace_t *trace, vec3_t origin, vec3_t angles)
{ {

View file

@ -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]; char buffer[256];
sprintf(buffer, "%s", name); sprintf(buffer, "%s", name);

View file

@ -81,7 +81,7 @@ typedef struct lh_extension_s {
extern lh_extension_t QSG_Extensions[]; extern lh_extension_t QSG_Extensions[];
extern unsigned int QSG_Extensions_count; 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_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); void VARGS PR_CB_Free(void *mem);

View file

@ -855,11 +855,11 @@ typedef struct {
// field declarations // field declarations
#ifdef MSG_SHOWNET #ifdef MSG_SHOWNET
# define PS_FIELD(n,b) { #n, ((int)&(((q3playerState_t *)0)->n)), b } # define PS_FIELD(n,b) { #n, ((size_t)&(((q3playerState_t *)0)->n)), b }
# define ES_FIELD(n,b) { #n, ((int)&(((q3entityState_t *)0)->n)), b } # define ES_FIELD(n,b) { #n, ((size_t)&(((q3entityState_t *)0)->n)), b }
#else #else
# define PS_FIELD(n,b) { ((int)&(((q3playerState_t *)0)->n)), b } # define PS_FIELD(n,b) { ((size_t)&(((q3playerState_t *)0)->n)), b }
# define ES_FIELD(n,b) { ((int)&(((q3entityState_t *)0)->n)), b } # define ES_FIELD(n,b) { ((size_t)&(((q3entityState_t *)0)->n)), b }
#endif #endif
// field data accessing // field data accessing

View file

@ -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"); Sys_Error("VM run time error: freed too much stack\n");
if(fp[1]>=vm->len_cs*2) 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]); Sys_Error("VM run time error: program returned to hyperspace (%p, %p)\n", (char*)vm->cs, (char*)fp[1]);
if(fp[1]<0) 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"); Sys_Error("VM run time error: program returned to negative hyperspace\n");
if (vm->sp-vm->max_sp != fp[0]) 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: case OP_LEAVE:
QVM_Return(qvm, param); QVM_Return(qvm, param);
if ((int)qvm->pc == (int)RETURNOFFSETMARKER) if ((size_t)qvm->pc == (size_t)RETURNOFFSETMARKER)
{ {
// pick return value from stack // pick return value from stack
qvm->pc = oldpc; qvm->pc = oldpc;

View file

@ -1143,7 +1143,7 @@ static void GenerateTCMods(const shaderpass_t *pass, int passnum)
//source is always packed //source is always packed
//dest is packed too //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) 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; float *table;
int j, k; int j, k;
@ -1297,14 +1297,14 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV
{ {
default: default:
case DEFORMV_NONE: case DEFORMV_NONE:
if (src != (const avec4_t*)dst) if (src != dst)
memcpy(dst, src, sizeof(*src)*cnt); memcpy(dst, src, sizeof(*src)*cnt);
break; break;
case DEFORMV_WAVE: case DEFORMV_WAVE:
if (!mesh->normals_array) if (!mesh->normals_array)
{ {
if (src != (const avec4_t*)dst) if (src != dst)
memcpy(dst, src, sizeof(*src)*cnt); memcpy(dst, src, sizeof(*src)*cnt);
return; return;
} }
@ -1326,7 +1326,7 @@ static void deformgen(const deformv_t *deformv, int cnt, const vecV_t *src, vecV
case DEFORMV_NORMAL: case DEFORMV_NORMAL:
//normal does not actually move the verts, but it does change the normals array //normal does not actually move the verts, but it does change the normals array
//we don't currently support that. //we don't currently support that.
if (src != (const avec4_t*)dst) if (src != dst)
memcpy(dst, src, sizeof(*src)*cnt); memcpy(dst, src, sizeof(*src)*cnt);
/* /*
args[0] = deformv->args[1] * shaderstate.curtime; args[0] = deformv->args[1] * shaderstate.curtime;
@ -1546,7 +1546,7 @@ static void GenerateVertexDeforms(const shader_t *shader)
/*======================================alpha ===============================*/ /*======================================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 *table;
float t; float t;
@ -2790,7 +2790,6 @@ void BE_DrawPolys(qboolean decalsset)
} }
void GLBE_SubmitBatch(batch_t *batch) void GLBE_SubmitBatch(batch_t *batch)
{ {
model_t *model = cl.worldmodel;
int lm; int lm;
if (batch->texture) if (batch->texture)
@ -3047,6 +3046,8 @@ void BE_GenModelBatches(batch_t **batches)
continue; continue;
R_GAlias_GenerateBatches(ent, batches); R_GAlias_GenerateBatches(ent, batches);
break; break;
default:
break;
} }
} }
} }

View file

@ -130,8 +130,6 @@ int sizeofuploadmemorybuffer;
qbyte *uploadmemorybufferintermediate; qbyte *uploadmemorybufferintermediate;
int sizeofuploadmemorybufferintermediate; int sizeofuploadmemorybufferintermediate;
static index_t r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
extern qbyte gammatable[256]; extern qbyte gammatable[256];
#ifdef GL_USE8BITTEX #ifdef GL_USE8BITTEX
@ -738,9 +736,6 @@ void GLR_Menutint_Callback (struct cvar_s *var, char *oldvalue)
void GLDraw_FadeScreen (void) 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; extern shader_t *scenepp_mt_shader;
if (!faderender) if (!faderender)

View file

@ -85,6 +85,9 @@ qboolean GenerateNormalisationCubeMap()
int i, j; int i, j;
normalisationCubeMap = GL_AllocNewTexture();
GL_BindType(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
//positive x //positive x
bytePtr=data; bytePtr=data;
@ -223,6 +226,13 @@ qboolean GenerateNormalisationCubeMap()
qglTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB, qglTexImage2D( GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB,
0, GL_RGBA8, 32, 32, 0, GL_RGB, GL_UNSIGNED_BYTE, data); 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; return true;
} }
@ -237,27 +247,14 @@ R_Init
*/ */
void GLR_ReInit (void) void GLR_ReInit (void)
{ {
extern int gl_bumpmappingpossible;
netgraphtexture = GL_AllocNewTexture(0, 0);
#if 0 #if 0
extern int gl_bumpmappingpossible;
if (gl_bumpmappingpossible) if (gl_bumpmappingpossible)
{
//Create normalisation cube map
normalisationCubeMap = GL_AllocNewTexture();
GL_BindType(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
GenerateNormalisationCubeMap(); 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 else
normalisationCubeMap = 0; normalisationCubeMap = 0;
#endif #endif
netgraphtexture = GL_AllocNewTexture(0, 0);
R_InitBloomTextures(); R_InitBloomTextures();
R_InitFlashblends(); R_InitFlashblends();

View file

@ -56,7 +56,6 @@ typedef struct shadowmesh_s {
/*state of the current shadow mesh*/ /*state of the current shadow mesh*/
#define inc 128 #define inc 128
int sh_shadowframe; int sh_shadowframe;
static int sh_type;
static int sh_firstindex; static int sh_firstindex;
static int sh_vertnum; //vertex number (set to 0 at SH_Begin) static int sh_vertnum; //vertex number (set to 0 at SH_Begin)
static shadowmesh_t *sh_shmesh, sh_tempshmesh; 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 // clipped by nearclip plane
// this is nasty and crude... // this is nasty and crude...
// create viewspace bbox // 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[0] = ((i & 1) ? mins[0] : maxs[0]) - r_refdef.vieworg[0];
v[1] = ((i & 2) ? mins[1] : maxs[1]) - r_refdef.vieworg[1]; 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[0] = DotProduct(v, vright);
v2[1] = DotProduct(v, vup); v2[1] = DotProduct(v, vup);
v2[2] = DotProduct(v, vpn); 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[0] > v2[0]) smins[0] = v2[0]; if (smins[1] > v2[1]) smins[1] = v2[1];
if (smaxs[0] < v2[0]) smaxs[0] = v2[0]; if (smaxs[1] < v2[1]) smaxs[1] = v2[1];
if (smins[1] > v2[1]) smins[1] = v2[1]; if (smins[2] > v2[2]) smins[2] = v2[2];
if (smaxs[1] < v2[1]) smaxs[1] = v2[1]; if (smaxs[2] < v2[2]) smaxs[2] = v2[2];
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];
}
} }
// now we have a bbox in viewspace // now we have a bbox in viewspace
// clip it to the view plane // clip it to the view plane

View file

@ -142,9 +142,9 @@ struct progfuncs_s {
typedef struct progexterns_s { typedef struct progexterns_s {
int progsversion; //PROGSTRUCT_VERSION int progsversion; //PROGSTRUCT_VERSION
unsigned char *(*ReadFile) (char *fname, void *buffer, int len); unsigned char *(*ReadFile) (const char *fname, void *buffer, int len);
int (*FileSize) (char *fname); //-1 if file does not exist int (*FileSize) (const char *fname); //-1 if file does not exist
pbool (*WriteFile) (char *name, void *data, int len); pbool (*WriteFile) (const char *name, void *data, int len);
int (VARGS *printf) (const char *, ...) LIKEPRINTF(1); int (VARGS *printf) (const char *, ...) LIKEPRINTF(1);
void (VARGS *Sys_Error) (const char *, ...) LIKEPRINTF(1); void (VARGS *Sys_Error) (const char *, ...) LIKEPRINTF(1);
void (VARGS *Abort) (char *, ...) LIKEPRINTF(1); void (VARGS *Abort) (char *, ...) LIKEPRINTF(1);