From 91ce6bfcc5d23c22738e857fbfa0cdc54b5cfe9f Mon Sep 17 00:00:00 2001 From: divverent Date: Tue, 24 Jan 2012 21:28:53 +0000 Subject: [PATCH] update dpdefs; support flags to precache_pic git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11655 d7cf8633-e32d-0410-b094-e92efae38249 --- dpdefs/csprogsdefs.qc | 17 +++++++++++++++++ dpdefs/menudefs.qc | 21 ++++++++++++++++++++- prvm_cmds.c | 20 ++++++++++++++++++-- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/dpdefs/csprogsdefs.qc b/dpdefs/csprogsdefs.qc index 623fb01c..d3348bc5 100644 --- a/dpdefs/csprogsdefs.qc +++ b/dpdefs/csprogsdefs.qc @@ -1077,6 +1077,16 @@ float MOVETYPE_FLY_WORLDONLY = 33; //description: //like MOVETYPE_FLY, but does all traces with MOVE_WORLDONLY, and is ignored by MOVETYPE_PUSH. Should only be combined with SOLID_NOT and SOLID_TRIGGER. +//DP_PRECACHE_PIC_FLAGS +//idea: divVerent +//darkplaces implementation: divVerent +//constant definitions: +float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC +float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused +float PRECACHE_PIC_NOCLAMP = 4; // do not clamp to edge +float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense +//notes: these constants are given as optional second argument to precache_pic() + //DP_QC_TRACE_MOVETYPE_WORLDONLY //idea: LordHavoc //darkplaces implementation: LordHavoc @@ -1410,3 +1420,10 @@ float trace_networkentity; const float RF_FULLBRIGHT = 256; const float RF_NOSHADOW = 512; float RF_DYNAMICMODELLIGHT = 8192; + +float gettaginfo_parent; +string gettaginfo_name; +vector gettaginfo_offset; +vector gettaginfo_forward; +vector gettaginfo_right; +vector gettaginfo_up; diff --git a/dpdefs/menudefs.qc b/dpdefs/menudefs.qc index 1a68489d..bf229319 100644 --- a/dpdefs/menudefs.qc +++ b/dpdefs/menudefs.qc @@ -293,7 +293,7 @@ void WriteEntity(entity data, float dest, float desto) = #408; ////////////////////////////////////////////////// float iscachedpic(string name) = #451; -string precache_pic(string name) = #452; +string precache_pic(string name, ...) = #452; void freepic(string name) = #453; float drawcharacter(vector position, float character, vector scale, vector rgb, float alpha, float flag) = #454; @@ -404,6 +404,16 @@ float(string s1, string s2, float len) strncmp = #228; float(string s1, string s2) strcasecmp = #229; float(string s1, string s2, float len) strncasecmp = #230; +//DP_PRECACHE_PIC_FLAGS +//idea: divVerent +//darkplaces implementation: divVerent +//constant definitions: +float PRECACHE_PIC_FROMWAD = 1; // this one actually is part of EXT_CSQC +float PRECACHE_PIC_NOTPERSISTENT = 2; // picture may get deallocated when unused +float PRECACHE_PIC_NOCLAMP = 4; // do not clamp to edge +float PRECACHE_PIC_MIPMAP = 8; // mipmap the texture for possibly better downscaling at memory expense +//notes: these constants are given as optional second argument to precache_pic() + //DP_QC_CRC16 //idea: div0 //darkplaces implementation: div0 @@ -436,6 +446,15 @@ float(float bufhandle, string str, float order) bufstr_add = #448; void(float bufhandle, float string_index) bufstr_free = #449; void(float bufhandle, string pattern, string antipattern) buf_cvarlist = #517; +//DP_QC_STRING_CASE_FUNCTIONS +//idea: Dresk +//darkplaces implementation: LordHavoc / Dresk +//builtin definitions: +string(string s) strtolower = #480; // returns the passed in string in pure lowercase form +string(string s) strtoupper = #481; // returns the passed in string in pure uppercase form +//description: +//provides simple string uppercase and lowercase functions + //DP_QC_CVAR_DESCRIPTION //idea: divVerent //DarkPlaces implementation: divVerent diff --git a/prvm_cmds.c b/prvm_cmds.c index c6c930a0..4e9cd325 100644 --- a/prvm_cmds.c +++ b/prvm_cmds.c @@ -3241,18 +3241,34 @@ VM_precache_pic string precache_pic(string pic) ========= */ +#define PRECACHE_PIC_FROMWAD 1 /* FTEQW, not supported here */ +#define PRECACHE_PIC_NOTPERSISTENT 2 +#define PRECACHE_PIC_NOCLAMP 4 +#define PRECACHE_PIC_MIPMAP 8 void VM_precache_pic(prvm_prog_t *prog) { const char *s; + int flags = 0; - VM_SAFEPARMCOUNT(1, VM_precache_pic); + VM_SAFEPARMCOUNTRANGE(1, 2, VM_precache_pic); s = PRVM_G_STRING(OFS_PARM0); PRVM_G_INT(OFS_RETURN) = PRVM_G_INT(OFS_PARM0); VM_CheckEmptyString(prog, s); + if(prog->argc >= 2) + { + int f = PRVM_G_FLOAT(OFS_PARM1); + if(f & PRECACHE_PIC_NOTPERSISTENT) + flags |= CACHEPICFLAG_NOTPERSISTENT; + if(f & PRECACHE_PIC_NOCLAMP) + flags |= CACHEPICFLAG_NOCLAMP; + if(f & PRECACHE_PIC_MIPMAP) + flags |= CACHEPICFLAG_MIPMAP; + } + // AK Draw_CachePic is supposed to always return a valid pointer - if( Draw_CachePic_Flags(s, 0)->tex == r_texture_notexture ) + if( Draw_CachePic_Flags(s, flags)->tex == r_texture_notexture ) PRVM_G_INT(OFS_RETURN) = OFS_NULL; } -- 2.39.2