local currhud local curr_tex local cur_weapon_fov local hud_tbl={ --'hud_gaz svoboda_gaz_outfit_m1="hud_gaz", dolg_gaz_outfit_m1="hud_gaz", neytral_gaz_outfit_m1="hud_gaz", neytral_novice_gaz_outfit_m1="hud_gaz", svoboda_heavy_gaz_outfit_m1="hud_gaz", bandit_gaz_outfit_m1="hud_gaz", --'hud_exo outfit_exo_m1="hud_exo_m1", neytral_exo_gaz_outfit_m1="hud_exo", svoboda_yellow_exo_outfit_m1="hud_exo", exo_outfit="hud_exo", dolg_black_exoskeleton="hud_exo", svoboda_exoskeleton="hud_exo", monolit_exoskeleton="hud_exo", exo_bandit_outfit="hud_exo_bandit", broken_exoskeleton="hud_exo_broken", neytral_exo_antigas_outfit="hud_exo", --'hud_merc killer_gaz_outfit_m1="hud_merc", killer_blue_exoskeleton="hud_merc", --'hud_sci dolg_scientific_outfit="hud_sci", ecolog_outfit="hud_sci", protection_outfit="hud_sci", scientific_outfit="hud_sci", freedom_scientific_outfit="hud_sci", merc_scientific_outfit="hud_sci", monolit_scientific_outfit="hud_sci", --'hud_military military_outfit="hud_military", outfit_specnaz_m1="hud_military2", specops_outfit="hud_military2", militaryspec_outfit="hud_military" } local current_static local static_enabled local current_zoom=1 update_hud=false function set_hud_tex(static,enabled) local zoom=67.5/device().fov zoom=(zoom-1)*1.5+1 if zoom<1.001 then zoom=1.001 end local stretchy=0.75/(math.floor(device().aspect_ratio*1000)/1000) if stretchy<1 then stretchy=1 end local rect={x=-768*zoom+768,y=(-512*zoom+512)*stretchy-(stretchy-1)*300,w=1028*zoom,h=668*zoom*stretchy} if amk.load_variable("option_hud",2)==2 then set_blurs(enabled and curr_tex~="hud_sci" and static~=nil,rect) else set_blurs(false,rect) end if enabled==static_enabled and current_static==static and zoom==current_zoom and (not update_hud) then return end update_hud=false current_zoom=zoom local need_change=false if current_static~=static then if current_static then get_hud():RemoveCustomStatic(current_static) end if static then get_hud():AddCustomStatic(static) end need_change=true current_static=static end local wnd=get_hud():GetCustomStatic(current_static) and get_hud():GetCustomStatic(current_static):wnd() if (not enabled) and wnd then wnd:SetWidth(0) elseif wnd then wnd:SetWndRect(rect.x,rect.y,rect.w,rect.h) end static_enabled=enabled end local blurs=nil local blurval=0 -- уровень запотевания от 0 до 1 local blurlt=0 -- время последнего обновления local blurcyctime=0 -- время начала последнего цикла дыхания (выдох) local blurlastphase=0 function set_blurs(enabled,rect) if (not blurs) or get_hud():GetCustomStatic("hud_blur1")==nil then blurs={} for i=1,4 do get_hud():AddCustomStatic("hud_blur"..i) blurs[i]=get_hud():GetCustomStatic("hud_blur"..i):wnd() blurs[i]:SetWidth(0) end end if not enabled then for i=1,4 do blurs[i]:SetWidth(0) end return end -- Циклы в зависимости от силы дыхания: 0->1->0 0->1->2->4->5->0 0->1->2->3->4->5->0 5->4->3->4->5 4->3->4 local power=db.actor.power local period=1.0+power*power*1.0 -- текущая частота дыхания от 30 до 120 циклов в минуту local expirt=0.3 local breathpower=3 local delta=(time_global()-blurlt)/1000 -- дельта в секундах local phase=(time_global()-blurcyctime)/1000 -- фаза дыхательного цикла в сек. blurlt=time_global() if phase>period then phase=phase%period blurcyctime=blurlt-phase*1000 end if blurlastphase>phase then blurlastphase=0 end local blurdelta=delta*-0.7 -- работа вентилляции if blurlastphase0.999 then blurval=0.999 elseif blurval<0 then blurval=0 end local tm=math.floor(blurval*3) local tmn=(tm+1) local v=blurval*3-math.floor(blurval*3) v=1-v local v1=1-v if tm~=0 then blurs[tm]:SetColor(GetARGB(v*255,255,255,255)) end if tmn~=0 then blurs[tmn]:SetColor(GetARGB(v1*255,255,255,255)) end for i=1,4 do if i==tm or i==tmn then blurs[i]:SetWndRect(rect.x,rect.y,rect.w,rect.h) else blurs[i]:SetWndRect(rect.x,rect.y,0,0) end end end local lhup=0 function check_hud() local hudotf,actor if db and db.actor then actor=db.actor else return false end if amk.is_debug then if lhup0 and not (act_it and act_it:section()=="wpn_binoc" and device().fov<50) and device().fov>30 and amk.load_variable("option_hud",2)~=0 then set_hud_tex(tex,true) else set_hud_tex(tex,false) end end