PRVM_G_FLOAT(OFS_RETURN) = Cvar_VariableValue(string);
}
+/*
+=================
+VM_cvar
+
+float cvar_type (string)
+float CVAR_TYPEFLAG_EXISTS = 1;
+float CVAR_TYPEFLAG_SAVED = 2;
+float CVAR_TYPEFLAG_PRIVATE = 4;
+float CVAR_TYPEFLAG_ENGINE = 8;
+float CVAR_TYPEFLAG_HASDESCRIPTION = 16;
+=================
+*/
+void VM_cvar_type (void)
+{
+ char string[VM_STRINGTEMP_LENGTH];
+ cvar_t *cvar;
+ int ret;
+
+ VM_SAFEPARMCOUNTRANGE(1,8,VM_cvar);
+ VM_VarString(0, string, sizeof(string));
+ VM_CheckEmptyString(string);
+ cvar = Cvar_FindVar(string);
+
+
+ if(!cvar)
+ {
+ PRVM_G_FLOAT(OFS_RETURN) = 0;
+ return; // CVAR_TYPE_NONE
+ }
+
+ ret = 1; // CVAR_EXISTS
+ if(cvar->flags & CVAR_SAVE)
+ ret |= 2; // CVAR_TYPE_SAVED
+ if(cvar->flags & CVAR_PRIVATE)
+ ret |= 4; // CVAR_TYPE_PRIVATE
+ if(!(cvar->flags & CVAR_ALLOCATED))
+ ret |= 8; // CVAR_TYPE_ENGINE
+ if(strcmp(cvar->description, "custom cvar")) // has to match Cvar_Get's placeholder string
+ ret |= 16; // CVAR_TYPE_HASDESCRIPTION
+
+ PRVM_G_FLOAT(OFS_RETURN) = ret;
+}
+
/*
=================
VM_cvar_string
VM_SAFEPARMCOUNT(1,VM_fgets);
+ // set the return value regardless of any possible errors
+ PRVM_G_INT(OFS_RETURN) = OFS_NULL;
+
filenum = (int)PRVM_G_FLOAT(OFS_PARM0);
if (filenum < 0 || filenum >= PRVM_MAX_OPENFILES)
{
Con_Printf("fgets: %s: %s\n", PRVM_NAME, string);
if (c >= 0 || end)
PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(string);
- else
- PRVM_G_INT(OFS_RETURN) = OFS_NULL;
}
/*
{
VM_SAFEPARMCOUNT(0,VM_clientstate);
- PRVM_G_FLOAT(OFS_RETURN) = cls.state;
+
+ switch( cls.state ) {
+ case ca_uninitialized:
+ case ca_dedicated:
+ PRVM_G_FLOAT(OFS_RETURN) = 0;
+ break;
+ case ca_disconnected:
+ PRVM_G_FLOAT(OFS_RETURN) = 1;
+ break;
+ case ca_connected:
+ PRVM_G_FLOAT(OFS_RETURN) = 2;
+ break;
+ default:
+ // should never be reached!
+ break;
+ }
}
/*
VM_CheckEmptyString (s);
// AK Draw_CachePic is supposed to always return a valid pointer
- if( Draw_CachePic(s, false)->tex == r_texture_notexture )
+ if( Draw_CachePic_Flags(s, CACHEPICFLAG_NOTPERSISTENT)->tex == r_texture_notexture )
PRVM_G_INT(OFS_RETURN) = OFS_NULL;
}
if(pos[2] || size[2])
Con_Printf("VM_drawpic: z value%s from %s discarded\n",(pos[2] && size[2]) ? "s" : " ",((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size")));
- DrawQ_Pic(pos[0], pos[1], Draw_CachePic(picname, true), size[0], size[1], rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM4), flag);
+ DrawQ_Pic(pos[0], pos[1], Draw_CachePic (picname), size[0], size[1], rgb[0], rgb[1], rgb[2], PRVM_G_FLOAT(OFS_PARM4), flag);
PRVM_G_FLOAT(OFS_RETURN) = 1;
}
/*
if(pos[2] || size[2])
Con_Printf("VM_drawsubpic: z value%s from %s discarded\n",(pos[2] && size[2]) ? "s" : " ",((pos[2] && size[2]) ? "pos and size" : (pos[2] ? "pos" : "size")));
- DrawQ_SuperPic(pos[0], pos[1], Draw_CachePic(picname, true),
+ DrawQ_SuperPic(pos[0], pos[1], Draw_CachePic (picname),
size[0], size[1],
srcPos[0], srcPos[1], rgb[0], rgb[1], rgb[2], alpha,
srcPos[0] + srcSize[0], srcPos[1], rgb[0], rgb[1], rgb[2], alpha,
p = PRVM_G_STRING(OFS_PARM0);
VM_CheckEmptyString (p);
- pic = Draw_CachePic (p, false);
+ pic = Draw_CachePic_Flags (p, CACHEPICFLAG_NOTPERSISTENT);
PRVM_G_VECTOR(OFS_RETURN)[0] = pic->width;
PRVM_G_VECTOR(OFS_RETURN)[1] = pic->height;
return;
}
- instance = prog->opengeckoinstances[ i ] = CL_Gecko_CreateBrowser( name );
+ instance = prog->opengeckoinstances[ i ] = CL_Gecko_CreateBrowser( name, PRVM_GetProgNr() );
if( !instance ) {
// TODO: error handling [12/3/2007 Black]
PRVM_G_FLOAT( OFS_RETURN ) = 0;