]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
whichpack: distinguish file not found from file is physical.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 28 May 2014 15:14:24 +0000 (15:14 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 28 May 2014 15:14:24 +0000 (15:14 +0000)
csqc: add cltime global.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12079 d7cf8633-e32d-0410-b094-e92efae38249

csprogs.c
dpdefs/dpextensions.qc
fs.c
prvm_cmds.c
prvm_offsets.h

index fd2d8f6ebb4d0074cf9b3712e410af8a31ccae1c..e9295bce7cb144dd103e3a533bd5d46949433b44 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -227,6 +227,7 @@ static void CSQC_SetGlobals (double frametime)
        prvm_prog_t *prog = CLVM_prog;
        CSQC_BEGIN
                PRVM_clientglobalfloat(time) = cl.time;
+               PRVM_clientglobalfloat(cltime) = realtime; // Spike named it that way.
                PRVM_clientglobalfloat(frametime) = frametime;
                PRVM_clientglobalfloat(servercommandframe) = cls.servermovesequence;
                PRVM_clientglobalfloat(clientcommandframe) = cl.movecmd[0].sequence;
index 7364e3d514481d2d50d4bd858502df9aab471d1b..c8ceac35496db296764ea00369db3f2b315d77c3 100644 (file)
@@ -899,10 +899,10 @@ vector gettaginfo_up;
 //idea: tZork
 //darkplaces implementation: tZork, divVerent
 //constant definitions:
-float GETTIME_FRAMESTART = 0; // time of start of frame
-float GETTIME_REALTIME = 1; // current time (may be OS specific)
+float GETTIME_FRAMESTART = 0; // time of start of frame relative to an arbitrary point in time
+float GETTIME_REALTIME = 1; // current absolute time (OS specific)
 float GETTIME_HIRES = 2; // like REALTIME, but may reset between QC invocations and thus can be higher precision
-float GETTIME_UPTIME = 3; // time since start of the engine
+float GETTIME_UPTIME = 3; // time of start of frame since start of the engine
 //builtin definitions:
 float(float tmr) gettime = #519;
 //description:
@@ -1183,7 +1183,9 @@ void(vector dir) vectorvectors = #432;
 //builtin definitions:
 string(string filename) whichpack = #503;
 //description:
-//returns the name of the pak/pk3/whatever containing the given file, in the same path space as FRIK_FILE functions use (that is, possibly with a path name prefix)
+//for files in a pak/pk3/whatever, returns the pack's file name in FRIK_FILE name space.
+//for physical files, returns "".
+//in case of error, returns string_null.
 
 //DP_QC_URI_ESCAPE
 //idea: divVerent
diff --git a/fs.c b/fs.c
index a32d6fab69d27a0e3ee4723710251a19316e6a39..45406637b56dec01d267e33a952a4166ac4fd3f4 100644 (file)
--- a/fs.c
+++ b/fs.c
@@ -3723,6 +3723,8 @@ const char *FS_WhichPack(const char *filename)
        searchpath_t *sp = FS_FindFile(filename, &index, true);
        if(sp && sp->pack)
                return sp->pack->shortname;
+       else if(sp)
+               return "";
        else
                return 0;
 }
index 8e476383edd943c0696027f96c9750817fe497d2..746d480e76e77530715affa874eb5353cf5f2843 100644 (file)
@@ -6136,7 +6136,7 @@ void VM_whichpack (prvm_prog_t *prog)
        fn = PRVM_G_STRING(OFS_PARM0);
        pack = FS_WhichPack(fn);
 
-       PRVM_G_INT(OFS_RETURN) = PRVM_SetTempString(prog, pack ? pack : "");
+       PRVM_G_INT(OFS_RETURN) = pack ? PRVM_SetTempString(prog, pack) : 0;
 }
 
 typedef struct
index 36256c5fb3dc8116178a031c23850c6c13c9e57d..fcb57ad0c3d63b21d5c14c7e6312e688d2cca5a1 100644 (file)
@@ -100,6 +100,7 @@ PRVM_DECLARE_clientglobaledict(self)
 PRVM_DECLARE_clientglobaledict(trace_ent)
 PRVM_DECLARE_clientglobaledict(world)
 PRVM_DECLARE_clientglobalfloat(clientcommandframe)
+PRVM_DECLARE_clientglobalfloat(cltime)
 PRVM_DECLARE_clientglobalfloat(coop)
 PRVM_DECLARE_clientglobalfloat(deathmatch)
 PRVM_DECLARE_clientglobalfloat(dmg_save)
@@ -444,6 +445,7 @@ PRVM_DECLARE_function(m_toggle)
 PRVM_DECLARE_function(main)
 PRVM_DECLARE_global(SV_InitCmd)
 PRVM_DECLARE_global(clientcommandframe)
+PRVM_DECLARE_global(cltime)
 PRVM_DECLARE_global(coop)
 PRVM_DECLARE_global(deathmatch)
 PRVM_DECLARE_global(dmg_origin)