]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Viewmodel: mimic player model effects
authorTimePath <andrew.hardaker1995@gmail.com>
Mon, 2 Nov 2015 05:02:51 +0000 (16:02 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Mon, 2 Nov 2015 05:02:51 +0000 (16:02 +1100)
qcsrc/client/view.qc

index 3333687ee1107e8d112b0943395205d051f8dba0..95167a1c4c752c4189d6a6e5568f02b6d0c2d5fa 100644 (file)
 #include "../lib/warpzone/client.qh"
 #include "../lib/warpzone/common.qh"
 
+#define EFMASK_CHEAP (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NODRAW | EF_NOSHADOW | EF_SELECTABLE | EF_TELEPORT_BIT)
+
 void viewmodel_draw(entity this)
 {
-       int mask = (intermission || (getstati(STAT_HEALTH) <= 0)) ? 0 : MASK_NORMAL;
+       int mask = (intermission || (getstati(STAT_HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
        int c = stof(getplayerkeyvalue(current_player, "colors"));
        vector g = colormapPaletteColor(c & 0x0F, true) * 2;
+       entity me = CSQCModel_server2csqc(player_localentnum);
+       int fx = ((me.csqcmodel_effects & EFMASK_CHEAP)
+               | EF_NODEPTHTEST)
+               &~ (EF_FULLBRIGHT); // can mask team color, so get rid of it
        for (entity e = this; e; e = e.weaponchild)
        {
                e.drawmask = mask;
                e.colormap = c;
                e.glowmod = g;
+               e.csqcmodel_effects = fx;
+               WITH(entity, self, e, CSQCModel_Effects_Apply());
        }
 }