From: Jakob MG Date: Sun, 19 Jun 2011 19:53:20 +0000 (+0200) Subject: More correct aim for spiderbot. make raptor's gun aim right X-Git-Tag: xonotic-v0.5.0~199^2~11^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=99cd499d6af33a3c65d087313cf935174fa1d508;p=xonotic%2Fxonotic-data.pk3dir.git More correct aim for spiderbot. make raptor's gun aim right --- diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index b9ef20495..d80bd7b43 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -315,7 +315,7 @@ float raptor_frame() { entity player, raptor; float ftmp, ftmp2; - vector df, ra; + vector df; if(intermission_running) return 1; @@ -466,8 +466,6 @@ float raptor_frame() } } - ra = raptor.angles; - ra_z = 0; // Aim the gunz ftmp2 = autocvar_g_vehicle_raptor_cannon_turnspeed * frametime; ftmp = -ftmp2; @@ -476,13 +474,9 @@ float raptor_frame() df = gettaginfo(raptor.gun1, gettagindex(raptor.gun1, "fire1")); ad = df; vf = v_forward; - //if(self.lock_strength == 1) - //{ - df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle - df = shortangle_vxy(df - (ra + raptor.gun1.angles), ra + raptor.gun1.angles); // Find aim offset - //} - //else - // df = '0 0 0'; + df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle + df = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(raptor.angles), AnglesTransform_FromAngles(df))) - raptor.gun1.angles; + df = shortangle_vxy(df, raptor.gun1.angles); // Bind to aimspeed df_x = bound(ftmp, df_x, ftmp2); @@ -495,14 +489,10 @@ float raptor_frame() df = gettaginfo(raptor.gun2, gettagindex(raptor.gun2, "fire1")); ad += df; vf += v_forward; - //if(self.lock_strength == 1) - //{ - df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle - df = shortangle_vxy(df - (ra + raptor.gun2.angles), ra + raptor.gun2.angles); // Find aim offset - //} - //else - // df = '0 0 0'; - + df = vectoangles(normalize(trace_endpos - df)); // Find the direction & angle + df = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(raptor.angles), AnglesTransform_FromAngles(df))) - raptor.gun2.angles; + df = shortangle_vxy(df, raptor.gun2.angles); + // Bind to aimspeed df_x = bound(ftmp, df_x, ftmp2); df_y = bound(ftmp, df_y, ftmp2); diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index 36863d8e2..dbaac0cce 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -191,11 +191,13 @@ float spiderbot_frame() crosshair_trace(player); //UpdateAuxiliaryXhair(player, trace_endpos, ('1 0 0' * player.vehicle_reload2) + ('0 1 0' * (1 - player.vehicle_reload2)), 2); - player.v_angle_x *= -1; - gettaginfo(spider.tur_head, 0); - ad = player.v_angle - vectoangles2(v_forward, v_up); + //player.v_angle_x *= -1; + //gettaginfo(spider.tur_head, 0); + //ad = player.v_angle - vectoangles2(v_forward, v_up); //ad = player.v_angle - (spider.tur_head.angles + spider.angles); - player.v_angle_x *= -1; + //player.v_angle_x *= -1; + ad = AnglesTransform_ToAngles(AnglesTransform_LeftDivide(AnglesTransform_FromAngles(spider.angles), AnglesTransform_FromVAngles(player.v_angle))) - spider.tur_head.angles; + if(ad_x > 180) ad_x -= 360; if(ad_x < -180) ad_x += 360; if(ad_y > 180) ad_y -= 360;