]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - csprogs.c
CLVM: add cvar to support mods wanting low resolution 2D
[xonotic/darkplaces.git] / csprogs.c
index da5bd77eeff2f768aa7b3a723166a58c0eddc915..b868b4fb744188f284ac368cd2e4f4e55283f8af 100644 (file)
--- a/csprogs.c
+++ b/csprogs.c
@@ -510,8 +510,16 @@ qbool CL_VM_UpdateView (double frametime)
        // free memory for resources that are no longer referenced
        PRVM_GarbageCollection(prog);
        // pass in width and height and menu/focus state as parameters (EXT_CSQC_1)
-       PRVM_G_FLOAT(OFS_PARM0) = vid.mode.width;
-       PRVM_G_FLOAT(OFS_PARM1) = vid.mode.height;
+       if (csqc_lowres.integer)
+       {
+               PRVM_G_FLOAT(OFS_PARM0) = vid_conwidth.value;
+               PRVM_G_FLOAT(OFS_PARM1) = vid_conheight.value;
+       }
+       else
+       {
+               PRVM_G_FLOAT(OFS_PARM0) = vid.mode.width;
+               PRVM_G_FLOAT(OFS_PARM1) = vid.mode.height;
+       }
        /*
         * This should be fine for now but FTEQW uses flags for keydest
         * and checks that an array called "eyeoffset" is 0
@@ -1127,7 +1135,8 @@ void CL_VM_Init (void)
        if (PRVM_clientfunction(CSQC_Init))
        {
                PRVM_G_FLOAT(OFS_PARM0) = 1.0f; // CSQC_SIMPLE engines always pass 0, FTE always passes 1
-               PRVM_G_INT(OFS_PARM1) = PRVM_SetEngineString(prog, gamename);
+               // always include "DarkPlaces" so it can be recognised when gamename doesn't include it
+               PRVM_G_INT(OFS_PARM1) = PRVM_SetEngineString(prog, va(vabuf, sizeof(vabuf), "DarkPlaces %s", gamename));
                PRVM_G_FLOAT(OFS_PARM2) = 1.0f; // TODO DP versions...
                prog->ExecuteProgram(prog, PRVM_clientfunction(CSQC_Init), "QC function CSQC_Init is missing");
        }