ed = PRVM_G_EDICT(OFS_PARM0);
if( PRVM_NUM_FOR_EDICT(ed) <= prog->reserved_edicts )
{
- if (developer.integer)
+ if (developer.integer > 0)
VM_Warning( "VM_remove: tried to remove the null entity or a reserved entity!\n" );
}
else if( ed->priv.required->free )
{
- if (developer.integer)
+ if (developer.integer > 0)
VM_Warning( "VM_remove: tried to remove an already freed entity!\n" );
}
else
}
}
+/*
+=========
+VM_getsoundtime
+
+float getsoundtime(void)
+=========
+*/
+
+void VM_getsoundtime (void)
+{
+ int entnum, entchannel, pnum;
+ VM_SAFEPARMCOUNT(2,VM_getsoundtime);
+
+ pnum = PRVM_GetProgNr();
+ if (pnum == PRVM_MENUPROG)
+ {
+ VM_Warning("VM_getsoundtime: %s: not supported on this progs\n", PRVM_NAME);
+ PRVM_G_FLOAT(OFS_RETURN) = -1;
+ return;
+ }
+ entnum = ((pnum == PRVM_CLIENTPROG) ? MAX_EDICTS : 0) + PRVM_NUM_FOR_EDICT(PRVM_G_EDICT(OFS_PARM0));
+ entchannel = (int)PRVM_G_FLOAT(OFS_PARM1);
+ if (entchannel <= 0 || entchannel > 8)
+ VM_Warning("VM_getsoundtime: %s: bad channel %i\n", PRVM_NAME, entchannel);
+ PRVM_G_FLOAT(OFS_RETURN) = (float)S_GetEntChannelPosition(entnum, entchannel);
+}
+
+/*
+=========
+VM_GetSoundLen
+
+string soundlength (string sample)
+=========
+*/
+void VM_soundlength (void)
+{
+ const char *s;
+
+ VM_SAFEPARMCOUNT(1, VM_soundlength);
+
+ s = PRVM_G_STRING(OFS_PARM0);
+ PRVM_G_FLOAT(OFS_RETURN) = S_SoundLength(s);
+}
+
/*
=========
VM_loadfromdata
VM_CheckEmptyString( file );
VM_CheckEmptyString( name );
- if( CL_OpenVideo( file, name, MENUOWNER ) )
+ if( CL_OpenVideo( file, name, MENUOWNER, "" ) )
PRVM_G_FLOAT( OFS_RETURN ) = 1;
else
PRVM_G_FLOAT( OFS_RETURN ) = 0;
|| (*p >= 'a' && *p <= 'z')
|| (*p >= '0' && *p <= '9')
|| (*p == '-') || (*p == '_') || (*p == '.')
- || (*p == '!') || (*p == '~') || (*p == '*')
+ || (*p == '!') || (*p == '~')
|| (*p == '\'') || (*p == '(') || (*p == ')'))
*q++ = *p;
else
handle->prognr = PRVM_GetProgNr();
handle->starttime = prog->starttime;
handle->id = id;
- ret = Curl_Begin_ToMemory(url, (unsigned char *) handle->buffer, sizeof(handle->buffer), uri_to_string_callback, handle);
+ ret = Curl_Begin_ToMemory(url, 0, (unsigned char *) handle->buffer, sizeof(handle->buffer), uri_to_string_callback, handle);
if(ret)
{
PRVM_G_INT(OFS_RETURN) = 1;
}
}
+/*
+=========
+Common functions between menu.dat and clsprogs
+=========
+*/
+
+//#349 float() isdemo
+void VM_CL_isdemo (void)
+{
+ VM_SAFEPARMCOUNT(0, VM_CL_isdemo);
+ PRVM_G_FLOAT(OFS_RETURN) = cls.demoplayback;
+}
+
+//#355 float() videoplaying
+void VM_CL_videoplaying (void)
+{
+ VM_SAFEPARMCOUNT(0, VM_CL_videoplaying);
+ PRVM_G_FLOAT(OFS_RETURN) = cl_videoplaying;
+}
+
/*
=========
VM_M_callfunction
char formatbuf[16];
char *f;
qboolean isfloat;
+ static int dummyivec[3] = {0, 0, 0};
+ static float dummyvec[3] = {0, 0, 0};
+
#define PRINTF_ALTERNATE 1
#define PRINTF_ZEROPAD 2
#define PRINTF_LEFT 4
s = PRVM_G_STRING(OFS_PARM0);
#define GETARG_FLOAT(a) (((a)>=1 && (a)<prog->argc) ? (PRVM_G_FLOAT(OFS_PARM0 + 3 * (a))) : 0)
+#define GETARG_VECTOR(a) (((a)>=1 && (a)<prog->argc) ? (PRVM_G_VECTOR(OFS_PARM0 + 3 * (a))) : dummyvec)
#define GETARG_INT(a) (((a)>=1 && (a)<prog->argc) ? (PRVM_G_INT(OFS_PARM0 + 3 * (a))) : 0)
+#define GETARG_INTVECTOR(a) (((a)>=1 && (a)<prog->argc) ? ((int*) PRVM_G_VECTOR(OFS_PARM0 + 3 * (a))) : dummyivec)
#define GETARG_STRING(a) (((a)>=1 && (a)<prog->argc) ? (PRVM_G_STRING(OFS_PARM0 + 3 * (a))) : "")
for(;;)
precision = 6;
o += dpsnprintf(o, end - o, formatbuf, width, precision, (isfloat ? (double) GETARG_FLOAT(thisarg) : (double) GETARG_INT(thisarg)));
break;
+ case 'v': case 'V':
+ f[-2] += 'g' - 'v';
+ if(precision < 0) // not set
+ precision = 6;
+ o += dpsnprintf(o, end - o, va("%s %s %s", /* NESTED SPRINTF IS NESTED */ formatbuf, formatbuf, formatbuf),
+ width, precision, (isfloat ? (double) GETARG_VECTOR(thisarg)[0] : (double) GETARG_INTVECTOR(thisarg)[0]),
+ width, precision, (isfloat ? (double) GETARG_VECTOR(thisarg)[1] : (double) GETARG_INTVECTOR(thisarg)[1]),
+ width, precision, (isfloat ? (double) GETARG_VECTOR(thisarg)[2] : (double) GETARG_INTVECTOR(thisarg)[2])
+ );
+ break;
case 'c':
if(precision < 0) // not set
precision = end - o - 1;