X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2FView.qc;h=08c247f4e2ddd3a418f6a78798b69ba02f7f1c91;hb=55c5e5f476604b1e99df20f8974d561f99d0f405;hp=4f00c55341639fbce6fd13122c29384a1db910b6;hpb=3319c56e4f4d3d2e4dc657147ebfd8fbfabb7aef;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index 4f00c5534..08c247f4e 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -381,9 +381,13 @@ vector damage_blurpostprocess, content_blurpostprocess; float checkfail[16]; +float rainbow_last_flicker; +vector rainbow_prev_color; + #define BUTTON_3 4 #define BUTTON_4 8 float cl_notice_run(); +float prev_myteam; void CSQC_UpdateView(float w, float h) { entity e; @@ -442,6 +446,14 @@ void CSQC_UpdateView(float w, float h) #endif myteam = GetPlayerColor(player_localentnum - 1); + if(myteam != prev_myteam) + { + myteamcolors = colormapPaletteColor(myteam, 1); + for(i = 0; i < HUD_PANEL_NUM; ++i) + hud_panel[i].update_time = time; + prev_myteam = myteam; + } + ticrate = getstatf(STAT_MOVEVARS_TICRATE) * getstatf(STAT_MOVEVARS_TIMESCALE); float is_dead = (getstati(STAT_HEALTH) <= 0); @@ -886,8 +898,8 @@ void CSQC_UpdateView(float w, float h) } } } - - if(autocvar_hud_damage) + + if(autocvar_hud_damage && !getstati(STAT_FROZEN)) { splash_size_x = max(vid_conwidth, vid_conheight); splash_size_y = max(vid_conwidth, vid_conheight); @@ -1071,7 +1083,7 @@ void CSQC_UpdateView(float w, float h) if(getstatf(STAT_REVIVE_PROGRESS)) { DrawCircleClippedPic(eX * 0.5 * vid_conwidth + eY * 0.6 * vid_conheight, 0.1 * vid_conheight, "gfx/crosshair_ring.tga", getstatf(STAT_REVIVE_PROGRESS), '0.25 0.90 1', autocvar_hud_colorflash_alpha, DRAWFLAG_ADDITIVE); - drawstring_aspect(eY * 0.64 * vid_conheight, "Revival progress", eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL); + drawstring_aspect(eY * 0.64 * vid_conheight, _("Revival progress"), eX * vid_conwidth + eY * 0.025 * vid_conheight, '1 1 1', 1, DRAWFLAG_NORMAL); } } @@ -1126,7 +1138,8 @@ void CSQC_UpdateView(float w, float h) string wcross_wep = "", wcross_name; float wcross_scale, wcross_blur; - if (autocvar_crosshair_per_weapon || autocvar_crosshair_color_per_weapon) { + if (autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1)) + { e = get_weaponinfo(switchingweapon); if (e && e.netname != "") { @@ -1146,56 +1159,82 @@ void CSQC_UpdateView(float w, float h) } } } - if(wcross_wep != "" && autocvar_crosshair_color_per_weapon) - wcross_color = stov(cvar_string(strcat("crosshair_", wcross_wep, "_color"))); - else if(autocvar_crosshair_color_by_health) - { - float x = getstati(STAT_HEALTH); - - //x = red - //y = green - //z = blue - wcross_color_z = 0; + //print(sprintf("crosshair style: %s\n", wcross_style)); + wcross_name = strcat("gfx/crosshair", wcross_style); - if(x > 200) - { - wcross_color_x = 0; - wcross_color_y = 1; - } - else if(x > 150) - { - wcross_color_x = 0.4 - (x-150)*0.02 * 0.4; - wcross_color_y = 0.9 + (x-150)*0.02 * 0.1; - } - else if(x > 100) - { - wcross_color_x = 1 - (x-100)*0.02 * 0.6; - wcross_color_y = 1 - (x-100)*0.02 * 0.1; - wcross_color_z = 1 - (x-100)*0.02; - } - else if(x > 50) + // MAIN CROSSHAIR COLOR DECISION + switch(autocvar_crosshair_color_special) + { + case 1: // crosshair_color_per_weapon { - wcross_color_x = 1; - wcross_color_y = 1; - wcross_color_z = 0.2 + (x-50)*0.02 * 0.8; + if(wcross_wep != "") + { + wcross_color = stov(cvar_string(sprintf("crosshair_%s_color", wcross_wep))); + break; + } + else { goto normalcolor; } } - else if(x > 20) + + case 2: // crosshair_color_by_health { - wcross_color_x = 1; - wcross_color_y = (x-20)*90/27/100; - wcross_color_z = (x-20)*90/27/100 * 0.2; + float x = getstati(STAT_HEALTH); + + //x = red + //y = green + //z = blue + + wcross_color_z = 0; + + if(x > 200) + { + wcross_color_x = 0; + wcross_color_y = 1; + } + else if(x > 150) + { + wcross_color_x = 0.4 - (x-150)*0.02 * 0.4; + wcross_color_y = 0.9 + (x-150)*0.02 * 0.1; + } + else if(x > 100) + { + wcross_color_x = 1 - (x-100)*0.02 * 0.6; + wcross_color_y = 1 - (x-100)*0.02 * 0.1; + wcross_color_z = 1 - (x-100)*0.02; + } + else if(x > 50) + { + wcross_color_x = 1; + wcross_color_y = 1; + wcross_color_z = 0.2 + (x-50)*0.02 * 0.8; + } + else if(x > 20) + { + wcross_color_x = 1; + wcross_color_y = (x-20)*90/27/100; + wcross_color_z = (x-20)*90/27/100 * 0.2; + } + else + { + wcross_color_x = 1; + wcross_color_y = 0; + } + break; } - else + + case 3: // crosshair_color_rainbow { - wcross_color_x = 1; - wcross_color_y = 0; + if(time >= rainbow_last_flicker) + { + rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness; + rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay; + } + wcross_color = rainbow_prev_color; + break; } + :normalcolor + default: { wcross_color = stov(autocvar_crosshair_color); break; } } - else - wcross_color = stov(autocvar_crosshair_color); - - wcross_name = strcat("gfx/crosshair", wcross_style); if(autocvar_crosshair_effect_scalefade) { @@ -1229,7 +1268,7 @@ void CSQC_UpdateView(float w, float h) if(autocvar_crosshair_hitindication) { - vector hitindication_color = ((autocvar_crosshair_color_per_weapon) ? stov(autocvar_crosshair_hitindication_per_weapon_color) : stov(autocvar_crosshair_hitindication_color)); + vector hitindication_color = ((autocvar_crosshair_color_special == 1) ? stov(autocvar_crosshair_hitindication_per_weapon_color) : stov(autocvar_crosshair_hitindication_color)); if(hitindication_crosshair_time < hit_time) { @@ -1255,9 +1294,7 @@ void CSQC_UpdateView(float w, float h) if(shottype == SHOTTYPE_HITTEAM) wcross_scale /= autocvar_crosshair_hittest; // is not queried if hittest is 0 - f = autocvar_crosshair_effect_speed; - if(f < 0) - f *= -2 * g_weaponswitchdelay; // anim starts when weapon has been lowered and new weapon comes up + f = fabs(autocvar_crosshair_effect_time); if(wcross_scale != wcross_scale_goal_prev || wcross_alpha != wcross_alpha_goal_prev || wcross_color != wcross_color_goal_prev) { wcross_changedonetime = time + f; @@ -1381,9 +1418,9 @@ void CSQC_UpdateView(float w, float h) } // if in weapon switch animation, fade ring out/in - if(g_weaponswitchdelay > 0) + if(fabs(autocvar_crosshair_effect_time) > 0) { - f = (time - wcross_name_changestarttime) / g_weaponswitchdelay; + f = (time - wcross_name_changestarttime) / wcross_changedonetime; if(f > 0 && f < 2) ring_alpha *= fabs(1 - f); }