X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fclient%2FView.qc;h=7fde6824d320e767c30915e640ed50d6fa252df4;hp=f91026cf0845cff97e82084ca255e99fd8aecf7e;hb=bc91f7dc48927953480bdc9622973c7de075fb5f;hpb=cc7f2857061649324097221e0946b42e130a03f7 diff --git a/qcsrc/client/View.qc b/qcsrc/client/View.qc index f91026cf08..7fde6824d3 100644 --- a/qcsrc/client/View.qc +++ b/qcsrc/client/View.qc @@ -353,6 +353,9 @@ vector freeze_pmove_org, freeze_input_angles; entity nightvision_noise, nightvision_noise2; float pickup_crosshair_time, pickup_crosshair_size; +float hit_time, typehit_time; +float nextsound_hit_time, nextsound_typehit_time; +float hitindication_crosshair_time, hitindication_crosshair_size; float use_nex_chargepool; float myhealth, myhealth_prev; @@ -809,6 +812,19 @@ void CSQC_UpdateView(float w, float h) scoreboard_active = HUD_WouldDrawScoreboard(); + hit_time = getstatf(STAT_HIT_TIME); + if(hit_time > nextsound_hit_time && autocvar_cl_hitsound) + { + sound(world, CHAN_AUTO, "misc/hit.wav", VOL_BASE, ATTN_NONE); + nextsound_hit_time = time + autocvar_cl_hitsound_antispam_time; + } + typehit_time = getstatf(STAT_TYPEHIT_TIME); + if(typehit_time > nextsound_typehit_time) + { + sound(world, CHAN_AUTO, "misc/typehit.wav", VOL_BASE, ATTN_NONE); + nextsound_typehit_time = time + autocvar_cl_hitsound_antispam_time; + } + float hud; hud = getstati(STAT_HUD); if(hud == HUD_SPIDERBOT) @@ -973,6 +989,27 @@ void CSQC_UpdateView(float w, float h) wcross_scale += sin(pickup_crosshair_size) * autocvar_crosshair_pickup; } + + vector hitindication_color; + if(autocvar_crosshair_hitindication) + { + hitindication_color = stov(autocvar_crosshair_hitindication_color); + if(hitindication_crosshair_time < hit_time) + { + hitindication_crosshair_size = 1; + hitindication_crosshair_time = hit_time; + } + + if(hitindication_crosshair_size > 0) + hitindication_crosshair_size -= autocvar_crosshair_hitindication_speed * frametime; + else + hitindication_crosshair_size = 0; + + wcross_scale += sin(hitindication_crosshair_size) * autocvar_crosshair_hitindication; + wcross_color_x += sin(hitindication_crosshair_size) * hitindication_color_x; + wcross_color_y += sin(hitindication_crosshair_size) * hitindication_color_y; + wcross_color_z += sin(hitindication_crosshair_size) * hitindication_color_z; + } if(shottype == SHOTTYPE_HITENEMY) wcross_scale *= autocvar_crosshair_hittest; // is not queried if hittest is 0