From 5aae6b8749c856840ab38d7fa33d1f2a0844286e Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 12 Feb 2013 10:33:57 +0100 Subject: [PATCH] move up/down aiming clientside --- defaultXonotic.cfg | 5 --- qcsrc/client/player_skeleton.qc | 19 +++++++++- qcsrc/client/player_skeleton.qh | 1 + qcsrc/common/csqcmodel_settings.qh | 1 + qcsrc/common/util.qc | 3 ++ qcsrc/common/util.qh | 1 + qcsrc/server/autocvars.qh | 1 - qcsrc/server/cl_weaponsystem.qc | 58 +----------------------------- qcsrc/server/miscfunctions.qc | 8 ----- 9 files changed, 25 insertions(+), 72 deletions(-) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index bf7d85eb7..4c5339bb8 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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" diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index ca6190f45..a731d3a1a 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -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'); + + } } diff --git a/qcsrc/client/player_skeleton.qh b/qcsrc/client/player_skeleton.qh index 2cbb6187c..ad63a7332 100644 --- a/qcsrc/client/player_skeleton.qh +++ b/qcsrc/client/player_skeleton.qh @@ -4,4 +4,5 @@ void skeleton_loadinfo(entity e); .float bone_upperbody; .float bone_weapon; +.float bone_aim; .float fixbone; diff --git a/qcsrc/common/csqcmodel_settings.qh b/qcsrc/common/csqcmodel_settings.qh index a0076825b..3ade241ae 100644 --- a/qcsrc/common/csqcmodel_settings.qh +++ b/qcsrc/common/csqcmodel_settings.qh @@ -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 diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index bb2fcba0a..ffcc2e1c3 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -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); } diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 8b1170b4e..187622be0 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -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 diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index efd5303dd..7747e0dff 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -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; diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index a75e2be5a..f697d3689 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -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; diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 7f8931bff..e8972ca8e 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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(); } -- 2.39.2