]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/View.qc
Respawn screen flash
[voretournament/voretournament.git] / data / qcsrc / client / View.qc
index 7d803a60737cc8f4030221bbd7a0acf4d542fc4e..bf89e9a4257dfd24a8333f995bbf25ea87e49747 100644 (file)
@@ -250,8 +250,22 @@ void CSQC_Demo_Camera();
 float Sbar_WouldDrawScoreboard ();\r
 float view_set;\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, pickup_flash_time, vore_flash_laststate, respawn_flash_lasthealth;\r
+float myhealth, myhealth_prev, myhealth_flash;\r
+float contentavgalpha, liquidalpha_prev;\r
+float old_blurradius, old_bluralpha, old_sharpen_intensity;\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 eventchase_current_distance;\r
+vector myhealth_gentlergb;\r
+vector liquidcolor_prev;\r
+vector damage_blurpostprocess, content_blurpostprocess;\r
 string artwork_image;\r
+string intermission_song;\r
 string NextFrameCommand;\r
 void CSQC_UpdateView(float w, float h)\r
 {\r
@@ -259,7 +273,10 @@ void CSQC_UpdateView(float w, float h)
        float fov;\r
        float f, i, j;\r
        vector v, vo;\r
+       float a;\r
 \r
+       vector reticle_pos, reticle_size;\r
+       vector splash_pos, splash_size;\r
        vector artwork_pos, artwork_size;\r
 \r
        WaypointSprite_Load();\r
@@ -278,6 +295,42 @@ void CSQC_UpdateView(float w, float h)
        pmove_org = warpzone_fixview_origin - vo;\r
        input_angles = warpzone_fixview_angles;\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(!getstati(STAT_VORE_EATEN) && spectatee_status >= 0 && (cvar("cl_eventchase_death") && getstati(STAT_HEALTH) <= 0 && !intermission))\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 R_SetView()\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 = pmove_org - v_forward * eventchase_current_distance;\r
+\r
+                       traceline(pmove_org, 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 = pmove_org - v_forward * eventchase_current_distance * (trace_fraction - 0.1);\r
+\r
+                       R_SetView(VF_ORIGIN, eventchase_target_origin);\r
+                       R_SetView(VF_ANGLES, 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
        // Render the Scene\r
        if(!intermission || !view_set)\r
        {\r
@@ -448,6 +501,390 @@ void CSQC_UpdateView(float w, float h)
        // next R_RenderScene call\r
        drawstring('0 0 0', "", '1 1 0', '1 1 1', 0, 0);\r
 \r
+       // Draw the aiming reticle for weapons that use it\r
+       // reticle_type is changed to the item we are zooming / aiming with, to decide which reticle to use\r
+       // It must be a persisted float for fading out to work properly (you let go of the zoom button for\r
+       // the view to go back to normal, so reticle_type would become 0 as we fade out)\r
+       if(spectatee_status || getstati(STAT_HEALTH) <= 0)\r
+               reticle_type = 0; // prevent reticle from showing during the respawn zoom effect or for spectators\r
+       else if(activeweapon && (button_zoom || zoomscript_caught))\r
+               reticle_type = 2; // weapon zoom\r
+       else if(button_zoom || zoomscript_caught)\r
+               reticle_type = 1; // normal zoom\r
+\r
+       if (reticle_type)\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
+                       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
+       if(cvar("hud_contents"))\r
+       {\r
+               float contentalpha_temp, incontent, liquidalpha, contentfadetime;\r
+               vector liquidcolor;\r
+\r
+               if (getstati(STAT_VORE_EATEN))\r
+               {\r
+                       liquidalpha = cvar("hud_contents_stomach_alpha");\r
+                       liquidcolor = stov(cvar_string("hud_contents_stomach_color"));\r
+                       incontent = 1;\r
+               }\r
+               else\r
+               {\r
+                       switch(pointcontents(view_origin))\r
+                       {\r
+                               case CONTENT_WATER:\r
+                                       liquidalpha = cvar("hud_contents_water_alpha");\r
+                                       liquidcolor = stov(cvar_string("hud_contents_water_color"));\r
+                                       incontent = 1;\r
+                                       break;\r
+                                       \r
+                               case CONTENT_LAVA:\r
+                                       liquidalpha = cvar("hud_contents_lava_alpha");\r
+                                       liquidcolor = stov(cvar_string("hud_contents_lava_color"));\r
+                                       incontent = 1;\r
+                                       break;  \r
+                                                               \r
+                               case CONTENT_SLIME:\r
+                                       liquidalpha = cvar("hud_contents_slime_alpha");\r
+                                       liquidcolor = stov(cvar_string("hud_contents_slime_color"));\r
+                                       incontent = 1;\r
+                                       break;\r
+                                       \r
+                               default:\r
+                                       liquidalpha = 0;\r
+                                       liquidcolor = '0 0 0';\r
+                                       incontent = 0;\r
+                                       break;\r
+                       }\r
+               }\r
+               \r
+               if(incontent) // fade in/out at different speeds so you can do e.g. instant fade when entering water and slow when leaving it.\r
+               { // also lets delcare previous values for blending properties, this way it isn't reset until after you have entered a different content\r
+                       contentfadetime = cvar("hud_contents_fadeintime");\r
+                       liquidalpha_prev = liquidalpha;\r
+                       liquidcolor_prev = liquidcolor;\r
+               }\r
+               else\r
+                       contentfadetime = cvar("hud_contents_fadeouttime");\r
+                       \r
+               contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1);\r
+               contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;\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") && 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
+                               if(getstati(STAT_VORE_EATEN))\r
+                               {\r
+                                       content_blurpostprocess_y = contentavgalpha * cvar("hud_contents_stomach_blur");\r
+                                       content_blurpostprocess_z = contentavgalpha * cvar("hud_contents_stomach_blur_alpha");\r
+                               }\r
+                               else\r
+                               {\r
+                                       content_blurpostprocess_y = contentavgalpha * cvar("hud_contents_liquid_blur");\r
+                                       content_blurpostprocess_z = contentavgalpha * cvar("hud_contents_liquid_blur_alpha");\r
+                               }\r
+                       }\r
+                       else\r
+                       {\r
+                               content_blurpostprocess_x = 0;\r
+                               content_blurpostprocess_y = 0;\r
+                               content_blurpostprocess_z = 0;\r
+                       }\r
+               }\r
+       }\r
+\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
+               // fade out\r
+               myhealth_flash = max(0, myhealth_flash - cvar("hud_damage_fade_rate") * frametime);\r
+               // add new damage\r
+               myhealth_flash = bound(0, myhealth_flash + dmg_take * cvar("hud_damage_factor"), cvar("hud_damage_maxalpha"));\r
+\r
+               float pain_threshold, pain_threshold_lower, pain_threshold_lower_health;\r
+               pain_threshold = cvar("hud_damage_pain_threshold");\r
+               pain_threshold_lower = cvar("hud_damage_pain_threshold_lower");\r
+               pain_threshold_lower_health = cvar("hud_damage_pain_threshold_lower_health");\r
+\r
+               if(pain_threshold_lower && myhealth < pain_threshold_lower_health)\r
+               {\r
+                       pain_threshold = pain_threshold - max(cvar("hud_damage_pain_threshold_pulsating_min"), fabs(sin(M_PI * time / cvar("hud_damage_pain_threshold_pulsating_period")))) * pain_threshold_lower * (1 - max(0, myhealth)/pain_threshold_lower_health);\r
+               }\r
+\r
+               myhealth_flash_temp = bound(0, myhealth_flash - pain_threshold, 1);\r
+\r
+               if(myhealth_prev < 1)\r
+               {\r
+                       if(myhealth >= 1)\r
+                       {\r
+                               myhealth_flash = 0; // just spawned, clear the flash immediately\r
+                               myhealth_flash_temp = 0;\r
+                       }\r
+                       else\r
+                       {\r
+                               myhealth_flash += cvar("hud_damage_fade_rate") * frametime; // dead\r
+                       }\r
+               }\r
+\r
+               if(spectatee_status == -1 || intermission)\r
+               {\r
+                       myhealth_flash = 0; // observing, or match ended\r
+                       myhealth_flash_temp = 0;\r
+               }\r
+\r
+               myhealth_prev = myhealth;\r
+\r
+               if(cvar("cl_gentle_damage") || cvar("cl_gentle"))\r
+               {\r
+                       if(cvar("cl_gentle_damage") == 2)\r
+                       {\r
+                               if(myhealth_flash < pain_threshold) // only randomize when the flash is gone\r
+                               {\r
+                                       myhealth_gentlergb = '1 0 0' * random() + '0 1 0' * random() + '0 0 1' * random();\r
+                               }\r
+                       }\r
+                       else\r
+                               myhealth_gentlergb = stov(cvar_string("hud_damage_gentle_color"));\r
+\r
+                       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(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") && myhealth_flash_temp)\r
+                       {\r
+                               damage_blurpostprocess_x = 1;\r
+                               damage_blurpostprocess_y = bound(0, myhealth_flash_temp, 1) * cvar("hud_damage_blur");\r
+                               damage_blurpostprocess_z = bound(0, myhealth_flash_temp, 1) * cvar("hud_damage_blur_alpha");\r
+                       }\r
+                       else\r
+                       {\r
+                               damage_blurpostprocess_x = 0;\r
+                               damage_blurpostprocess_y = 0;\r
+                               damage_blurpostprocess_z = 0;\r
+                       }\r
+               }\r
+       }\r
+\r
+       if(cvar("hud_stomach"))\r
+       {\r
+               if(getstati(STAT_VORE_EATEN))\r
+               {\r
+                       if(stomachsplash_alpha < cvar("hud_stomach"))\r
+                               stomachsplash_alpha += cvar("hud_stomach_fade_in") * frametime;\r
+                       else\r
+                               stomachsplash_alpha = cvar("hud_stomach");\r
+               }\r
+               else if(getstati(STAT_HEALTH) > 0)\r
+               {\r
+                       if(stomachsplash_alpha > 0)\r
+                               stomachsplash_alpha -= cvar("hud_stomach_fade_out") * frametime;\r
+                       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(spectatee_status == -1)\r
+                       stomachsplash_alpha = 0;\r
+\r
+               stomachsplash_alpha = bound(0, stomachsplash_alpha, 1);\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) && 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
+                       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 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
+                       old_blurradius = 0;\r
+                       old_bluralpha = 0;\r
+               }\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
+\r
+               if(cvar("hud_powerup") && sharpen_intensity > 0 && cvar("chase_active") >= 0) // not while the event chase camera is active\r
+               {\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 != old_sharpen_intensity) // reduce cvar_set spam as much as possible\r
+                       {\r
+                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));\r
+                               old_sharpen_intensity = sharpen_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_sharpen_intensity = 0;\r
+               }\r
+       }\r
+\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(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
+       if(cvar("hud_postprocessing"))\r
+       {\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(cvar("hud_saturation") && armor_max && spectatee_status != -1 && getstati(STAT_HEALTH) > 0)\r
+               {\r
+                       float saturation;\r
+                       saturation = 0.5 + (getstati(STAT_ARMOR) / armor_max);\r
+                       saturation = bound(0, saturation, 1);\r
+\r
+                       if(cvar("r_glsl_saturation") != saturation)\r
+                               cvar_set("r_glsl_saturation", ftos(saturation));\r
+               }\r
+               else if(cvar("r_glsl_saturation") != 1)\r
+                       cvar_set("r_glsl_saturation", "1");\r
+       }\r
+\r
+       // volume cutting\r
+       if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1)\r
+       {\r
+               float volume_modify_1_target, volume_modify_2_target, volume_modify_fade;\r
+\r
+               if(volume_modify_changed_1 != cvar("menu_volume") || volume_modify_changed_2 != cvar("menu_bgmvolume"))\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
+\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
+               }\r
+               else\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
+               }\r
+       }\r
+\r
        // Draw the mouse cursor\r
        // NOTE: drawpic must happen after R_RenderScene for some reason\r
        //drawpic(getmousepos(), "gfx/cursor.tga", '11 14 0', '1 1 1', 1, 0);\r
@@ -470,6 +907,7 @@ 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
@@ -489,6 +927,84 @@ void CSQC_UpdateView(float w, float h)
          )\r
                teamradar_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
+       {\r
+               if(cvar("cl_artwork"))\r
+               {\r
+                       if(artwork_image == "")\r
+                       {\r
+                               if(getstati(STAT_WINNING)) // we are the winner\r
+                               {\r
+                                       if(cvar("cl_artwork_win"))\r
+                                       {\r
+                                               artwork_image = strcat("gfx/artwork_won_", ftos(floor(1 + (random() * cvar("cl_artwork_win")))));\r
+                                               artwork_image = strzone(artwork_image);\r
+                                       }\r
+                               }\r
+                               else // we have lost\r
+                               {\r
+                                       if(cvar("cl_artwork_lose"))\r
+                                       {\r
+                                               artwork_image = strcat("gfx/artwork_lost_", ftos(floor(1 + (random() * cvar("cl_artwork_lose")))));\r
+                                               artwork_image = strzone(artwork_image);\r
+                                       }\r
+                               }\r
+                       }\r
+\r
+                       if(cvar("cl_artwork_stretch"))\r
+                       {\r
+                               artwork_size_x = vid_conwidth;\r
+                               artwork_size_y = vid_conheight;\r
+                               artwork_pos_x = 0;\r
+                               artwork_pos_y = 0;\r
+                       }\r
+                       else\r
+                       {\r
+                               artwork_size_x = max(vid_conwidth, vid_conheight);\r
+                               artwork_size_y = max(vid_conwidth, vid_conheight);\r
+                               artwork_pos_x = (vid_conwidth - artwork_size_x) / 2;\r
+                               artwork_pos_y = (vid_conheight - artwork_size_y) / 2;\r
+                       }\r
+\r
+                       if(artwork_fade < cvar("cl_artwork_alpha") && cvar("cl_artwork_fade"))\r
+                               artwork_fade += frametime * cvar("cl_artwork_fade");\r
+                       else\r
+                               artwork_fade = cvar("cl_artwork_alpha");\r
+\r
+                       if(artwork_image != "")\r
+                               drawpic(artwork_pos, artwork_image, artwork_size, '1 1 1', artwork_fade, DRAWFLAG_NORMAL);\r
+               }\r
+\r
+               if(cvar("cl_intermission") && intermission_song == "") // don't start the song each frame\r
+               {\r
+                       if(getstati(STAT_WINNING))\r
+                               intermission_song = cvar_string("cl_intermission_cdtrack_win");\r
+                       else\r
+                               intermission_song = cvar_string("cl_intermission_cdtrack_lose");\r
+                       if(intermission_song != "")\r
+                       {\r
+                               localcmd(strcat("\ncd play ", intermission_song, "\n"));\r
+                               intermission_song = strzone(intermission_song);\r
+                       }\r
+               }\r
+       }\r
+       else\r
+       {\r
+               artwork_fade = 0;\r
+               if(artwork_image != "")\r
+               {\r
+                       strunzone(artwork_image);\r
+                       artwork_image = "";\r
+               }\r
+\r
+               if(intermission_song != "")\r
+               {\r
+                       strunzone(intermission_song);\r
+                       intermission_song = "";\r
+               }\r
+       }\r
+\r
        // draw sbar\r
        if(cvar("r_letterbox") == 0) {\r
                if (cvar("cl_showpressedkeys")) { // draw pressed keys when spectating and playing\r
@@ -504,6 +1020,12 @@ void CSQC_UpdateView(float w, float h)
                Sbar_DrawCenterPrint(); // draw centerprint messages even if viewsize >= 120\r
        }\r
 \r
+       float weapon_clipload, weapon_clipsize, ring_scale;\r
+\r
+       float swallow_indicator;\r
+       if(cvar("crosshair_swallowindicator"))\r
+               swallow_indicator = getstati(STAT_VORE_CANSWALLOW);\r
+\r
        float hud;\r
        hud = getstati(STAT_HUD);\r
 \r
@@ -511,6 +1033,38 @@ void CSQC_UpdateView(float w, float h)
                if(cvar("viewsize") < 120)\r
                        CSQC_common_hud();\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 = getstati(STAT_VORE_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
+               vore_flash_laststate = vore_flash_state;\r
+       }\r
+       if(cvar("cl_flash_respawn"))\r
+       {\r
+               float respawn_flash_health;\r
+               respawn_flash_health = getstati(STAT_HEALTH);\r
+\r
+               if(respawn_flash_lasthealth <= 0 && respawn_flash_health > 0)\r
+                       localcmd(strcat("bf ", cvar_string("cl_flash_respawn_color"), " ", cvar_string("cl_flash_respawn"), "\n"));\r
+\r
+               respawn_flash_lasthealth = respawn_flash_health;\r
+       }\r
+\r
        if not(getstati(STAT_VORE_EATEN)) // crosshair is useless if we're in the stomach\r
        {\r
                // crosshair goes VERY LAST\r
@@ -521,6 +1075,7 @@ void CSQC_UpdateView(float w, float h)
                        wcross_origin = project_3d_to_2d(view_origin + MAX_SHOT_DISTANCE * view_forward);\r
                        wcross_origin_z = 0;\r
                        if(cvar("crosshair_hittest"))\r
+                       if(!swallow_indicator)\r
                        {\r
                                vector wcross_oldorigin;\r
                                wcross_oldorigin = wcross_origin;\r
@@ -540,19 +1095,89 @@ void CSQC_UpdateView(float w, float h)
                                shottype = SHOTTYPE_HITWORLD;\r
 \r
                        string wcross_style;\r
-                       wcross_style = cvar_string("crosshair");\r
+\r
+                       if(swallow_indicator  > 1)\r
+                               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
                        if (wcross_style != "0") {\r
                                vector wcross_color, wcross_size;\r
                                string wcross_name;\r
                                float wcross_alpha, wcross_scale, wcross_blur, wcross_resolution;\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
+                               if(swallow_indicator && (cvar("crosshair_swallowindicator_color_red") || cvar("crosshair_swallowindicator_color_green") || cvar("crosshair_swallowindicator_color_blue")))\r
+                               {\r
+                                       wcross_color_x = cvar("crosshair_swallowindicator_color_red");\r
+                                       wcross_color_y = cvar("crosshair_swallowindicator_color_green");\r
+                                       wcross_color_z = cvar("crosshair_swallowindicator_color_blue");\r
+                               }\r
+                               else if(cvar("crosshair_color_by_health"))\r
+                               {\r
+                                       local float x = getstati(STAT_HEALTH);\r
+                                       \r
+                                       //x = red\r
+                                       //y = green\r
+                                       //z = blue\r
+                                       \r
+                                       wcross_color_z = 0;\r
+                                       \r
+                                       if(x > 200)\r
+                                       {\r
+                                               wcross_color_x = 0;\r
+                                               wcross_color_y = 1;\r
+                                       }\r
+                                       else if(x > 150)\r
+                                       {\r
+                                               wcross_color_x = 0.4 - (x-150)*0.02 * 0.4;\r
+                                               wcross_color_y = 0.9 + (x-150)*0.02 * 0.1;\r
+                                       }\r
+                                       else if(x > 100)\r
+                                       {\r
+                                               wcross_color_x = 1 - (x-100)*0.02 * 0.6;\r
+                                               wcross_color_y = 1 - (x-100)*0.02 * 0.1;\r
+                                               wcross_color_z = 1 - (x-100)*0.02;\r
+                                       }\r
+                                       else if(x > 50)\r
+                                       {\r
+                                               wcross_color_x = 1;\r
+                                               wcross_color_y = 1;\r
+                                               wcross_color_z = 0.2 + (x-50)*0.02 * 0.8;  \r
+                                       }\r
+                                       else if(x > 20)\r
+                                       {\r
+                                               wcross_color_x = 1;\r
+                                               wcross_color_y = (x-20)*90/27/100;\r
+                                               wcross_color_z = (x-20)*90/27/100 * 0.2;\r
+                                       }\r
+                                       else\r
+                                       {\r
+                                               wcross_color_x = 1;\r
+                                               wcross_color_y = 0;\r
+                                       }\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_resolution = cvar("crosshair_size");\r
 \r
+                               if(!activeweapon)\r
+                               if(!swallow_indicator)\r
+                               {\r
+                                       if(cvar("crosshair_unarmed_dim_color"))\r
+                                               wcross_color *= cvar("crosshair_unarmed_dim_color");\r
+                                       if(cvar("crosshair_unarmed_dim_alpha"))\r
+                                               wcross_alpha *= cvar("crosshair_unarmed_dim_alpha");\r
+                               }\r
+\r
                                wcross_name = strcat("gfx/crosshair", wcross_style);\r
 \r
                                if(cvar("crosshair_effect_scalefade"))\r
@@ -564,6 +1189,24 @@ void CSQC_UpdateView(float w, float h)
                                {\r
                                        wcross_scale = 1;\r
                                }\r
+                               if(swallow_indicator)\r
+                                       wcross_scale *= cvar("crosshair_swallowindicator_size");\r
+\r
+                               if(cvar("crosshair_pickup"))\r
+                               {\r
+                                       if(pickup_crosshair_time < getstatf(STAT_LAST_PICKUP))\r
+                                       {\r
+                                               pickup_crosshair_size = 1;\r
+                                               pickup_crosshair_time = getstatf(STAT_LAST_PICKUP);\r
+                                       }\r
+\r
+                                       if(pickup_crosshair_size > 0)\r
+                                               pickup_crosshair_size -= cvar("crosshair_pickup_speed") * frametime;\r
+                                       else\r
+                                               pickup_crosshair_size = 0;\r
+\r
+                                       wcross_scale += sin(pickup_crosshair_size) * cvar("crosshair_pickup");\r
+                               }\r
 \r
                                if(shottype == SHOTTYPE_HITENEMY)\r
                                        wcross_scale *= cvar("crosshair_hittest"); // is not queried if hittest is 0\r
@@ -654,6 +1297,18 @@ void CSQC_UpdateView(float w, float h)
                                wcross_size = drawgetimagesize(wcross_name) * wcross_scale;\r
                                CROSSHAIR_DRAW(wcross_resolution, wcross_name, wcross_alpha * f);\r
                                wcross_name_alpha_goal_prev = f;\r
+\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
+                               if (!swallow_indicator)\r
+                               {\r
+                                       weapon_clipsize = getstati(STAT_WEAPON_CLIPSIZE);\r
+                                       ring_scale = cvar("crosshair_ring_size");\r
+                                       f = bound(0, weapon_clipload / weapon_clipsize, 1);\r
+                                       DrawCircleClippedPic(wcross_origin, wcross_size_x * ring_scale, "gfx/crosshair_ring.tga", f, wcross_color, wcross_alpha * a, DRAWFLAG_ADDITIVE);\r
+                               }\r
                        }\r
                }\r
                else\r
@@ -678,30 +1333,6 @@ void CSQC_UpdateView(float w, float h)
                }\r
        }\r
 \r
-       // Draw Artwork\r
-       if(intermission && !isdemo()) // match has ended\r
-       {\r
-               //if(getstati(STAT_WINNING))\r
-                       //localcmd("disconnect\n");\r
-\r
-               if(cvar("cl_artwork_stretch"))\r
-               {\r
-                       artwork_size_x = vid_conwidth;\r
-                       artwork_size_y = vid_conheight;\r
-                       artwork_pos_x = 0;\r
-                       artwork_pos_y = 0;\r
-               }\r
-               else\r
-               {\r
-                       artwork_size_x = max(vid_conwidth, vid_conheight);\r
-                       artwork_size_y = max(vid_conwidth, vid_conheight);\r
-                       artwork_pos_x = (vid_conwidth - artwork_size_x) / 2;\r
-                       artwork_pos_y = (vid_conheight - artwork_size_y) / 2;\r
-               }\r
-\r
-               drawpic(artwork_pos, "gfx/hslimage", artwork_size, '1 1 1', 1, DRAWFLAG_NORMAL);\r
-       }\r
-\r
        if(NextFrameCommand)\r
        {\r
                localcmd("\n", NextFrameCommand, "\n");\r