X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fview.qc;h=99549a575566077d8d95dc2fccba972ffee49ca3;hb=8b811952d57d19b567d5dca92e2c5ec7c3466c3b;hp=57cd15a78bd7fd68cac6454b13232d56a4b1d1c4;hpb=b2108fdf144cd75a50be6fba1d68a642f41a1531;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 57cd15a78..99549a575 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -486,7 +486,7 @@ vector GetCurrentFov(float fov) else setsensitivityscale(1); - if(autocvar_cl_velocityzoom_enabled && autocvar_cl_velocityzoom_type) // _type = 0 disables velocity zoom too + if(autocvar_cl_velocityzoom_enabled && autocvar_cl_velocityzoom_type && !autocvar_cl_lockview) // _type = 0 disables velocity zoom too { if (intermission || (spectatee_status > 0 && STAT(CAMERA_SPECTATOR) == 2)) curspeed = 0; @@ -787,7 +787,7 @@ void View_EventChase(entity this) { if(hud != HUD_BUMBLEBEE_GUN) { - Vehicle info = Vehicles_from(hud); + Vehicle info = REGISTRY_GET(Vehicles, hud); vehicle_viewdist = info.height; vehicle_viewofs = info.view_ofs; if(vehicle_viewdist < 0) // when set below 0, this vehicle doesn't use third person view (gunner slots) @@ -898,7 +898,7 @@ void HUD_Crosshair_Vehicle(entity this) { if(hud != HUD_BUMBLEBEE_GUN) { - Vehicle info = Vehicles_from(hud); + Vehicle info = REGISTRY_GET(Vehicles, hud); info.vr_crosshair(info, this); } } @@ -1079,11 +1079,15 @@ LABEL(normalcolor) void HUD_Crosshair(entity this) { + // reset player's alpha here upon death since forced scoreboard prevents running the crosshair_chase code + if(autocvar_chase_active > 0 && autocvar_crosshair_chase && STAT(HEALTH) <= 0 && csqcplayer) + csqcplayer.alpha = csqcplayer.m_alpha; + float f, i, j; vector v; - if(!scoreboard_active && !camera_active && intermission != 2 && !STAT(GAME_STOPPED) && - spectatee_status != -1 && (!csqcplayer.viewloc || (!spectatee_status && (csqcplayer.viewloc.spawnflags & VIEWLOC_FREEAIM))) && !MUTATOR_CALLHOOK(DrawCrosshair) && - !HUD_MinigameMenu_IsOpened() ) + if(!scoreboard_active && !camera_active && intermission != 2 && !STAT(GAME_STOPPED) && !autocvar_cl_lockview + && spectatee_status != -1 && (!csqcplayer.viewloc || (!spectatee_status && (csqcplayer.viewloc.spawnflags & VIEWLOC_FREEAIM))) && !MUTATOR_CALLHOOK(DrawCrosshair) + && !HUD_MinigameMenu_IsOpened()) { if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering return; @@ -1124,7 +1128,7 @@ void HUD_Crosshair(entity this) { traceline(view_origin, view_origin + max_shot_distance * view_forward, MOVE_NORMAL, NULL); float myalpha = (!csqcplayer.m_alpha) ? 1 : csqcplayer.m_alpha; - if(trace_ent == csqcplayer && STAT(HEALTH) > 0) + if(trace_ent == csqcplayer) csqcplayer.alpha = min(autocvar_crosshair_chase_playeralpha, myalpha); else csqcplayer.alpha = csqcplayer.m_alpha; @@ -1159,7 +1163,7 @@ void HUD_Crosshair(entity this) string wcross_name = ""; float wcross_scale, wcross_blur; - entity e = WEP_Null; + entity e = WEP_Null; if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1)) { entity wepent = viewmodels[0]; // TODO: unhardcode @@ -1538,7 +1542,7 @@ void SpecialCommand() { slot.x = bound(0, (random() * vid_conwidth + 1), vid_conwidth); slot.y = 1; // start it off 0 so we can use it - slot.z = floor(random() * Weapons_MAX); + slot.z = floor(random() * REGISTRY_MAX(Weapons)); sc_spawntime = time + bound(0.4, random(), 0.75); // prevent spawning another one for this amount of time! vector newcolor = randomvec() * 2; newcolor.x = bound(0.4, newcolor.x, 1); @@ -1552,7 +1556,7 @@ void SpecialCommand() vector splash_size = '0 0 0'; splash_size.x = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE; splash_size.y = max(vid_conwidth, vid_conheight) * SPECIALCOMMAND_SIZE; - entity wep = Weapons_from(slot.z); + entity wep = REGISTRY_GET(Weapons, slot.z); if(wep == WEP_Null) drawpic(vec2(slot), "gfx/smile", vec2(splash_size), specialcommand_colors[j], 0.95, DRAWFLAG_NORMAL); else @@ -1635,6 +1639,7 @@ void ViewLocation_Mouse() viewloc_mousepos.y = bound(0, viewloc_mousepos.y, vid_conheight); //float cursor_alpha = 1 - autocvar__menu_alpha; + //cursor_type = CURSOR_NORMAL; //draw_cursor(viewloc_mousepos, '0.5 0.5 0', "/cursor_move", '1 1 1', cursor_alpha); } @@ -1675,6 +1680,7 @@ void HUD_Mouse(entity player) if(!autocvar_hud_cursormode) update_mousepos(); + cursor_type = CURSOR_NORMAL; if(autocvar__hud_configure) HUD_Panel_Mouse(); else @@ -2038,16 +2044,20 @@ void View_PostProcessing() void View_Lock() { - if(autocvar_cl_lockview || (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1 || QuickMenu_IsOpened()))) - { + int lock_type = (!autocvar_hud_cursormode && (autocvar__hud_configure && spectatee_status <= 0 || intermission > 1 || QuickMenu_IsOpened())); + if (lock_type == 0) + lock_type = autocvar_cl_lockview; + + // lock_type 1: lock origin and angles + // lock_type 2: lock only origin + if(lock_type >= 1) setproperty(VF_ORIGIN, freeze_org); - setproperty(VF_ANGLES, freeze_ang); - } else - { freeze_org = getpropertyvec(VF_ORIGIN); + if(lock_type == 1) + setproperty(VF_ANGLES, freeze_ang); + else freeze_ang = getpropertyvec(VF_ANGLES); - } } void View_DemoCamera()