]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - view.c
added Nexiuz TE_ effects (prefixed TE_TEI_) and Nexiuz plasma trail (an override...
[xonotic/darkplaces.git] / view.c
diff --git a/view.c b/view.c
index 2ba8dc26f2bf13747d57a4468cfcc9fabb9390e8..4b46ffc44709a28701bda82d9b45979eb0dfacf5 100644 (file)
--- a/view.c
+++ b/view.c
@@ -324,7 +324,7 @@ void V_UpdateBlends (void)
        float   r, g, b, a, a2;
        int             j;
 
-       if (cl.worldmodel == NULL)
+       if (cls.signon != SIGNONS)
        {
                cl.cshifts[CSHIFT_DAMAGE].percent = 0;
                cl.cshifts[CSHIFT_BONUS].percent = 0;
@@ -348,7 +348,7 @@ void V_UpdateBlends (void)
                cl.cshifts[CSHIFT_BONUS].percent = 0;
 
        // set contents color
-       switch (Mod_PointInLeaf (r_refdef.vieworg, cl.worldmodel)->contents)
+       switch (Mod_PointContents (r_refdef.vieworg, cl.worldmodel))
        {
        case CONTENTS_EMPTY:
        case CONTENTS_SOLID:
@@ -361,19 +361,19 @@ void V_UpdateBlends (void)
                cl.cshifts[CSHIFT_CONTENTS].destcolor[0] = 255;
                cl.cshifts[CSHIFT_CONTENTS].destcolor[1] = 80;
                cl.cshifts[CSHIFT_CONTENTS].destcolor[2] = 0;
-               cl.cshifts[CSHIFT_CONTENTS].percent = 150;
+               cl.cshifts[CSHIFT_CONTENTS].percent = 150 >> 1;
                break;
        case CONTENTS_SLIME:
                cl.cshifts[CSHIFT_CONTENTS].destcolor[0] = 0;
                cl.cshifts[CSHIFT_CONTENTS].destcolor[1] = 25;
                cl.cshifts[CSHIFT_CONTENTS].destcolor[2] = 5;
-               cl.cshifts[CSHIFT_CONTENTS].percent = 150;
+               cl.cshifts[CSHIFT_CONTENTS].percent = 150 >> 1;
                break;
        default:
                cl.cshifts[CSHIFT_CONTENTS].destcolor[0] = 130;
                cl.cshifts[CSHIFT_CONTENTS].destcolor[1] = 80;
                cl.cshifts[CSHIFT_CONTENTS].destcolor[2] = 50;
-               cl.cshifts[CSHIFT_CONTENTS].percent = 128;
+               cl.cshifts[CSHIFT_CONTENTS].percent = 128 >> 1;
        }
 
        if (cl.items & IT_QUAD)
@@ -478,7 +478,7 @@ void V_CalcRefdef (void)
        float           bob;
        float           side;
 
-       if (cls.state != ca_connected || !cl.worldmodel)
+       if (cls.state != ca_connected || cls.signon != SIGNONS)
                return;
 
        // ent is the player model (visible when out of body)
@@ -532,7 +532,15 @@ void V_CalcRefdef (void)
 
                r_refdef.vieworg[2] += cl.viewheight + bob;
 
+               // LordHavoc: origin view kick added
+               if (!intimerefresh)
+               {
+                       VectorAdd(r_refdef.viewangles, cl.punchangle, r_refdef.viewangles);
+                       VectorAdd(r_refdef.vieworg, cl.punchvector, r_refdef.vieworg);
+               }
+
                // set up gun
+               // (FIXME! this should be in cl_main.c with the other linking code, not view.c!)
                view->state_current.modelindex = cl.stats[STAT_WEAPON];
                view->state_current.frame = cl.stats[STAT_WEAPONFRAME];
                VectorCopy(r_refdef.vieworg, view->render.origin);
@@ -544,20 +552,15 @@ void V_CalcRefdef (void)
                view->render.angles[ROLL] = r_refdef.viewangles[ROLL] - v_idlescale.value * sin(cl.time*v_iroll_cycle.value) * v_iroll_level.value;
                // FIXME: this setup code is somewhat evil (CL_LerpUpdate should be private?)
                CL_LerpUpdate(view);
+               CL_BoundingBoxForEntity(&view->render);
                view->render.colormap = -1; // no special coloring
                view->render.alpha = ent->render.alpha; // LordHavoc: if the player is transparent, so is the gun
                view->render.effects = ent->render.effects;
                view->render.scale = 1.0 / 3.0;
 
-               // LordHavoc: origin view kick added
-               if (!intimerefresh)
-               {
-                       VectorAdd(r_refdef.viewangles, cl.punchangle, r_refdef.viewangles);
-                       VectorAdd(r_refdef.vieworg, cl.punchvector, r_refdef.vieworg);
-               }
-
-               // copy to refdef
-               r_refdef.viewent = view->render;
+               // link into render entities list
+               if (r_refdef.numentities < r_refdef.maxentities && r_drawviewmodel.integer && !chase_active.integer && !envmap && r_drawentities.integer && !(cl.items & IT_INVISIBILITY) && cl.stats[STAT_HEALTH] > 0 && view->render.model != NULL)
+                       r_refdef.entities[r_refdef.numentities++] = &view->render;
        }
 }