make cheat cvars allowed in single player by default.

fix an issue with referenced packs getting forgotten when running non-dedicated servers.
whichpack now always references packs even if allow_download_refpackages is disabled.
add setcursormode for compat with dp's csqc.
fix some qcc issues that came up.
bump some q3bsp sanity limits a little.
greater precision for android's vibrate feature.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4567 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2013-12-17 22:45:37 +00:00
parent 7ac2fd1b39
commit f762446a7d
17 changed files with 134 additions and 68 deletions

View File

@ -1647,6 +1647,12 @@ void CL_CheckServerInfo(void)
if (cl.spectator || cls.demoplayback || !stricmp(s, "on"))
cls.allow_cheats = true;
#ifndef CLIENTONLY
//allow cheats in single player regardless of sv_cheats.
if (sv.state == ss_active && sv.allocated_client_slots == 1)
cls.allow_cheats = true;
#endif
s = Info_ValueForKey(cl.serverinfo, "strict");
if ((!cl.spectator && !cls.demoplayback && *s && strcmp(s, "0")) || !ruleset_allow_semicheats.ival)
{

View File

@ -2310,6 +2310,16 @@ static void cs_get_input_state (usercmd_t *cmd)
cmd->servertime = *csqcg.input_servertime*1000;
}
//#343
static void QCBUILTIN PF_cl_setcursormode (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
world_t *world = prinst->parms->user;
if (G_FLOAT(OFS_PARM0))
key_dest_absolutemouse |= world->keydestmask;
else
key_dest_absolutemouse &= ~world->keydestmask;
}
//get the input commands, and stuff them into some globals.
static void QCBUILTIN PF_cs_getinputstate (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
@ -4572,7 +4582,7 @@ static struct {
{"stringtokeynum", PF_cl_stringtokeynum, 341}, // #341 float(string keyname) stringtokeynum (EXT_CSQC)
{"getkeybind", PF_cl_getkeybind, 342}, // #342 string(float keynum) getkeybind (EXT_CSQC)
// {"?", PF_Fixme, 343}, // #343
{"setcursormode", PF_cl_setcursormode, 343}, // #343 This is a DP extension
{"getmousepos", PF_cl_getmousepos, 344}, // #344 This is a DP extension
{"getinputstate", PF_cs_getinputstate, 345}, // #345 float(float framenum) getinputstate (EXT_CSQC)
@ -6185,7 +6195,7 @@ void CSQC_ParseEntities(void)
Host_EndGame("CSQC needs to be initialized for this server.\n");
if (!csqcg.ent_update || !csqcg.self)
Host_EndGame("CSQC is unable to parse entities\n");
Host_EndGame("CSQC has no CSQC_Ent_Update function\n");
if (!csqc_world.worldmodel || csqc_world.worldmodel->needload)
Host_EndGame("world is not yet initialised\n");

View File

@ -322,13 +322,12 @@ void QCBUILTIN PF_CL_drawpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_gl
p = R2D_SafeCachePic(picname);
if (!p)
p = R2D_SafePicFromWad(picname);
G_FLOAT(OFS_RETURN) = !!p;
r2d_be_flags = PF_SelectDPDrawFlag(flag);
R2D_ImageColours(rgb[0], rgb[1], rgb[2], alpha);
R2D_Image(pos[0], pos[1], size[0], size[1], 0, 0, 1, 1, p);
r2d_be_flags = 0;
G_FLOAT(OFS_RETURN) = 1;
}
void QCBUILTIN PF_CL_drawsubpic (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)

View File

@ -772,10 +772,12 @@ void R2D_Console_Resize(void)
yratio = 1;
}
if (!cwidth && !cheight)
cheight = 480;
if (cheight && !cwidth)
cwidth = (cheight*4)/3;
cwidth = (cheight*vid.rotpixelwidth)/vid.rotpixelheight;
if (cwidth && !cheight)
cheight = (cwidth*3)/4;
cheight = (cwidth*vid.rotpixelheight)/vid.rotpixelwidth;
if (!cwidth)
cwidth = vid.rotpixelwidth;
@ -884,6 +886,10 @@ void R2D_BrightenScreen (void)
if (fabs(v_contrast.value - 1.0) < 0.05 && fabs(v_brightness.value - 0) < 0.05 && fabs(v_gamma.value - 1) < 0.05)
return;
//don't go crazy with brightness. that makes it unusable and is thus unsafe - and worse, lots of people assume its based around 1 (like gamma and contrast are). cap to 0.5
if (v_brightness.value > 0.5)
v_brightness.value = 0.5;
if (r2d_canhwgamma)
return;

View File

@ -41,9 +41,11 @@ extern cvar_t vid_conautoscale;
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, DISTRIBUTION"Droid", __VA_ARGS__))
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, DISTRIBUTION"Droid", __VA_ARGS__))
void Sys_Vibrate(int count)
void Sys_Vibrate(float count)
{
vibrateduration = count*10*sys_vibrate.value;
if (count < 0)
count = 0;
vibrateduration += count*10*sys_vibrate.value;
}
JNIEXPORT jint JNICALL Java_com_fteqw_FTEDroidEngine_getvibrateduration(JNIEnv *env, jobject obj)
{

View File

@ -352,7 +352,7 @@ typedef enum {FSLFRT_IFFOUND, FSLFRT_LENGTH, FSLFRT_DEPTH_OSONLY, FSLFRT_DEPTH_A
//returns -1 if couldn't find.
int FS_FLocateFile(const char *filename, FSLF_ReturnType_e returntype, flocation_t *loc);
struct vfsfile_s *FS_OpenReadLocation(flocation_t *location);
char *FS_WhichPackForLocation(flocation_t *loc);
char *FS_WhichPackForLocation(flocation_t *loc, qboolean makereferenced);
qboolean FS_GetPackageDownloadable(const char *package);
char *FS_GetPackHashes(char *buffer, int buffersize, qboolean referencedonly);

View File

@ -480,6 +480,15 @@ COM_Path_f
============
*/
static void COM_PathLine(searchpath_t *s)
{
Con_Printf("%s %s%s%s%s%s\n", s->logicalpath,
(s->flags & SPF_REFERENCED)?"^[(ref)\\tip\\Referenced\\desc\\Package will auto-download to clients^]":"",
(s->flags & SPF_TEMPORARY)?"^[(temp)\\tip\\Temporary\\desc\\Flushed on map change^]":"",
(s->flags & SPF_COPYPROTECTED)?"^[(c)\\tip\\Copyrighted\\desc\\Copy-Protected and is not downloadable^]":"",
(s->flags & SPF_EXPLICIT)?"^[(e)\\tip\\Explicit\\desc\\Loaded explicitly by the gamedir^]":"",
(s->flags & SPF_UNTRUSTED)?"^[(u)\\tip\\Untrusted\\desc\\Configs and scripts will not be given access to passwords^]":"" );
}
void COM_Path_f (void)
{
searchpath_t *s;
@ -491,12 +500,7 @@ void COM_Path_f (void)
Con_Printf ("Pure paths:\n");
for (s=com_purepaths ; s ; s=s->nextpure)
{
Con_Printf("%s %s%s%s%s%s\n", s->logicalpath,
(s->flags & SPF_REFERENCED)?"(ref)":"",
(s->flags & SPF_TEMPORARY)?"(temp)":"",
(s->flags & SPF_COPYPROTECTED)?"(c)":"",
(s->flags & SPF_EXPLICIT)?"(e)":"",
(s->flags & SPF_UNTRUSTED)?"(u)":"" );
COM_PathLine(s);
}
Con_Printf ("----------\n");
if (fs_puremode == 2)
@ -511,12 +515,7 @@ void COM_Path_f (void)
if (s == com_base_searchpaths)
Con_Printf ("----------\n");
Con_Printf("%s %s%s%s%s%s\n", s->logicalpath,
(s->flags & SPF_REFERENCED)?"(ref)":"",
(s->flags & SPF_TEMPORARY)?"(temp)":"",
(s->flags & SPF_COPYPROTECTED)?"(c)":"",
(s->flags & SPF_EXPLICIT)?"(e)":"",
(s->flags & SPF_UNTRUSTED)?"(u)":"" );
COM_PathLine(s);
}
}
@ -883,19 +882,24 @@ out:
return depth;
}
char *FS_WhichPackForLocation(flocation_t *loc)
char *FS_WhichPackForLocation(flocation_t *loc, qboolean makereferenced)
{
char *ret;
if (!loc->search)
return NULL; //huh? not a valid location.
ret = strchr(loc->search->purepath, '/');
if (!ret)
return NULL;
if (ret)
{
ret++;
if (strchr(ret, '/'))
return NULL;
if (!strchr(ret, '/'))
{
if (makereferenced)
loc->search->flags |= SPF_REFERENCED;
return ret;
}
}
return NULL;
}
/*requires extension*/
@ -1572,16 +1576,18 @@ qboolean COM_LoadMapPackFile (const char *filename, int ofs)
}
static searchpath_t *FS_AddPathHandle(searchpath_t **oldpaths, const char *purepath, const char *probablepath, searchpathfuncs_t *handle, unsigned int flags, unsigned int loadstuff);
searchpathfuncs_t *FS_GetOldPath(searchpath_t **oldpaths, const char *dir)
searchpathfuncs_t *FS_GetOldPath(searchpath_t **oldpaths, const char *dir, unsigned int *keepflags)
{
searchpath_t *p;
searchpathfuncs_t *r = NULL;
*keepflags = 0;
while(*oldpaths)
{
p = *oldpaths;
if (!stricmp(p->logicalpath, dir))
{
*keepflags |= p->flags & (SPF_REFERENCED | SPF_UNTRUSTED);
*oldpaths = p->next;
r = p->handle;
Z_Free(p);
@ -1609,6 +1615,7 @@ static int QDECL FS_AddWildDataFiles (const char *descriptor, int size, void *vp
char pakfile[MAX_OSPATH];
char purefile[MAX_OSPATH];
flocation_t loc;
unsigned int keptflags = 0;
Q_snprintfz (pakfile, sizeof(pakfile), "%s%s", param->parentdesc, descriptor);
@ -1618,7 +1625,7 @@ static int QDECL FS_AddWildDataFiles (const char *descriptor, int size, void *vp
return true; //already loaded (base paths?)
}
newpak = FS_GetOldPath(param->oldpaths, pakfile);
newpak = FS_GetOldPath(param->oldpaths, pakfile, &keptflags);
if (!newpak)
{
if (param->OpenNew == VFSOS_OpenPath)
@ -1647,7 +1654,7 @@ static int QDECL FS_AddWildDataFiles (const char *descriptor, int size, void *vp
snprintf (purefile, sizeof(purefile), "%s/%s", param->puredesc, descriptor);
else
Q_strncpyz(purefile, descriptor, sizeof(purefile));
FS_AddPathHandle(param->oldpaths, purefile, pakfile, newpak, ((!Q_strncasecmp(descriptor, "pak", 3))?SPF_COPYPROTECTED:0), (unsigned int)-1);
FS_AddPathHandle(param->oldpaths, purefile, pakfile, newpak, ((!Q_strncasecmp(descriptor, "pak", 3))?SPF_COPYPROTECTED:0)|keptflags, (unsigned int)-1);
return true;
}
@ -1661,6 +1668,7 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
char pakfile[MAX_OSPATH];
char logicalpaths[MAX_OSPATH]; //with a slash
char purefile[MAX_OSPATH];
unsigned int keptflags;
vfsfile_t *vfs;
flocation_t loc;
wildpaks_t wp;
@ -1679,7 +1687,7 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
snprintf (pakfile, sizeof(pakfile), "%spak%i.%s", logicalpaths, i, extension);
snprintf (purefile, sizeof(purefile), "%s/pak%i.%s", purepath, i, extension);
handle = FS_GetOldPath(oldpaths, pakfile);
handle = FS_GetOldPath(oldpaths, pakfile, &keptflags);
if (!handle)
{
vfs = search->handle->OpenVFS(search->handle, &loc, "r");
@ -1689,7 +1697,7 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
if (!handle)
break;
}
FS_AddPathHandle(oldpaths, purefile, pakfile, handle, SPF_COPYPROTECTED, (unsigned int)-1);
FS_AddPathHandle(oldpaths, purefile, pakfile, handle, SPF_COPYPROTECTED|keptflags, (unsigned int)-1);
}
//now load the random ones
@ -1732,7 +1740,7 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
}
if (!oldp)
{
handle = FS_GetOldPath(oldpaths, lname);
handle = FS_GetOldPath(oldpaths, lname, &keptflags);
if (!handle)
{
if (search->handle->FindFile(search->handle, &loc, pname+ptlen+1, NULL))
@ -1753,7 +1761,7 @@ static void FS_AddDataFiles(searchpath_t **oldpaths, const char *purepath, const
}
}
if (handle)
FS_AddPathHandle(oldpaths, fs_manifest->package[i].path, lname, handle, SPF_COPYPROTECTED|SPF_UNTRUSTED, (unsigned int)-1);
FS_AddPathHandle(oldpaths, fs_manifest->package[i].path, lname, handle, SPF_COPYPROTECTED|SPF_UNTRUSTED|keptflags, (unsigned int)-1);
}
}
}
@ -1859,6 +1867,7 @@ then loads and adds pak1.pak pak2.pak ...
*/
void FS_AddGameDirectory (searchpath_t **oldpaths, const char *puredir, const char *dir, unsigned int loadstuff)
{
unsigned int keptflags;
searchpath_t *search;
char *p;
@ -1880,11 +1889,11 @@ void FS_AddGameDirectory (searchpath_t **oldpaths, const char *puredir, const ch
//
// add the directory to the search path
//
handle = FS_GetOldPath(oldpaths, dir);
handle = FS_GetOldPath(oldpaths, dir, &keptflags);
if (!handle)
handle = VFSOS_OpenPath(NULL, dir);
FS_AddPathHandle(oldpaths, puredir, dir, handle, SPF_EXPLICIT, loadstuff);
FS_AddPathHandle(oldpaths, puredir, dir, handle, SPF_EXPLICIT|keptflags, loadstuff);
}
searchpathfuncs_t *COM_IteratePaths (void **iterator, char *buffer, int buffersize)

View File

@ -10,8 +10,8 @@
#include <alloca.h>
#endif
#define MAX_Q3MAP_INDICES 0x800000 //just a sanity limit
#define MAX_Q3MAP_VERTEXES 0x80000 //just a sanity limit
#define MAX_Q3MAP_INDICES 0x8000000 //just a sanity limit
#define MAX_Q3MAP_VERTEXES 0x800000 //just a sanity limit
#define MAX_Q3MAP_BRUSHSIDES 0x30000
#define MAX_CM_BRUSHSIDES (MAX_Q3MAP_BRUSHSIDES << 1)
#define MAX_CM_PATCH_VERTS (4096)

View File

@ -1558,11 +1558,12 @@ void PF_fcloseall (pubprogfuncs_t *prinst)
void QCBUILTIN PF_whichpack (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
{
char *srcname = PR_GetStringOfs(prinst, OFS_PARM0);
qboolean makereferenced = prinst->callargc>1?G_FLOAT(OFS_PARM1):true;
flocation_t loc;
if (FS_FLocateFile(srcname, FSLFRT_IFFOUND, &loc))
{
srcname = FS_WhichPackForLocation(&loc);
srcname = FS_WhichPackForLocation(&loc, makereferenced);
if (srcname == NULL)
srcname = "";
RETURN_TSTRING(srcname);

View File

@ -89,7 +89,7 @@ void Sys_SendKeyEvents (void);
int Sys_EnumerateFiles (const char *gpath, const char *match, int (QDECL *func)(const char *fname, int fsize, void *parm, searchpathfuncs_t *spath), void *parm, searchpathfuncs_t *spath);
void Sys_Vibrate(int count);
void Sys_Vibrate(float count);
qboolean Sys_GetDesktopParameters(int *width, int *height, int *bpp, int *refreshrate);

View File

@ -1921,9 +1921,9 @@ void BE_GenPolyBatches(batch_t **batches)
{
shader_t *shader = NULL;
batch_t *b;
unsigned int i;
unsigned int i = cl_numstris;
for (i = 0; i < cl_numstris; i++)
while (i-- > 0)
{
if (!cl_stris[i].numidx)
continue;

View File

@ -570,23 +570,15 @@ char *PR_ValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val, pbool v
QC_snprintfz (line, sizeof(line), "'%g %g %g'", val->_vector[0], val->_vector[1], val->_vector[2]);
break;
case ev_pointer:
QC_snprintfz (line, sizeof(line), "pointer");
QC_snprintfz (line, sizeof(line), "%#x", val->_int);
{
// int entnum;
// int valofs;
if (val->_int == 0)
{
QC_snprintfz (line, sizeof(line), "NULL pointer");
break;
}
//FIXME: :/
QC_snprintfz (line, sizeof(line), "UNKNOWN");
// entnum = ((qbyte *)val->edict - (qbyte *)sv_edicts) / pr_edict_size;
// valofs = (int *)val->edict - (int *)edvars(EDICT_NUM(progfuncs, entnum));
// fielddef = ED_FieldAtOfs (progfuncs, valofs );
// if (!fielddef)
// sprintf(line, "ent%i.%s", entnum, "UNKNOWN");
// else
// if (fielddef)
// sprintf(line, "ent%i.%s", entnum, fielddef->s_name);
}
break;
@ -707,6 +699,9 @@ char *PDECL PR_UglyValueString (pubprogfuncs_t *ppf, etype_t type, eval_t *val)
else
sprintf (line, "%f %f %f", val->_vector[0], val->_vector[1], val->_vector[2]);
break;
case ev_pointer:
QC_snprintfz (line, sizeof(line), "%#x", val->_int);
break;
default:
sprintf (line, "bad type %i", type);
break;
@ -769,6 +764,8 @@ char *PR_UglyOldValueString (progfuncs_t *progfuncs, etype_t type, eval_t *val)
else
sprintf (line, "%f %f %f", val->_vector[0], val->_vector[1], val->_vector[2]);
break;
case ev_pointer:
QC_snprintfz (line, sizeof(line), "%#x", val->_int);
break;
default:
sprintf (line, "bad type %i", type);
@ -2366,9 +2363,8 @@ struct edict_s *PDECL PR_RestoreEnt (pubprogfuncs_t *ppf, char *buf, int *size,
ent = (edictrun_t *)ED_Alloc(&progfuncs->funcs);
else
ent = (edictrun_t *)ed;
ent->isfree = false;
if (externs->entspawn)
if (ent->isfree && externs->entspawn)
externs->entspawn((struct edict_s *) ent, false);
buf = ED_ParseEdict(progfuncs, buf, ent);

View File

@ -4366,7 +4366,7 @@ QCC_def_t *QCC_PR_ParseFunctionCall (QCC_ref_t *funcref) //warning, the func cou
}
}
if (arg == 1 && !STRCMP(func->name, "setmodel"))
if (arg == 1 && func->name && !STRCMP(func->name, "setmodel"))
{
QCC_SetModel(e);
}
@ -5802,6 +5802,7 @@ void QCC_StoreToOffset(int dest, int source, QCC_type_t *type)
}*/
void QCC_StoreToDef(QCC_def_t *dest, QCC_def_t *source, QCC_type_t *type, pbool preservesource, pbool preservedest)
{
int i;
int flags = 0;
if (preservesource)
flags |= STFL_PRESERVEA;
@ -5810,6 +5811,18 @@ void QCC_StoreToDef(QCC_def_t *dest, QCC_def_t *source, QCC_type_t *type, pbool
//fixme: we should probably handle entire structs or something
switch(type->type)
{
case ev_struct:
case ev_union:
//don't bother trying to optimise any temps here, its not likely to happen anyway.
for (i = 0; i+2 < type->size; i+=3)
QCC_PR_SimpleStatement(OP_STORE_V, source->ofs+i, dest->ofs+i, 0, false);
for (; i < type->size; i++)
QCC_PR_SimpleStatement(OP_STORE_F, source->ofs+i, dest->ofs+i, 0, false);
if (!preservesource)
QCC_FreeTemp(source);
if (!preservedest)
QCC_FreeTemp(dest);
break;
default:
case ev_float:
QCC_PR_StatementFlags(&pr_opcodes[OP_STORE_F], source, dest, NULL, flags);
@ -10221,12 +10234,11 @@ void QCC_PR_ParseInitializerType(int arraysize, QCC_def_t *def, QCC_type_t *type
dt->initialized = 1;
}
}
else if (type->type == ev_struct || type->type == ev_union)
else if ((type->type == ev_struct || type->type == ev_union) && QCC_PR_CheckToken("{"))
{
//structs go recursive
unsigned int partnum;
pbool isunion;
QCC_PR_Expect("{");
isunion = ((type)->type == ev_union);
for (partnum = 0; partnum < (type)->num_parms; partnum++)
@ -10259,8 +10271,11 @@ void QCC_PR_ParseInitializerType(int arraysize, QCC_def_t *def, QCC_type_t *type
tmp = QCC_PR_Statement (&pr_opcodes[OP_CONV_FTOI], tmp, 0, NULL);
else
{
QCC_PR_ParseErrorPrintDef (ERR_BADIMMEDIATETYPE, def, "wrong initializer type for %s. got %s, needed %s", def->name, tmp->type->name, type->name);
char gottype[256];
char needtype[256];
TypeName(tmp->type, gottype, sizeof(gottype));
TypeName(type, needtype, sizeof(needtype));
QCC_PR_ParseErrorPrintDef (ERR_BADIMMEDIATETYPE, def, "wrong initializer type for %s. got %s, needed %s", def->name, gottype, needtype);
}
}
}

View File

@ -3546,6 +3546,9 @@ char *TypeName(QCC_type_t *type, char *buffer, int buffersize)
{
char *ret;
if (type->type == ev_void)
return "void";
if (type->type == ev_pointer)
{
if (buffersize < 0)

View File

@ -955,7 +955,7 @@ pbool QCC_WriteData (int crc)
for (h = 0; h < numglobaldefs; h++)
{
if (i == h)
if (i == h || !(qcc_globals[h].type & DEF_SAVEGLOBAL))
continue;
if (dd->ofs == qcc_globals[h].ofs)
{
@ -974,7 +974,7 @@ pbool QCC_WriteData (int crc)
{
dd = &fields[i];
if (dd->type == ev_vector) //just ignore vectors.
if (dd->type == ev_vector || dd->type == ev_struct || dd->type == ev_union) //just ignore vectors, structs, and unions.
continue;
for (h = 1; h < numfielddefs; h++)
@ -985,7 +985,7 @@ pbool QCC_WriteData (int crc)
{
if (dd->type != fields[h].type)
{
if (fields[h].type != ev_vector)
if (fields[h].type != ev_vector && fields[h].type != ev_struct && fields[h].type != ev_union)
{
QCC_PR_Warning(0, NULL, 0, "Mismatched union field types (%s and %s)", strings+dd->s_name, strings+fields[h].s_name);
}

View File

@ -9124,7 +9124,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"setsize", PF_setsize, 4, 4, 4, 0, D("void(entity e, vector min, vector max)", "Sets the e's mins and maxs fields. Also relinks collision state, which sets absmin and absmax too.")},
{"qtest_setabssize",PF_setsize, 5, 0, 0, 0, D("void(entity e, vector min, vector max)", "qtest"), true},
{"lightstylestatic",PF_lightstylestatic,0, 0, 5, 5, D("void(float style, float val)", "Sets the lightstyle to an explicit numerical level. From Hexen2.")},
{"break", PF_break, 6, 6, 6, 0, D("void()", "Trigger a debugging event. FTE will break into the qc debugger. Other engines may crash with a debug execption.")},
{"breakpoint", PF_break, 6, 6, 6, 0, D("void()", "Trigger a debugging event. FTE will break into the qc debugger. Other engines may crash with a debug execption.")},
{"random", PF_random, 7, 7, 7, 0, D("float()", "Returns a random value between 0 and 1. Be warned, this builtin can return 1 in most engines, which can break arrays.")},
{"sound", PF_sound, 8, 8, 8, 0, D("void(entity e, float chan, string samp, float vol, float atten, optional float speedpct, optional float flags)", "Starts a sound centered upon the given entity.\nchan is the entity sound channel to use, channel 0 will allow you to mix many samples at once, others will replace the old sample\n'samp' must have been precached first\nif specified, 'speedpct' should normally be around 100 (or =0), 200 for double speed or 50 for half speed.\nflags&1 means the sound should be sent reliably.")},
{"normalize", PF_normalize, 9, 9, 9, 0, D("vector(vector v)", "Shorten or lengthen a direction vector such that it is only one quake unit long.")},
@ -9559,6 +9559,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"stringtokeynum", PF_Fixme, 0, 0, 0, 341, D("float(string keyname)", "Looks up the key name in the same way that the bind command would, returning the keycode for that key.")},// (EXT_CSQC)
{"getkeybind", PF_Fixme, 0, 0, 0, 342, D("string(float keynum)", "Finds the current binding for the given key (ignores modifiers like shift/alt/ctrl).")},// (EXT_CSQC)
{"setcursormode", PF_Fixme, 0, 0, 0, 343, D("void(float usecursor)", "Pass TRUE if you want the engine to release the mouse cursor (absolute input events + touchscreen mode). Pass FALSE if you want the engine to grab the cursor (relative input events + standard looking)")}, // #343 This is a DP extension
{"getmousepos", PF_Fixme, 0, 0, 0, 344, D("vector()", "Nasty convoluted DP extension. Typically returns deltas instead of positions. Use CSQC_InputEvent for such things in csqc mods.")}, // #344 This is a DP extension
{"getinputstate", PF_Fixme, 0, 0, 0, 345, D("float(float inputsequencenum)", "Looks up an input frame from the log, setting the input_* globals accordingly.\nThe sequence number range used for prediction should normally be servercommandframe < sequence <= clientcommandframe.\nThe sequence equal to clientcommandframe will change between input frames.")},// (EXT_CSQC)
@ -9776,7 +9777,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"WritePicture", PF_WritePicture, 0, 0, 0, 501, "void(float to, string s, float sz)"},//DP_SV_WRITEPICTURE
{"ReadPicture", PF_Fixme, 0, 0, 0, 501, "string()"},//DP_SV_WRITEPICTURE
// {"boxparticles", PF_Fixme, 0, 0, 0, 502, "void(float effectindex, entity own, vector org_from, vector org_to, vector dir_from, vector dir_to, float countmultiplier, float flags)"},
{"whichpack", PF_whichpack, 0, 0, 0, 503, "string(string filename)"},//DP_QC_WHICHPACK
{"whichpack", PF_whichpack, 0, 0, 0, 503, D("string(string filename, optional float makereferenced)", "Returns the pak file name that contains the file specified. progs/player.mdl will generally return something like 'pak0.pak'. If makereferenced is true, clients will automatically be told that the returned package should be pre-downloaded and used, even if allow_download_refpackages is not set.")},//DP_QC_WHICHPACK
{"getentity", PF_Fixme, 0, 0, 0, 504, "__variant(float entnum, float fieldnum)"},//DP_CSQC_QUERYRENDERENTITY
// {"undefined", PF_Fixme, 0, 0, 0, 505, ""},
// {"undefined", PF_Fixme, 0, 0, 0, 506, ""},

View File

@ -304,7 +304,7 @@ void SV_New_f (void)
ClientReliableWrite_Byte (host_client, (host_client->spectator?128:0) | splitnum); //read each player's userinfo to see if its a spectator or not. this hint is merely a cheat.
for (split = host_client; split; split = split->controlled)
{
playernum = NUM_FOR_EDICT(svprogfuncs, split->edict)-1;
playernum = split - svs.clients;// NUM_FOR_EDICT(svprogfuncs, split->edict)-1;
if (sv.state == ss_cinematic)
playernum = -1;
ClientReliableWrite_Byte (host_client, playernum);
@ -2728,7 +2728,7 @@ static int SV_LocateDownload(char *name, flocation_t *loc, char **replacementnam
if (replacementname)
{
char *pakname = FS_WhichPackForLocation(loc);
char *pakname = FS_WhichPackForLocation(loc, false);
if (pakname && SV_AllowDownload(pakname))
{
//return loc of the pak instead.
@ -3943,6 +3943,9 @@ void Cmd_Notarget_f (void)
return;
}
if (svs.gametype != GT_PROGS)
return;
SV_LogPlayer(host_client, "notarget cheat");
if ((int) (sv_player->v->flags = (int) sv_player->v->flags ^ FL_NOTARGET) & FL_NOTARGET)
SV_ClientPrintf (host_client, PRINT_HIGH, "notarget ON\n");
@ -3959,6 +3962,9 @@ void Cmd_God_f (void)
return;
}
if (svs.gametype != GT_PROGS)
return;
SV_LogPlayer(host_client, "god cheat");
if ((int) (sv_player->v->flags = (int) sv_player->v->flags ^ FL_GODMODE) & FL_GODMODE)
SV_ClientTPrintf (host_client, PRINT_HIGH, "godmode ON\n");
@ -3986,6 +3992,9 @@ void Cmd_Give_f (void)
return;
}
if (svs.gametype != GT_PROGS)
return;
t = Cmd_Argv(1);
v = atoi (Cmd_Argv(2));
@ -4049,6 +4058,9 @@ void Cmd_Noclip_f (void)
return;
}
if (svs.gametype != GT_PROGS)
return;
SV_LogPlayer(host_client, "noclip cheat");
if (sv_player->v->movetype != MOVETYPE_NOCLIP)
{
@ -4075,6 +4087,9 @@ void Cmd_Fly_f (void)
return;
}
if (svs.gametype != GT_PROGS)
return;
SV_LogPlayer(host_client, "fly cheat");
if (sv_player->v->movetype != MOVETYPE_FLY)
{
@ -4106,6 +4121,9 @@ void Cmd_SetPos_f(void)
return;
}
if (svs.gametype != GT_PROGS)
return;
if (Cmd_Argc() != 4)
{
SV_ClientPrintf(host_client, PRINT_HIGH, "setpos %f %f %f\n", sv_player->v->origin[0], sv_player->v->origin[1], sv_player->v->origin[2]);