]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/View.qc
Include gmqcc binaries for Windows and Linux
[voretournament/voretournament.git] / data / qcsrc / client / View.qc
index 73aaf13ab947c4717491401e3131ce5c1e5eb458..b6eb14c10dc630d416110877b361795e4d4257c8 100644 (file)
@@ -203,11 +203,6 @@ float TrueAimCheck()
        ta = trueaim;\r
        mv = MOVE_NOMONSTERS;\r
 \r
-       switch(activeweapon)\r
-       {\r
-               case WEP_GRABBER: // no trueaim\r
-       }\r
-\r
        vecs = decompressShotOrigin(getstati(STAT_SHOTORG));\r
 \r
        traceline(view_origin, view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);\r
@@ -248,17 +243,20 @@ void CSQC_ctf_hud(void);
 void PostInit(void);\r
 void CSQC_Demo_Camera();\r
 float Sbar_WouldDrawScoreboard ();\r
-float view_set;\r
+float last_health, last_spectatee;\r
 float camera_mode;\r
 float reticle_type;\r
 float chase_active_old;\r
 float artwork_fade;\r
-float pickup_crosshair_time, pickup_crosshair_size;\r
+float pickup_crosshair_time, pickup_crosshair_size, pickup_flash_time, vore_flash_laststate, grab_flash_laststate;\r
+float spawnfov_current;\r
 float myhealth, myhealth_prev, myhealth_flash;\r
 float contentavgalpha, liquidalpha_prev;\r
-float stomachsplash_alpha, stomachsplash_remove_at_respawn;\r
-float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2;\r
-float volume_modify_changed_1, volume_modify_changed_2;\r
+float old_blurradius, old_bluralpha, old_cartoon_intensity;\r
+float stomachsplash_alpha;\r
+float eventchase_current_distance;\r
+float helper_pause, helper_health, helper_armor, helper_ammo, helper_speed, helper_stomachload;\r
+vector freeze_org, freeze_ang;\r
 vector myhealth_gentlergb;\r
 vector liquidcolor_prev;\r
 vector damage_blurpostprocess, content_blurpostprocess;\r
@@ -272,8 +270,10 @@ void CSQC_UpdateView(float w, float h)
        float f, i, j;\r
        vector v, vo;\r
        float a;\r
+       float respawned;\r
 \r
        vector reticle_pos, reticle_size;\r
+       vector splash_pos, splash_size;\r
        vector artwork_pos, artwork_size;\r
 \r
        WaypointSprite_Load();\r
@@ -292,18 +292,182 @@ void CSQC_UpdateView(float w, float h)
        pmove_org = warpzone_fixview_origin - vo;\r
        input_angles = warpzone_fixview_angles;\r
 \r
-       // Render the Scene\r
-       if(!intermission || !view_set)\r
+       if((last_health <= 0 && getstati(STAT_HEALTH) > 0) || (!spectatee_status && last_spectatee)) // also cover switching from a spectator to a player instantly\r
+       if not(spectatee_status && last_spectatee != spectatee_status) // not if we switched players and that detects a different health\r
+               respawned = TRUE; // stays true for one frame\r
+\r
+       // helper system\r
+       if(cvar("cl_helper"))\r
+       if not(getstati(STAT_ARMOR) < g_power || time <= power_boot)\r
        {\r
-               view_origin = pmove_org + vo;\r
-               view_angles = input_angles;\r
-               makevectors(view_angles);\r
-               view_forward = v_forward;\r
-               view_right = v_right;\r
-               view_up = v_up;\r
-               view_set = 1;\r
+               if(intermission || respawned || spectatee_status < 0 || getstati(STAT_HEALTH) <= 0 || getstati(STAT_VORE_EATEN))\r
+               {\r
+                       // Set these helper messages as having been triggered, so that the player must first reach them before they complain.\r
+                       // Otherwise, if you don't have any start armor for instance, the helper will complain about low armor when we spawn.\r
+                       helper_health = TRUE;\r
+                       helper_armor = TRUE;\r
+                       helper_ammo = TRUE;\r
+                       helper_stomachload = TRUE;\r
+               }\r
+               else if(helper_pause <= time)\r
+               {\r
+                       // health helper\r
+                       if(getstati(STAT_HEALTH) <= cvar("cl_helper_item_health"))\r
+                       {\r
+                               if(cvar("cl_helper_item_health") && !helper_health)\r
+                               {\r
+                                       sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/health.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+                                       helper_health = TRUE;\r
+                                       helper_pause = time + cvar("cl_helper_pause");\r
+                                       helper_ammo = time + cvar("cl_helper_pause");\r
+                               }\r
+                       }\r
+                       else if(helper_health)\r
+                               helper_health = FALSE;\r
+\r
+                       // armor helper\r
+                       if(getstati(STAT_ARMOR) <= cvar("cl_helper_item_armor"))\r
+                       {\r
+                               if(cvar("cl_helper_item_armor") && !helper_armor)\r
+                               {\r
+                                       sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/armor.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+                                       helper_armor = TRUE;\r
+                                       helper_pause = time + cvar("cl_helper_pause");\r
+                               }\r
+                       }\r
+                       else if(helper_armor)\r
+                               helper_armor = FALSE;\r
+\r
+                       // ammo helper\r
+                       if(getstati(STAT_FUEL) <= cvar("cl_helper_item_ammo_fuel"))\r
+                       {\r
+                               if(cvar("cl_helper_item_ammo_fuel") && !helper_ammo)\r
+                               {\r
+                                       sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/ammo.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+                                       helper_ammo = TRUE;\r
+                                       helper_pause = time + cvar("cl_helper_pause");\r
+                               }\r
+                       }\r
+                       else if(helper_ammo)\r
+                               helper_ammo = FALSE;\r
+\r
+                       // speed helper\r
+                       if(vlen(pmove_vel) >= cvar("cl_helper_item_speed"))\r
+                       {\r
+                               if(cvar("cl_helper_item_speed") && !helper_speed)\r
+                               {\r
+                                       sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/speed.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+                                       helper_speed = TRUE;\r
+                                       helper_pause = time + cvar("cl_helper_pause");\r
+                               }\r
+                       }\r
+                       else if(helper_speed)\r
+                               helper_speed = FALSE;\r
+\r
+                       // stomach load helper\r
+                       if(getstati(STAT_VORE_LOAD) / getstati(STAT_VORE_MAXLOAD) >= cvar("cl_helper_item_stomachload"))\r
+                       {\r
+                               if(cvar("cl_helper_item_stomachload") && !helper_stomachload)\r
+                               {\r
+                                       sound(self, CHAN_VOICE, strcat("helper/", cvar_string("cl_helper_voice"), "/stomachload.wav"), VOL_BASEVOICE, ATTN_NONE);\r
+                                       helper_stomachload = TRUE;\r
+                                       helper_pause = time + cvar("cl_helper_pause");\r
+                               }\r
+                       }\r
+                       else if(helper_stomachload)\r
+                               helper_stomachload = FALSE;\r
+               }\r
        }\r
 \r
+       // event chase camera\r
+       if(cvar("chase_active") <= 0) // greater than 0 means it's enabled manually, and this code is skipped\r
+       {\r
+               if(spectatee_status >= 0 && (cvar("cl_eventchase_death") && getstati(STAT_HEALTH) <= 0 && !intermission && !getstati(STAT_VORE_EATEN)) || intermission)\r
+               {\r
+                       // make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)\r
+                       vector current_view_origin = getpropertyvec(VF_ORIGIN);\r
+                       \r
+                       // We must enable chase_active to get a third person view (weapon viewmodel hidden and own player model showing).\r
+                       // Ideally, there should be another way to enable third person cameras, such as through setproperty()\r
+                       if(!cvar("chase_active"))\r
+                               cvar_set("chase_active", "-1"); // -1 enables chase_active while marking it as set by this code, and not by the user (which would be 1)\r
+\r
+                       // make the camera smooth back\r
+                       if(cvar("cl_eventchase_speed") && eventchase_current_distance < cvar("cl_eventchase_distance"))\r
+                               eventchase_current_distance += cvar("cl_eventchase_speed") * (cvar("cl_eventchase_distance") - eventchase_current_distance) * frametime; // slow down the further we get\r
+                       else if(eventchase_current_distance != cvar("cl_eventchase_distance"))\r
+                               eventchase_current_distance = cvar("cl_eventchase_distance");\r
+\r
+                       vector eventchase_target_origin;\r
+                       makevectors(view_angles);\r
+                       // pass 1, used to check where the camera would go and obtain the trace_fraction\r
+                       eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance;\r
+                       WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);\r
+                       // pass 2, also multiplying view_forward with trace_fraction, to prevent the camera from going through walls\r
+                       // The 0.1 subtraction is to not limit the camera precisely at the wall surface, as that allows the view to poke through\r
+                       eventchase_target_origin = current_view_origin - v_forward * eventchase_current_distance * (trace_fraction - 0.1);\r
+                       WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);\r
+\r
+                       setproperty(VF_ORIGIN, trace_endpos);\r
+                       setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));\r
+               }\r
+               else if(cvar("chase_active") < 0) // time to disable chase_active if it was set by this code\r
+               {\r
+                       cvar_set("chase_active", "0");\r
+                       eventchase_current_distance = 0; // start from 0 next time\r
+               }\r
+       }\r
+\r
+       if(frametime)\r
+       {\r
+               float apply_fov;\r
+               apply_fov = cvar("menu_fov");\r
+               if(g_healthsize_center >= 0 && cvar("cl_healthsize_fov") && spectatee_status >= 0)\r
+                       apply_fov += (g_healthsize_center - bound(g_healthsize_min, getstati(STAT_HEALTH), g_healthsize_max)) * cvar("cl_healthsize_fov");\r
+               if(cvar("fov") != apply_fov)\r
+                       cvar_set("fov", ftos(apply_fov));\r
+       }\r
+\r
+       float apply_idlescale;\r
+       if(cvar("cl_vore_vieweffects_idlescale_prey") && frametime)\r
+       {\r
+               apply_idlescale += getstatf(STAT_VORE_PROGRESS_PREY) * cvar("cl_vore_vieweffects_idlescale_prey");\r
+               if(cvar("v_idlescale") != apply_idlescale)\r
+                       cvar_set("v_idlescale", ftos(apply_idlescale));\r
+       }\r
+       if(cvar("cl_vore_vieweffects_idlescale_predator") && frametime)\r
+       {\r
+               apply_idlescale += getstatf(STAT_VORE_PROGRESS_PRED) * cvar("cl_vore_vieweffects_idlescale_predator");\r
+               if(cvar("v_idlescale") != apply_idlescale)\r
+                       cvar_set("v_idlescale", ftos(apply_idlescale));\r
+       }\r
+       if(cvar("cl_vore_vieweffects_idlescale_stomach") && frametime)\r
+       {\r
+               apply_idlescale += getstati(STAT_VORE_EATEN) * cvar("cl_vore_vieweffects_idlescale_stomach");\r
+               if(cvar("v_idlescale") != apply_idlescale)\r
+                       cvar_set("v_idlescale", ftos(apply_idlescale));\r
+       }\r
+\r
+       // do lockview after event chase camera so that it still applies whenever necessary.\r
+       if(intermission > 1)\r
+       {\r
+               setproperty(VF_ORIGIN, freeze_org);\r
+               setproperty(VF_ANGLES, freeze_ang);\r
+       }\r
+       else\r
+       {\r
+               freeze_org = getpropertyvec(VF_ORIGIN);\r
+               freeze_ang = getpropertyvec(VF_ANGLES);\r
+       }\r
+\r
+       // Render the Scene\r
+       view_origin = getpropertyvec(VF_ORIGIN);\r
+       view_angles = getpropertyvec(VF_ANGLES);\r
+       makevectors(view_angles);\r
+       view_forward = v_forward;\r
+       view_right = v_right;\r
+       view_up = v_up;\r
+\r
        vid_width = w;\r
        vid_height = h;\r
 \r
@@ -392,16 +556,43 @@ void CSQC_UpdateView(float w, float h)
        // ALWAYS Clear Current Scene First\r
        R_ClearScene();\r
 \r
+       if(checkextension("DP_CSQC_ROTATEMOVES"))\r
+       {\r
+               setproperty(VF_ORIGIN, view_origin);\r
+               setproperty(VF_ANGLES, view_angles);\r
+       }\r
+\r
        // Assign Standard Viewflags\r
        // Draw the World (and sky)\r
-       R_SetView(VF_DRAWWORLD, 1);\r
+       setproperty(VF_DRAWWORLD, 1);\r
 \r
        // Set the console size vars\r
        vid_conwidth = cvar("vid_conwidth");\r
        vid_conheight = cvar("vid_conheight");\r
        vid_pixelheight = cvar("vid_pixelheight");\r
 \r
-       R_SetView(VF_FOV, GetCurrentFov(fov));\r
+       // spawn fov effect\r
+       if(cvar("cl_spawnfov"))\r
+       {\r
+               if(respawned)\r
+                       spawnfov_current = 1 + cvar("cl_spawnfov");\r
+\r
+               if(spawnfov_current > 1)\r
+                       spawnfov_current -= cvar("cl_spawnfov_speed") * frametime;\r
+               else\r
+                       spawnfov_current = 1;\r
+               fov *= spawnfov_current;\r
+       }\r
+\r
+       if(respawned)\r
+       {\r
+               if(g_power_reboot_spawn)\r
+                       power_boot = time + g_power_reboot;\r
+               else\r
+                       power_boot = time;\r
+       }\r
+\r
+       setproperty(VF_FOV, GetCurrentFov(fov));\r
 \r
        // Camera for demo playback\r
        if(camera_active)\r
@@ -432,10 +623,10 @@ void CSQC_UpdateView(float w, float h)
        // Draw the Crosshair\r
        float scoreboard_active;\r
        scoreboard_active = Sbar_WouldDrawScoreboard();\r
-       R_SetView(VF_DRAWCROSSHAIR, 0); //Make sure engine crosshairs are always hidden\r
+       setproperty(VF_DRAWCROSSHAIR, 0); //Make sure engine crosshairs are always hidden\r
 \r
        // Draw the Engine Status Bar (the default Quake HUD)\r
-       R_SetView(VF_DRAWENGINESBAR, 0);\r
+       setproperty(VF_DRAWENGINESBAR, 0);\r
 \r
        // fetch this one only once per frame\r
        sbar_showbinds = cvar("sbar_showbinds");\r
@@ -473,35 +664,36 @@ void CSQC_UpdateView(float w, float h)
        else if(button_zoom || zoomscript_caught)\r
                reticle_type = 1; // normal zoom\r
 \r
-       if(cvar("cl_reticle_stretch"))\r
+       if (reticle_type)\r
        {\r
-               reticle_size_x = vid_conwidth;\r
-               reticle_size_y = vid_conheight;\r
-               reticle_pos_x = 0;\r
-               reticle_pos_y = 0;\r
-       }\r
-       else\r
-       {\r
-               reticle_size_x = max(vid_conwidth, vid_conheight);\r
-               reticle_size_y = max(vid_conwidth, vid_conheight);\r
-               reticle_pos_x = (vid_conwidth - reticle_size_x) / 2;\r
-               reticle_pos_y = (vid_conheight - reticle_size_y) / 2;\r
-       }\r
+               if(cvar("cl_reticle_stretch"))\r
+               {\r
+                       reticle_size_x = vid_conwidth;\r
+                       reticle_size_y = vid_conheight;\r
+                       reticle_pos_x = 0;\r
+                       reticle_pos_y = 0;\r
+               }\r
+               else\r
+               {\r
+                       reticle_size_x = max(vid_conwidth, vid_conheight);\r
+                       reticle_size_y = max(vid_conwidth, vid_conheight);\r
+                       reticle_pos_x = (vid_conwidth - reticle_size_x) / 2;\r
+                       reticle_pos_y = (vid_conheight - reticle_size_y) / 2;\r
+               }\r
 \r
-       f = current_zoomfraction;\r
-       if(zoomscript_caught)\r
-               f = 1;\r
-       if(cvar("cl_reticle_item_normal"))\r
-       {\r
-               precache_pic("gfx/reticle_normal");\r
-               if(reticle_type == 1 && f)\r
-                       drawpic(reticle_pos, "gfx/reticle_normal", reticle_size, '1 1 1', f * cvar("cl_reticle_item_normal"), DRAWFLAG_NORMAL);\r
-       }\r
-       if(cvar("cl_reticle_item_weapon"))\r
-       {\r
-               precache_pic("gfx/reticle_weapon");\r
-               if(reticle_type == 2 && f)\r
-                       drawpic(reticle_pos, "gfx/reticle_weapon", reticle_size, '1 1 1', f * cvar("cl_reticle_item_weapon"), DRAWFLAG_NORMAL);\r
+               f = current_zoomfraction;\r
+               if(zoomscript_caught)\r
+                       f = 1;\r
+               if(cvar("cl_reticle_item_normal"))\r
+               {\r
+                       if(reticle_type == 1 && f)\r
+                               drawpic(reticle_pos, "gfx/reticle_normal", reticle_size, '1 1 1', f * cvar("cl_reticle_item_normal"), DRAWFLAG_NORMAL);\r
+               }\r
+               if(cvar("cl_reticle_item_weapon"))\r
+               {\r
+                       if(reticle_type == 2 && f)\r
+                               drawpic(reticle_pos, "gfx/reticle_weapon", reticle_size, '1 1 1', f * cvar("cl_reticle_item_weapon"), DRAWFLAG_NORMAL);\r
+               }\r
        }\r
 \r
        // screen effects\r
@@ -516,6 +708,12 @@ void CSQC_UpdateView(float w, float h)
                        liquidcolor = stov(cvar_string("hud_contents_stomach_color"));\r
                        incontent = 1;\r
                }\r
+               else if(getstatf(STAT_VORE_PROGRESS_PREY))\r
+               {\r
+                       liquidalpha = cvar("hud_contents_swallow_alpha");\r
+                       liquidcolor = stov(cvar_string("hud_contents_swallow_color"));\r
+                       incontent = getstatf(STAT_VORE_PROGRESS_PREY); // based on the swallow progress\r
+               }\r
                else\r
                {\r
                        switch(pointcontents(view_origin))\r
@@ -557,13 +755,13 @@ void CSQC_UpdateView(float w, float h)
                        \r
                contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1);\r
                contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;\r
-               \r
+\r
                if(contentavgalpha)\r
                        drawfill('0 0 0', '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);\r
 \r
                if(cvar("hud_postprocessing"))\r
                {\r
-                       if(cvar("hud_contents_liquid_blur"))\r
+                       if(cvar("hud_contents_liquid_blur") && contentavgalpha)\r
                        {\r
                                // when inside the stomach, we use different blur settings than when we're inside other fluids\r
                                content_blurpostprocess_x = 1;\r
@@ -589,6 +787,11 @@ void CSQC_UpdateView(float w, float h)
 \r
        if(cvar("hud_damage"))\r
        {\r
+               splash_size_x = max(vid_conwidth, vid_conheight);\r
+               splash_size_y = max(vid_conwidth, vid_conheight);\r
+               splash_pos_x = (vid_conwidth - splash_size_x) / 2;\r
+               splash_pos_y = (vid_conheight - splash_size_y) / 2;\r
+\r
                float myhealth_flash_temp;\r
                myhealth = getstati(STAT_HEALTH);\r
 \r
@@ -645,11 +848,11 @@ void CSQC_UpdateView(float w, float h)
                        drawfill('0 0 0', '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, myhealth_gentlergb, cvar("hud_damage_gentle_alpha_multiplier") * bound(0, myhealth_flash_temp, 1) * cvar("hud_damage"), DRAWFLAG_NORMAL);\r
                }\r
                else\r
-                       drawpic('0 0 0', "gfx/blood", '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, stov(cvar_string("hud_damage_color")), bound(0, myhealth_flash_temp, 1) * cvar("hud_damage"), DRAWFLAG_NORMAL);\r
+                       drawpic(splash_pos, "gfx/blood", splash_size, stov(cvar_string("hud_damage_color")), bound(0, myhealth_flash_temp, 1) * cvar("hud_damage"), DRAWFLAG_NORMAL);\r
 \r
                if(cvar("hud_postprocessing"))\r
                {\r
-                       if(cvar("hud_damage_blur"))\r
+                       if(cvar("hud_damage_blur") && myhealth_flash_temp)\r
                        {\r
                                damage_blurpostprocess_x = 1;\r
                                damage_blurpostprocess_y = bound(0, myhealth_flash_temp, 1) * cvar("hud_damage_blur");\r
@@ -680,126 +883,141 @@ void CSQC_UpdateView(float w, float h)
                        else\r
                                stomachsplash_alpha = 0;\r
                }\r
-               if(getstati(STAT_HEALTH) <= 0)\r
-                       stomachsplash_remove_at_respawn = 1; // schedule the effect to be removed next respawn\r
 \r
-               if(getstati(STAT_HEALTH) > 0 && stomachsplash_remove_at_respawn)\r
-                       stomachsplash_alpha = stomachsplash_remove_at_respawn = 0; // we respawned, remove the effect\r
+               if(respawned)\r
+                       stomachsplash_alpha = 0; // we respawned, remove the effect\r
                if(spectatee_status == -1)\r
                        stomachsplash_alpha = 0;\r
 \r
                stomachsplash_alpha = bound(0, stomachsplash_alpha, 1);\r
-               drawpic('0 0 0', "gfx/food", '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, stov(cvar_string("hud_stomach_color")), stomachsplash_alpha, DRAWFLAG_NORMAL);\r
+               drawpic(splash_pos, "gfx/food", splash_size, stov(cvar_string("hud_stomach_color")), stomachsplash_alpha, DRAWFLAG_NORMAL);\r
        }\r
 \r
        if(cvar("hud_postprocessing"))\r
        {\r
+               // all of this should be done in the engine eventually\r
+\r
+               // disable damage blur when dead, but keep content blur\r
+               if(getstati(STAT_HEALTH) <= 0)\r
+                       damage_blurpostprocess = '0 0 0';\r
+\r
+               // enable or disable rendering types if they are used or not\r
+               if(cvar("r_glsl_postprocess_uservec1_enable") != (cvar("hud_postprocessing_maxbluralpha") != 0))\r
+                       cvar_set("r_glsl_postprocess_uservec1_enable", ftos(cvar("hud_postprocessing_maxbluralpha") != 0));\r
+               if(cvar("r_glsl_postprocess_uservec2_enable") != (cvar("hud_powerup") != 0))\r
+                       cvar_set("r_glsl_postprocess_uservec2_enable", ftos(cvar("hud_powerup") != 0));\r
+\r
                // lets apply the postprocess effects from the previous two functions if needed\r
-               if(damage_blurpostprocess_x || content_blurpostprocess_x)\r
+               if((damage_blurpostprocess_x || content_blurpostprocess_x) && cvar("chase_active") >= 0) // not while the event chase camera is active\r
                {\r
                        float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, cvar("hud_postprocessing_maxblurradius"));\r
                        float bluralpha = bound(0, damage_blurpostprocess_z + content_blurpostprocess_z, cvar("hud_postprocessing_maxbluralpha"));\r
-                       cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));\r
-                       cvar_set("r_glsl_postprocess_uservec1_enable", "1");\r
+                       if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible\r
+                       {\r
+                               cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));\r
+                               old_blurradius = blurradius;\r
+                               old_bluralpha = bluralpha;\r
+                       }\r
                }\r
-               else\r
+               else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible\r
                {\r
                        cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
-                       cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
+                       old_blurradius = 0;\r
+                       old_bluralpha = 0;\r
                }\r
 \r
                if(cvar("hud_powerup"))\r
                {\r
-                       float sharpen_intensity;\r
-                       if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)\r
-                               sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);\r
-                       if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)\r
-                               sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);\r
-                       sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there\r
-\r
-                       if(sharpen_intensity > 0)\r
+                       // When having the strength or invincible powerups, enable white outlines\r
+                       // As powerup time goes under 5 seconds (warning time) the lines fade away\r
+                       float cartoon_intensity;\r
+\r
+                       if((getstatf(STAT_STRENGTH_FINISHED) >= time || getstatf(STAT_INVINCIBLE_FINISHED) >= time) && cvar("chase_active") >= 0)\r
                        {\r
-                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));\r
-                               cvar_set("r_glsl_postprocess_uservec2_enable", "1");\r
+                               // not while the event chase camera is active\r
+                               cartoon_intensity = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 5) + bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 5);\r
+                               cartoon_intensity = cvar("hud_powerup") * bound(0, cartoon_intensity, 5);\r
                        }\r
                        else\r
+                               cartoon_intensity = 0;\r
+\r
+                       if(cartoon_intensity != old_cartoon_intensity) // reduce cvar_set spam as much as possible\r
                        {\r
-                               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
-                               cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
+                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(cartoon_intensity), " ", cvar_string("hud_powerup_tolerance"), " 0"));\r
+                               old_cartoon_intensity = cartoon_intensity;\r
                        }\r
                }\r
+               else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible\r
+               {\r
+                       cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
+                       old_cartoon_intensity = 0;\r
+               }\r
        }\r
 \r
-       if not(cvar("hud_damage") && cvar("hud_postprocessing"))\r
+       if(cvar("hud_postprocessing") && !cvar("hud_postprocessing_maxbluralpha"))\r
+       if(cvar("r_glsl_postprocess_uservec1_enable"))\r
        {\r
                // don't allow blur to get stuck on if we disable the cvar while damaged\r
                cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
                cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
        }\r
-       if not(cvar("hud_powerup") && cvar("hud_postprocessing"))\r
+       if(cvar("hud_postprocessing") && !cvar("hud_powerup"))\r
+       if(cvar("r_glsl_postprocess_uservec2_enable"))\r
        {\r
                // don't allow sharpen to get stuck on if we disable the cvar while powered up\r
                cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
                cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
        }\r
 \r
-       // volume cutting\r
-       if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1)\r
+       if(cvar("hud_postprocessing"))\r
        {\r
-               float volume_modify_1_target, volume_modify_2_target, volume_modify_fade;\r
+               // change saturation based on the amount of armor we have\r
+               // ranges between 0.5 and 1 saturation, over 0 armor and half the armor limit\r
 \r
-               if(volume_modify_changed_1 != cvar("menu_volume") || volume_modify_changed_2 != cvar("menu_bgmvolume"))\r
+               if(cvar("hud_saturation_armor") && armor_max && spectatee_status != -1 && getstati(STAT_HEALTH) > 0)\r
                {\r
-                       // An ugly hack to allow the cutvolume feature to work with the menu audio sliders.\r
-                       // Without it, adjusting the music or master sound sliders while fading that volume would have bad results.\r
-                       // This needs to be done in a better way! Currently, changing the volume sliders will just reset the fading.\r
+                       float saturation;\r
+                       saturation = 0.5 + (getstati(STAT_ARMOR) / armor_max);\r
+                       saturation = bound(0, saturation, 1);\r
 \r
-                       volume_modify_default_1 = cvar("menu_volume");\r
-                       volume_modify_default_2 = cvar("menu_bgmvolume");\r
-\r
-                       volume_modify_changed_1 = cvar("menu_volume");\r
-                       volume_modify_changed_2 = cvar("menu_bgmvolume");\r
+                       if(cvar("r_glsl_saturation") != saturation)\r
+                               cvar_set("r_glsl_saturation", ftos(saturation));\r
                }\r
-               else\r
+               else if (cvar("hud_saturation_death") && spectatee_status != -1 && getstati(STAT_HEALTH) <= 0)\r
                {\r
-                       if(spectatee_status == -1 || intermission)\r
-                       {\r
-                               volume_modify_1_target = volume_modify_default_1;\r
-                               volume_modify_2_target = volume_modify_default_2;\r
-                       }\r
-                       else if(getstati(STAT_VORE_EATEN))\r
-                       {\r
-                               volume_modify_1_target = volume_modify_default_1 * cvar("cl_vore_cutvolume_sound");\r
-                               volume_modify_2_target = volume_modify_default_2 * cvar("cl_vore_cutvolume_music");\r
-                       }\r
-                       else\r
-                       {\r
-                               volume_modify_1_target = volume_modify_default_1;\r
-                               volume_modify_2_target = volume_modify_default_2;\r
-                       }\r
-                       volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime;\r
-\r
-                       if(volume_modify_1 != volume_modify_1_target || volume_modify_2 != volume_modify_2_target)\r
-                       {\r
-                               if (volume_modify_1 > volume_modify_1_target + volume_modify_fade)\r
-                                       volume_modify_1 -= volume_modify_fade;\r
-                               else if (volume_modify_1 < volume_modify_1_target - volume_modify_fade)\r
-                                       volume_modify_1 += volume_modify_fade;\r
-                               else\r
-                                       volume_modify_1 = volume_modify_1_target;\r
-\r
-                               if (volume_modify_2 > volume_modify_2_target + volume_modify_fade)\r
-                                       volume_modify_2 -= volume_modify_fade;\r
-                               else if (volume_modify_2 < volume_modify_2_target - volume_modify_fade)\r
-                                       volume_modify_2 += volume_modify_fade;\r
-                               else\r
-                                       volume_modify_2 = volume_modify_2_target;\r
-\r
-                               cvar_set("volume", ftos(volume_modify_1));\r
-                               cvar_set("bgmvolume", ftos(volume_modify_2));\r
-                               // TODO: Setting the "volume" cvar is a bad way to go, and modifies the menu slider! We need a better way\r
-                       }\r
+                       if(cvar("r_glsl_saturation") != 0)\r
+                               cvar_set("r_glsl_saturation", "0");\r
                }\r
+               else if(cvar("r_glsl_saturation") != 1)\r
+                       cvar_set("r_glsl_saturation", "1");\r
+       }\r
+\r
+       float target_volume;\r
+       if(cvar("cl_vore_cutvolume_sound") && frametime)\r
+       {\r
+               // sound volume cutting\r
+               target_volume = 0;\r
+               if(getstatf(STAT_VORE_PROGRESS_PREY))\r
+                       target_volume = getstatf(STAT_VORE_PROGRESS_PREY);\r
+               else if(getstati(STAT_VORE_EATEN))\r
+                       target_volume = 1;\r
+               target_volume = cvar("menu_volume") * (1 - target_volume * cvar("cl_vore_cutvolume_sound"));\r
+\r
+               if(cvar("volume") != target_volume) // reduce cvar_set spam as much as possible\r
+                       cvar_set("volume", ftos(target_volume));\r
+       }\r
+       if(cvar("cl_vore_cutvolume_music") && frametime)\r
+       {\r
+               // music volume cutting\r
+               target_volume = 0;\r
+               if(getstatf(STAT_VORE_PROGRESS_PREY))\r
+                       target_volume = getstatf(STAT_VORE_PROGRESS_PREY);\r
+               else if(getstati(STAT_VORE_EATEN))\r
+                       target_volume = 1;\r
+               target_volume = cvar("menu_bgmvolume") * (1 - target_volume * cvar("cl_vore_cutvolume_music"));\r
+\r
+               if(cvar("bgmvolume") != target_volume) // reduce cvar_set spam as much as possible\r
+                       cvar_set("bgmvolume", ftos(target_volume));\r
        }\r
 \r
        // Draw the mouse cursor\r
@@ -824,24 +1042,25 @@ void CSQC_UpdateView(float w, float h)
                if(self.draw2d)\r
                        self.draw2d();\r
        self = e;\r
+       Draw_ShowNames_All();\r
 \r
        // draw radar\r
        if(\r
-                       ons_showmap\r
+                       showmap\r
                        ||\r
                        (\r
                         !scoreboard_active\r
                         &&\r
-                        cvar_string("cl_teamradar") != "0"\r
+                        cvar_string("cl_radar") != "0"\r
                         &&\r
                         (\r
-                         cvar("cl_teamradar") == 2\r
+                         cvar("cl_radar") == 2\r
                          ||\r
                          teamplay\r
                         )\r
                        )\r
          )\r
-               teamradar_view();\r
+               radar_view();\r
 \r
        // Draw artwork and play intermission music\r
        if(intermission && !isdemo() && gametype != GAME_RPG && !spectatee_status) // the match has ended. Don't do this for RPG because no one wins or loses there\r
@@ -946,13 +1165,55 @@ void CSQC_UpdateView(float w, float h)
        hud = getstati(STAT_HUD);\r
 \r
        if(cvar("r_letterbox") == 0)\r
-               if(cvar("viewsize") < 120)\r
+               if(cvar("viewsize") < 120 && sbar_hudselector)\r
                        CSQC_common_hud();\r
 \r
+       if(sbar_hudselector) // flashes require some HUD components to work\r
+       {\r
+               if(cvar("cl_flash_pickup"))\r
+               if(pickup_flash_time < getstatf(STAT_LAST_PICKUP))\r
+               {\r
+                       localcmd(strcat("bf ", cvar_string("cl_flash_pickup_color"), " ", cvar_string("cl_flash_pickup"), "\n"));\r
+                       pickup_flash_time = getstatf(STAT_LAST_PICKUP);\r
+               }\r
+               if(cvar("cl_flash_vore"))\r
+               {\r
+                       float vore_flash_state;\r
+                       if(getstati(STAT_VORE_EATEN))\r
+                               vore_flash_state = -1;\r
+                       else\r
+                               vore_flash_state = hud_total_prey;\r
+\r
+                       if not(spectatee_status && last_spectatee != spectatee_status) // not if we switched players and that detects a different stomach load\r
+                       {\r
+                               if(vore_flash_state > vore_flash_laststate && vore_flash_state > 0) // stomach load is bigger, so we ate someone\r
+                                       localcmd(strcat("bf ", cvar_string("cl_flash_vore_color_pred"), " ", cvar_string("cl_flash_vore"), "\n"));\r
+                               if(vore_flash_state < vore_flash_laststate && vore_flash_state < 0) // -1 means we have been eaten\r
+                                       localcmd(strcat("bf ", cvar_string("cl_flash_vore_color_prey"), " ", cvar_string("cl_flash_vore"), "\n"));\r
+                       }\r
+\r
+                       // always update the last vore state, or the flash can be triggered when switching spectated players one frame after\r
+                       vore_flash_laststate = vore_flash_state;\r
+               }\r
+               if(cvar("cl_flash_grab"))\r
+               {\r
+                       float grab_flash_state = getstatf(STAT_VORE_PROGRESS_PREY) > 0;\r
+                       if(grab_flash_state > grab_flash_laststate)\r
+                               localcmd(strcat("bf ", cvar_string("cl_flash_grab_color"), " ", cvar_string("cl_flash_grab"), "\n"));\r
+\r
+                       // always update the last grab state, or the flash can be triggered when switching spectated players one frame after\r
+                       grab_flash_laststate = grab_flash_state;\r
+               }\r
+               if(cvar("cl_flash_respawn"))\r
+               if(respawned)\r
+                       localcmd(strcat("bf ", cvar_string("cl_flash_respawn_color"), " ", cvar_string("cl_flash_respawn"), "\n"));\r
+       }\r
+\r
        if not(getstati(STAT_VORE_EATEN)) // crosshair is useless if we're in the stomach\r
+       if not(getstati(STAT_ARMOR) < g_power || time <= power_boot)\r
        {\r
                // crosshair goes VERY LAST\r
-               if(!scoreboard_active && !ons_showmap && !camera_active) {\r
+               if(!scoreboard_active && !showmap && !camera_active) {\r
                        // TrueAim check\r
                        float shottype;\r
                        // wcross_origin = '0.5 0 0' * vid_conwidth + '0 0.5 0' * vid_conheight;\r
@@ -984,8 +1245,18 @@ void CSQC_UpdateView(float w, float h)
                                wcross_style = "_canswallow_team.tga";\r
                        else if(swallow_indicator > 0)\r
                                wcross_style = "_canswallow.tga";\r
+                       else if(swallow_indicator < 0)\r
+                               wcross_style = "_canswallow_no.tga";\r
                        else\r
-                               wcross_style = cvar_string("crosshair");\r
+                       {\r
+                               // normal crosshair, based on what weapon we have and what firing type we can use\r
+                               if(!activeweapon)\r
+                                       wcross_style = cvar_string("crosshair");\r
+                               else if(getstati(STAT_CROSSHAIR_STYLE))\r
+                                       wcross_style = cvar_string("crosshair_secondary");\r
+                               else\r
+                                       wcross_style = cvar_string("crosshair_primary");\r
+                       }\r
 \r
                        if (wcross_style != "0") {\r
                                vector wcross_color, wcross_size;\r
@@ -1043,12 +1314,8 @@ void CSQC_UpdateView(float w, float h)
                                        }\r
                                }\r
                                else\r
-                               {\r
-                                       wcross_color_x = cvar("crosshair_color_red");\r
-                                       wcross_color_y = cvar("crosshair_color_green");\r
-                                       wcross_color_z = cvar("crosshair_color_blue");\r
-                               }\r
-                               wcross_alpha = cvar("crosshair_color_alpha");\r
+                                       wcross_color = stov(cvar_string("crosshair_color"));\r
+                               wcross_alpha = cvar("crosshair_alpha");\r
                                wcross_resolution = cvar("crosshair_size");\r
 \r
                                if(!activeweapon)\r
@@ -1180,7 +1447,7 @@ void CSQC_UpdateView(float w, float h)
                                CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f);\r
                                wcross_name_alpha_goal_prev = f;\r
 \r
-                               // ring around crosshair representing bullets left in weapon clip\r
+                               // ring around crosshair representing ammo left in weapon clip\r
                                weapon_clipload = getstati(STAT_WEAPON_CLIPLOAD);\r
                                a = cvar("crosshair_ring_alpha");\r
                                if (weapon_clipload && a)\r
@@ -1227,11 +1494,11 @@ void CSQC_UpdateView(float w, float h)
                string w0, h0;\r
                w0 = cvar_string("vid_conwidth");\r
                h0 = cvar_string("vid_conheight");\r
-               //R_SetView(VF_VIEWPORT, '0 0 0', '640 480 0');\r
-               //R_SetView(VF_FOV, '90 90 0');\r
-               R_SetView(VF_ORIGIN, '0 0 0');\r
-               R_SetView(VF_ANGLES, '0 0 0');\r
-               R_SetView(VF_PERSPECTIVE, 1);\r
+               //setproperty(VF_VIEWPORT, '0 0 0', '640 480 0');\r
+               //setproperty(VF_FOV, '90 90 0');\r
+               setproperty(VF_ORIGIN, '0 0 0');\r
+               setproperty(VF_ANGLES, '0 0 0');\r
+               setproperty(VF_PERSPECTIVE, 1);\r
                makevectors('0 0 0');\r
                vector v1, v2;\r
                cvar_set("vid_conwidth", "800");\r
@@ -1259,6 +1526,10 @@ void CSQC_UpdateView(float w, float h)
                localcmd("sendcvar chase_active\n");\r
                chase_active_old = cvar("chase_active");\r
        }\r
+\r
+       // update some stats to be detected next frame\r
+       last_health = getstati(STAT_HEALTH);\r
+       last_spectatee = spectatee_status;\r
 }\r
 \r
 void Sbar_Draw();\r
@@ -1421,6 +1692,6 @@ void CSQC_Demo_Camera()
                current_position = current_origin + current_camera_offset;\r
        }\r
 \r
-       R_SetView(VF_ANGLES, current_angles);\r
-       R_SetView(VF_ORIGIN, current_position);\r
+       setproperty(VF_ANGLES, current_angles);\r
+       setproperty(VF_ORIGIN, current_position);\r
 }\r