]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
move up/down aiming clientside
authorRudolf Polzer <divverent@xonotic.org>
Tue, 12 Feb 2013 09:33:57 +0000 (10:33 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 12 Feb 2013 09:33:57 +0000 (10:33 +0100)
defaultXonotic.cfg
qcsrc/client/player_skeleton.qc
qcsrc/client/player_skeleton.qh
qcsrc/common/csqcmodel_settings.qh
qcsrc/common/util.qc
qcsrc/common/util.qh
qcsrc/server/autocvars.qh
qcsrc/server/cl_weaponsystem.qc
qcsrc/server/miscfunctions.qc

index bf7d85eb7aae233e48a936267d4b2d46a34586a0..4c5339bb8132e92ddd4f08202148ee9e0b24ed65 100644 (file)
@@ -1237,7 +1237,6 @@ set g_jetpack 0 "Jetpack mutator (uses the hook's button, can't coexist with the
 
 set g_running_guns 0 "... or wonder, till it drives you mad, what would have followed if you had."
 set g_bastet 0 "don't try"
-set g_loituma 0 "no, really"
 
 set _urllib_nextslot 0 "temp variable"
 set cl_warpzone_usetrace 1 "do not touch"
@@ -1298,10 +1297,6 @@ set sv_weaponstats_file "" "when set to a file name, per-weapon stats get writte
 
 seta cl_noantilag 0 "turn this on if you believe antilag is bad"
 
-set sv_pitch_min -35 "minimum aiming angle for shooting direction display of the gun"
-set sv_pitch_max  35 "maximum aiming angle for shooting direction display of the gun"
-set sv_pitch_fixyaw 0 "workaround to fix the aiming direction on stupidly made player models, FIXME fix the models and set this to 0"
-
 set rescan_pending 0 "set to 1 to schedule a fs_rescan at the end of this match"
 
 set g_mapinfo_allow_unsupported_modes_and_let_stuff_break "0" "set to 1 to be able to force game types using g_ cvars even if the map does not support them"
index ca6190f45257ef64ca17324fbdde809d6e7c91aa..a731d3a1a3ffeda1f5ded7956c5eb9bc065539c8 100644 (file)
@@ -16,6 +16,7 @@ void skeleton_loadinfo(entity e)
                e.bone_weapon = gettagindex(e, "tag_weapon");
        if(!e.bone_weapon)
                e.bone_weapon = gettagindex(e, "bip01 r hand");
+       e.bone_aim = 0;
        e.fixbone = 0;
        if(get_model_parameters(e.model, e.skin))
        {
@@ -23,7 +24,10 @@ void skeleton_loadinfo(entity e)
                        e.bone_upperbody = gettagindex(e, get_model_parameters_bone_upperbody);
                if(get_model_parameters_bone_weapon)
                        e.bone_weapon = gettagindex(e, get_model_parameters_bone_weapon);
-               e.fixbone = get_model_parameters_fixbone;
+               if(get_model_parameters_bone_aim)
+                       e.bone_aim = gettagindex(e, get_model_parameters_bone_aim);
+               if(e.bone_upperbody)
+                       e.fixbone = get_model_parameters_fixbone;
        }
        else
                dprint("No model parameters for ", e.model, "\n");
@@ -141,4 +145,17 @@ void skeleton_from_frames(entity e)
                // FIX IT
                skeleton_fixbone(e, fixbone_oldangles);
        }
+
+       if(e.bone_aim)
+       {
+               vector aim = '-1 0 0' * self.v_angle_x;
+
+               skel_get_boneabs(s, e.bone_aim);
+               vector ang_cur = fixedvectoangles2(v_forward, v_up);
+               vector ang = AnglesTransform_Multiply(aim, ang_cur);
+               vector fix = AnglesTransform_LeftDivide(ang_cur, ang);
+               fixedmakevectors(fix);
+               skel_mul_bone(s, e.bone_aim, '0 0 0');
+
+       }
 }
index 2cbb6187cbc96c3bbe89bcc6d564ebe362f83a71..ad63a7332241b055be120fc9ec2d5cecf2201907 100644 (file)
@@ -4,4 +4,5 @@ void skeleton_loadinfo(entity e);
 
 .float bone_upperbody;
 .float bone_weapon;
+.float bone_aim;
 .float fixbone;
index a0076825be402ec5e837a564686def6fe3deef0d..3ade241aee26573fb11f19b203b20693cf24a894 100644 (file)
@@ -41,6 +41,7 @@
                CSQCMODEL_ENDIF \
                CSQCMODEL_PROPERTY(512, float, ReadChar, WriteChar, anim_upper_action) \
                CSQCMODEL_PROPERTY(512, float, ReadApproxPastTime, WriteApproxPastTime, anim_upper_time) \
+               CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
        CSQCMODEL_ENDIF
 // TODO get rid of colormod/glowmod here, find good solution for nex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
 
index bb2fcba0abacc5ecef45730709add23a735e5468..ffcc2e1c3d7581a62630958e1b058988a7786760 100644 (file)
@@ -2013,6 +2013,7 @@ float get_model_parameters(string m, float sk)
        get_model_parameters_desc = string_null;
        get_model_parameters_bone_upperbody = string_null;
        get_model_parameters_bone_weapon = string_null;
+       get_model_parameters_bone_aim = string_null;
        get_model_parameters_fixbone = 0;
 
        if not(m)
@@ -2073,6 +2074,8 @@ float get_model_parameters(string m, float sk)
                        get_model_parameters_bone_upperbody = s;
                if(c == "bone_weapon")
                        get_model_parameters_bone_weapon = s;
+               if(c == "bone_aim")
+                       get_model_parameters_bone_aim = s;
                if(c == "fixbone")
                        get_model_parameters_fixbone = stof(s);
        }
index 8b1170b4e22968e37491460ca12b973c1318dbdd..187622be0e211d830d6170cf204b50ff64eea5cb 100644 (file)
@@ -252,6 +252,7 @@ float get_model_parameters_weight;
 float get_model_parameters_age;
 string get_model_parameters_bone_upperbody;
 string get_model_parameters_bone_weapon;
+string get_model_parameters_bone_aim;
 float get_model_parameters_fixbone;
 string get_model_parameters_desc;
 float get_model_parameters(string mod, float skn); // call with string_null to clear; skin -1 means mod is the filename of the txt file and is to be split
index efd5303dd10c8730c6186b15d5a4e67f9772d233..7747e0dffe5431a3c53e96c25e329805e02d0681 100644 (file)
@@ -1256,7 +1256,6 @@ float autocvar_welcome_message_time;
 float autocvar_sv_gameplayfix_gravityunaffectedbyticrate;
 float autocvar_g_trueaim_minrange;
 float autocvar_g_debug_defaultsounds;
-float autocvar_g_loituma;
 float autocvar_g_grab_range;
 float autocvar_g_sandbox_info;
 float autocvar_g_sandbox_readonly;
index a75e2be5af16fee8e3758a60e0590a28f020ad0f..f697d3689c6247ab40a060198244fb147ade1673 100644 (file)
@@ -578,7 +578,6 @@ void CL_Weaponentity_Think()
 void CL_ExteriorWeaponentity_Think()
 {
        float tag_found;
-       vector ang;
        self.nextthink = time;
        if (self.owner.exteriorweaponentity != self)
        {
@@ -609,10 +608,7 @@ void CL_ExteriorWeaponentity_Think()
                        setattachment(self, self.owner, "bip01 r hand");
        }
        self.effects = self.owner.effects;
-       if(sv_pitch_min == sv_pitch_max)
-               self.effects |= EF_LOWPRECISION;
-       else
-               self.effects &~= EF_LOWPRECISION;
+       self.effects |= EF_LOWPRECISION;
        self.effects = self.effects & EFMASK_CHEAP; // eat performance
        if(self.owner.alpha == default_player_alpha)
                self.alpha = default_weapon_alpha;
@@ -621,58 +617,6 @@ void CL_ExteriorWeaponentity_Think()
        else
                self.alpha = 1;
 
-       if (!intermission_running)
-       {
-               ang_x = bound(sv_pitch_min, self.owner.v_angle_x, sv_pitch_max);
-               ang_y = 0;
-               ang_z = 0;
-
-               if(sv_pitch_fixyaw) // workaround for stupid player models that don't aim forward
-               {
-                       ang_y = self.owner.v_angle_y;
-                       makevectors(ang);
-                       var vector v = v_forward;
-                       var float t = self.tag_entity.frame1time;
-                       var float f = self.tag_entity.frame;
-                       self.tag_entity.frame1time = time;
-                       self.tag_entity.frame = self.tag_entity.anim_idle_x;
-                       gettaginfo(self.tag_entity, self.tag_index);
-                       self.tag_entity.frame1time = t;
-                       self.tag_entity.frame = f;
-                       // untransform v according to this coordinate space
-                       vector w;
-                       w_x = v_forward * v;
-                       w_y = -v_right * v;
-                       w_z = v_up * v;
-                       self.angles = vectoangles(w);
-               }
-               else
-               {
-                       ang_x = -/* don't ask */ang_x;
-                       self.angles = ang;
-               }
-
-               if(autocvar_g_loituma)
-               {
-                       vector modangles;
-                       float t;
-
-                       t = time * autocvar_g_loituma;
-
-                       modangles_x = t * 360;
-                       modangles_y = 90;
-                       modangles_z = 0;
-
-                       self.angles =
-                               AnglesTransform_ToAngles(
-                                       AnglesTransform_Multiply(
-                                               AnglesTransform_FromAngles(self.angles),
-                                               AnglesTransform_FromAngles(modangles)
-                                       )
-                               );
-               }
-       }
-
        self.glowmod = self.owner.weaponentity_glowmod;
        self.colormap = self.owner.colormap;
 
index 7f8931bffe648c90d3bd4a7b3eada671725f66e6..e8972ca8e4c75c317bbfceea7495d2e80451abaa 100644 (file)
@@ -1107,10 +1107,6 @@ float g_touchexplode_force;
 float sv_autotaunt;
 float sv_taunt;
 
-float sv_pitch_min;
-float sv_pitch_max;
-float sv_pitch_fixyaw;
-
 string GetGametype(); // g_world.qc
 void readlevelcvars(void)
 {
@@ -1267,10 +1263,6 @@ void readlevelcvars(void)
        if not(inWarmupStage && !g_ca)
                game_starttime = cvar("g_start_delay");
 
-       sv_pitch_min = cvar("sv_pitch_min");
-       sv_pitch_max = cvar("sv_pitch_max");
-       sv_pitch_fixyaw = cvar("sv_pitch_fixyaw");
-
        readplayerstartcvars();
 }