]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/view.qc
Give Weapon_ImpactEffect an argument for the effect entity
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / view.qc
index 6ea2bb91b42a79b8d406b08b04c849bd804ca670..9ba1114b6bde785bab0249feeee5342ced3f292d 100644 (file)
@@ -320,7 +320,7 @@ void viewmodel_draw(entity this)
                        this.viewmodel_angles = this.angles;
                }
                anim_update(this);
-               if (!this.animstate_override)
+               if (!this.animstate_override && !this.animstate_looping)
                        anim_set(this, this.anim_idle, true, false, false);
        }
        float f = 0; // 0..1; 0: fully active
@@ -752,8 +752,6 @@ bool WantEventchase(entity this)
                        return true;
                if(MUTATOR_CALLHOOK(WantEventchase, this))
                        return true;
-               if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
-                       return true;
                if(autocvar_cl_eventchase_death && (STAT(HEALTH) <= 0))
                {
                        if(autocvar_cl_eventchase_death == 2)
@@ -768,12 +766,12 @@ bool WantEventchase(entity this)
        return false;
 }
 
-void HUD_Crosshair_Vehicle()
+void HUD_Crosshair_Vehicle(entity this)
 {
        if(hud != HUD_BUMBLEBEE_GUN)
        {
                Vehicle info = Vehicles_from(hud);
-               info.vr_crosshair(info);
+               info.vr_crosshair(info, this);
        }
 }
 
@@ -862,7 +860,7 @@ vector crosshair_getcolor(entity this, float health_stat)
        {
                case 1: // crosshair_color_per_weapon
                {
-                       if(this)
+                       if(this != WEP_Null)
                        {
                                wcross_color = this.wpcolor;
                                break;
@@ -933,9 +931,8 @@ LABEL(normalcolor)
        return wcross_color;
 }
 
-void HUD_Crosshair()
-{SELFPARAM();
-       entity e = this;
+void HUD_Crosshair(entity this)
+{
        float f, i, j;
        vector v;
        if(!scoreboard_active && !camera_active && intermission != 2 &&
@@ -947,7 +944,7 @@ void HUD_Crosshair()
 
                if (hud != HUD_NORMAL)
                {
-                       HUD_Crosshair_Vehicle();
+                       HUD_Crosshair_Vehicle(this);
                        return;
                }
 
@@ -992,6 +989,7 @@ void HUD_Crosshair()
                string wcross_name = "";
                float wcross_scale, wcross_blur;
 
+        entity e = WEP_Null;
                if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1))
                {
                        e = switchingweapon;
@@ -1318,11 +1316,12 @@ void HUD_Crosshair()
        }
 }
 
-void HUD_Draw()
+void HUD_Draw(entity this)
 {
+       if(!intermission)
        if (MUTATOR_CALLHOOK(HUD_Draw_overlay))
        {
-               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, MUTATOR_ARGV(0, vector), autocvar_hud_colorflash_alpha * MUTATOR_ARGV(0, float), DRAWFLAG_ADDITIVE);
+               drawfill('0 0 0', eX * vid_conwidth + eY * vid_conheight, M_ARGV(0, vector), autocvar_hud_colorflash_alpha * M_ARGV(1, float), DRAWFLAG_ADDITIVE);
        }
        else if(STAT(FROZEN))
        {
@@ -1353,7 +1352,7 @@ void HUD_Draw()
 
        // crosshair goes VERY LAST
        UpdateDamage();
-       HUD_Crosshair();
+       HUD_Crosshair(this);
        HitSound();
 }
 
@@ -1371,7 +1370,8 @@ int lasthud;
 float vh_notice_time;
 void WaypointSprite_Load();
 void CSQC_UpdateView(float w, float h)
-{SELFPARAM();
+{
+    SELFPARAM(); // needed for engine functions
     TC(int, w); TC(int, h);
        entity e;
        float fov;
@@ -1405,6 +1405,10 @@ void CSQC_UpdateView(float w, float h)
        else
                view_quality = 1;
 
+       // this needs to be updated manually now due to the destruction of engine physics stats
+       if(!isdemo() && autocvar_slowmo != STAT(MOVEVARS_TIMESCALE))
+               cvar_set("slowmo", ftos(STAT(MOVEVARS_TIMESCALE)));
+
        button_attack2 = PHYS_INPUT_BUTTON_ATCK2(this);
        button_zoom = PHYS_INPUT_BUTTON_ZOOM(this);
 
@@ -2180,7 +2184,7 @@ void CSQC_UpdateView(float w, float h)
 
        scoreboard_active = HUD_WouldDrawScoreboard();
 
-       HUD_Draw();
+       HUD_Draw(this); // this parameter for deep vehicle function
 
        if(NextFrameCommand)
        {