]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
trueaim: add a cvar g_trueaim_minrange to customize it
authorRudolf Polzer <divVerent@xonotic.org>
Tue, 11 Jan 2011 11:01:51 +0000 (12:01 +0100)
committerRudolf Polzer <divVerent@xonotic.org>
Tue, 11 Jan 2011 11:01:51 +0000 (12:01 +0100)
defaultXonotic.cfg
qcsrc/client/Main.qc
qcsrc/client/View.qc
qcsrc/client/main.qh
qcsrc/server/autocvars.qh
qcsrc/server/cl_client.qc
qcsrc/server/cl_weaponsystem.qc

index 72f43f6fd453e639938bd07b5420eb782d39725e..cac55e4725cc502ac34bfd28c2f4c7555b8e514d 100644 (file)
@@ -461,6 +461,7 @@ locs_enable 0
 pausable 0
 seta g_spawnshieldtime 1.000000 "number of seconds you are invincible after you spawned, this shield is lost after you fire"
 seta g_antilag 2       "AntiLag (0 = no AntiLag, 1 = verified client side hit scan, 2 = server side hit scan in the past, 3 = unverified client side hit scan)"
+set g_trueaim_minrange 128 "TrueAim minimum range (TrueAim adjusts shots so they hit the crosshair point even though the gun is not at the screen center)"
 set g_antilag_nudge 0 "don't touch"
 set g_antilag_bullets 1 "Bullets AntiLag (0 = no AntiLag, 1 = server side hit scan in the past) - DO NOT TOUCH (severely changes weapon balance)"
 set g_shootfromclient 1 "let client decide if it has the gun left or right; if set to 2, center handedness is allowed, and defaulted to, too; see also cl_gunalign"
index 048773a01f49bddfcf08a3901780ca3158ce046c..044569fb5c373b49011389d5daf6adf141791f40 100644 (file)
@@ -1099,6 +1099,8 @@ void Ent_Init()
 
        cr_maxbullets = ReadByte();
 
+       g_trueaim_minrange = ReadCoord();
+
        if(!postinit)
                PostInit();
 }
index 704e58107f597a67ec33e3b201a816da196b09fc..1cb624de6b9b94c3e0ce39772adbdddf4d9aeb89 100644 (file)
@@ -306,6 +306,9 @@ float TrueAimCheck()
        traceline(view_origin, view_origin + view_forward * MAX_SHOT_DISTANCE, mv, ta);
        trueaimpoint = trace_endpos;
 
+       if(vlen(trueaimpoint - view_origin) < g_trueaim_minrange)
+               trueaimpoint = view_origin + view_forward * g_trueaim_minrange;
+
        if(vecs_x > 0)
                vecs_y = -vecs_y;
        else
index 3219d338f9035f560daa1555d84ff2b946284f8f..364e5a999fb5768bc4043c4d9671d470b3c1b002 100644 (file)
@@ -162,3 +162,4 @@ float g_balance_grenadelauncher_bouncefactor;
 float g_balance_grenadelauncher_bouncestop;
 float g_balance_electro_secondary_bouncefactor;
 float g_balance_electro_secondary_bouncestop;
+float g_trueaim_minrange;
index b00c1acc4c58c2e6fe53244048cc5d1468c27988..427a60c5ec1366929d56d72f158b646aa3254730 100644 (file)
@@ -1184,3 +1184,4 @@ float autocvar_timelimit_suddendeath;
 float autocvar_waypoint_benchmark;
 float autocvar_welcome_message_time;
 float autocvar_sv_gameplayfix_gravityunaffectedbyticrate;
+float autocvar_g_trueaim_minrange;
index cb2d2ed3dea2cecefbf54d40905f90ad30954dca..2e5c60118cc2154d30a21db59c509430690e688b 100644 (file)
@@ -1108,6 +1108,7 @@ float ClientInit_SendEntity(entity to, float sf)
        WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_secondary); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, serverflags); // client has to know if it should zoom or not
        WriteByte(MSG_ENTITY, autocvar_g_balance_sniperrifle_magazinecapacity); // rifle max bullets
+       WriteCoord(MSG_ENTITY, autocvar_g_trueaim_minrange);
        return TRUE;
 }
 
index a1d6fed14c1ec80ace60b9b167f6921031f5ef0d..057c5cb1dc767fde25d85b66a61ca8ee519cbf32 100644 (file)
@@ -158,6 +158,10 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, vector s_forward, vector m
        v_right = vr;
        v_up = vu;
 
+       // un-adjust trueaim if shotend is too close
+       if(vlen(w_shotend - (ent.origin + ent.view_ofs)) < autocvar_g_trueaim_minrange)
+               w_shotend = ent.origin + ent.view_ofs + s_forward * autocvar_g_trueaim_minrange;
+
        // track max damage
        if(accuracy_canbegooddamage(ent))
                accuracy_add(ent, ent.weapon, maxdamage, 0);