From: Rudolf Polzer Date: Tue, 12 Feb 2013 10:36:05 +0000 (+0100) Subject: support up to 2 aim bones X-Git-Tag: xonotic-v0.7.0~92 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4cbf5b8e933fefa0fb1a699aa9853649915683b3;p=xonotic%2Fxonotic-data.pk3dir.git support up to 2 aim bones --- diff --git a/models/player/erebus.iqm_0.txt b/models/player/erebus.iqm_0.txt index 79fb0bc65..359949d2e 100644 --- a/models/player/erebus.iqm_0.txt +++ b/models/player/erebus.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 105 age 26 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/gak.iqm_0.txt b/models/player/gak.iqm_0.txt index 9a6f52401..160f2ec4e 100644 --- a/models/player/gak.iqm_0.txt +++ b/models/player/gak.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 85 age 16 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/gakarmored.iqm_0.txt b/models/player/gakarmored.iqm_0.txt index 3a7b199ac..3378343fc 100644 --- a/models/player/gakarmored.iqm_0.txt +++ b/models/player/gakarmored.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 90 age 20 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/gakmasked.iqm_0.txt b/models/player/gakmasked.iqm_0.txt index 72e694771..84b27c74e 100644 --- a/models/player/gakmasked.iqm_0.txt +++ b/models/player/gakmasked.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 87 age 18 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/ignis.iqm_0.txt b/models/player/ignis.iqm_0.txt index ea1cb7a30..f2b4e3ff3 100644 --- a/models/player/ignis.iqm_0.txt +++ b/models/player/ignis.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 88 age 31 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/ignishalfmasked.iqm_0.txt b/models/player/ignishalfmasked.iqm_0.txt index 8c3be3371..7cd377b31 100644 --- a/models/player/ignishalfmasked.iqm_0.txt +++ b/models/player/ignishalfmasked.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 90 age 31 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/ignismasked.iqm_0.txt b/models/player/ignismasked.iqm_0.txt index c5944ca4c..a4b082c70 100644 --- a/models/player/ignismasked.iqm_0.txt +++ b/models/player/ignismasked.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 92 age 31 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/megaerebus.iqm_0.txt b/models/player/megaerebus.iqm_0.txt index 2e7cfba0b..e8bbbf10c 100644 --- a/models/player/megaerebus.iqm_0.txt +++ b/models/player/megaerebus.iqm_0.txt @@ -4,7 +4,7 @@ sex Male weight 210 age 26 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/nyx.iqm_0.txt b/models/player/nyx.iqm_0.txt index 714f8212b..6184efddb 100644 --- a/models/player/nyx.iqm_0.txt +++ b/models/player/nyx.iqm_0.txt @@ -4,7 +4,7 @@ sex Female weight 100 age 24 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/pyria.iqm_0.txt b/models/player/pyria.iqm_0.txt index 47c8ef1ae..d18f4b56f 100644 --- a/models/player/pyria.iqm_0.txt +++ b/models/player/pyria.iqm_0.txt @@ -4,7 +4,7 @@ sex Female weight 57 age 53 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/seraphina.iqm_0.txt b/models/player/seraphina.iqm_0.txt index a64d0c221..186c4a421 100644 --- a/models/player/seraphina.iqm_0.txt +++ b/models/player/seraphina.iqm_0.txt @@ -4,7 +4,7 @@ sex Female weight 89 age 31 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/seraphinamasked.iqm_0.txt b/models/player/seraphinamasked.iqm_0.txt index d3e9cf1f2..b20ef794a 100644 --- a/models/player/seraphinamasked.iqm_0.txt +++ b/models/player/seraphinamasked.iqm_0.txt @@ -4,7 +4,7 @@ sex Female weight 90 age 31 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/models/player/umbra.iqm_0.txt b/models/player/umbra.iqm_0.txt index a8fa91814..0572cb2b3 100644 --- a/models/player/umbra.iqm_0.txt +++ b/models/player/umbra.iqm_0.txt @@ -4,7 +4,7 @@ sex Female weight 61 age 25 bone_upperbody spine2 -bone_aim spine2 +bone_aim1 1 spine2 bone_weapon bip01 r hand fixbone 1 diff --git a/qcsrc/client/player_skeleton.qc b/qcsrc/client/player_skeleton.qc index d51ac0d9f..96879c561 100644 --- a/qcsrc/client/player_skeleton.qc +++ b/qcsrc/client/player_skeleton.qc @@ -16,18 +16,27 @@ 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.bone_aim1 = 0; + e.bone_aim2 = 0; + e.bone_aim1weight = 0; + e.bone_aim2weight = 0; e.fixbone = 0; if(get_model_parameters(e.model, e.skin)) { if(get_model_parameters_bone_upperbody) 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); - 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; + if(get_model_parameters_bone_weapon) + e.bone_weapon = gettagindex(e, get_model_parameters_bone_weapon); + if(get_model_parameters_bone_aim1) + e.bone_aim1 = gettagindex(e, get_model_parameters_bone_aim1); + if(e.bone_aim1) + e.bone_aim1weight = get_model_parameters_bone_aim1weight; + if(get_model_parameters_bone_aim2) + e.bone_aim2 = gettagindex(e, get_model_parameters_bone_aim2); + if(e.bone_aim2) + e.bone_aim2weight = get_model_parameters_bone_aim2weight; } else dprint("No model parameters for ", e.model, "\n"); @@ -155,13 +164,23 @@ void skeleton_from_frames(entity e) skel_set_boneabs(s, e.bone_upperbody, org); } - if(e.bone_aim) + if(e.bone_aim1) + { + vector aim = '1 0 0' * bound(-90, self.v_angle_x, 90) * e.bone_aim1weight; + vector org = skel_get_boneabs(s, e.bone_aim1); + vector ang_cur = fixedvectoangles2(v_forward, v_up); + vector ang = AnglesTransform_Multiply(aim, ang_cur); + fixedmakevectors(ang); + skel_set_boneabs(s, e.bone_aim1, org); + } + + if(e.bone_aim2) { - vector aim = '1 0 0' * bound(-90, self.v_angle_x, 90); - vector org = skel_get_boneabs(s, e.bone_aim); + vector aim = '1 0 0' * bound(-90, self.v_angle_x, 90) * e.bone_aim2weight; + vector org = skel_get_boneabs(s, e.bone_aim2); vector ang_cur = fixedvectoangles2(v_forward, v_up); vector ang = AnglesTransform_Multiply(aim, ang_cur); fixedmakevectors(ang); - skel_set_boneabs(s, e.bone_aim, org); + skel_set_boneabs(s, e.bone_aim2, org); } } diff --git a/qcsrc/client/player_skeleton.qh b/qcsrc/client/player_skeleton.qh index ad63a7332..45023a7b1 100644 --- a/qcsrc/client/player_skeleton.qh +++ b/qcsrc/client/player_skeleton.qh @@ -4,5 +4,8 @@ void skeleton_loadinfo(entity e); .float bone_upperbody; .float bone_weapon; -.float bone_aim; +.float bone_aim1; +.float bone_aim1weight; +.float bone_aim2; +.float bone_aim2weight; .float fixbone; diff --git a/qcsrc/common/util.qc b/qcsrc/common/util.qc index ffcc2e1c3..f6f318c48 100644 --- a/qcsrc/common/util.qc +++ b/qcsrc/common/util.qc @@ -2013,7 +2013,10 @@ 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_bone_aim1 = string_null; + get_model_parameters_bone_aim2 = string_null; + get_model_parameters_bone_aim1weight = 0; + get_model_parameters_bone_aim2weight = 0; get_model_parameters_fixbone = 0; if not(m) @@ -2074,8 +2077,16 @@ 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 == "bone_aim1") + { + get_model_parameters_bone_aim1weight = stof(car(s)); + get_model_parameters_bone_aim1 = cdr(s); + } + if(c == "bone_aim2") + { + get_model_parameters_bone_aim2weight = stof(car(s)); + get_model_parameters_bone_aim2 = cdr(s); + } if(c == "fixbone") get_model_parameters_fixbone = stof(s); } diff --git a/qcsrc/common/util.qh b/qcsrc/common/util.qh index 187622be0..a406e1242 100644 --- a/qcsrc/common/util.qh +++ b/qcsrc/common/util.qh @@ -252,7 +252,10 @@ 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; +string get_model_parameters_bone_aim1; +float get_model_parameters_bone_aim1weight; +string get_model_parameters_bone_aim2; +float get_model_parameters_bone_aim2weight; 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