]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/view.qc
Kill some more vlen uses
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / view.qc
index 2226200521e27683e51cc5f640324be655ce447c..cd156e65ec7b3989e0afc6ce1d8a08faa4c4aa12 100644 (file)
@@ -980,7 +980,7 @@ void HUD_Crosshair(entity this)
                                v = wcross_origin - wcross_oldorigin;
                                v.x /= vid_conwidth;
                                v.y /= vid_conheight;
-                               if(vlen(v) > 0.01)
+                               if(vdist(v, >, 0.01))
                                        shottype = SHOTTYPE_HITOBSTRUCTION;
                        }
                        if(!autocvar_crosshair_hittest_showimpact)
@@ -1322,6 +1322,13 @@ void HUD_Crosshair(entity this)
 
 void HUD_Draw(entity this)
 {
+       // if we don't know gametype and scores yet avoid drawing the scoreboard
+       // also in the very first frames, player state may be inconsistent so avoid drawing the hud at all
+       // e.g. since initial player's health is 0 hud would display the hud_damage effect,
+       // cl_deathscoreboard would show the scoreboard and so on
+       if(!gametype)
+               return;
+
        if(!intermission)
        if (MUTATOR_CALLHOOK(HUD_Draw_overlay))
        {
@@ -1500,9 +1507,10 @@ void CSQC_UpdateView(entity this, float w, float h)
                        }
                }
 
-               if(ons_roundlost)
+               if(ons_roundlost) // TODO: move this junk to a client mutator for onslaught (possible using the WantEventchase hook)
                {
-                       FOREACH_ENTITY_CLASS("onslaught_generator", it.health <= 0, {
+                       IL_EACH(g_onsgenerators, it.health <= 0,
+                       {
                                gen = it;
                                break;
                        });
@@ -1735,6 +1743,9 @@ void CSQC_UpdateView(entity this, float w, float h)
        if(!postinit)
                PostInit();
 
+       if(intermission && !gameover_time)
+               gameover_time = time;
+
        if(intermission && !isdemo() && !(calledhooks & HOOK_END))
        {
                if(calledhooks & HOOK_START)
@@ -1774,13 +1785,6 @@ void CSQC_UpdateView(entity this, float w, float h)
 
        switchweapon = Weapons_from(STAT(SWITCHWEAPON));
 
-       f = (serverflags & SERVERFLAG_TEAMPLAY);
-       if(f != teamplay)
-       {
-               teamplay = f;
-               Scoreboard_InitScores();
-       }
-
        if(last_switchweapon != switchweapon)
        {
                weapontime = time;