$modelname v_models\v_huntingrifle
$include ..\Shared\definebones.qci
$include ..\Shared\bonemerge.qci
$cdmaterials models\v_models\Weapons\sniper
$cdmaterials models\w_models\tac_light
$model huntingrifle DMX/v_hunting_rifle_fixed_model.dmx
$opaque
$animblocksize 32
$origin 0 5 56.085
$ikchain lhand ValveBiped.Bip01_L_Hand knee 0 0 0
$ikchain rhand ValveBiped.Bip01_R_Hand knee 0 0 0
$attachment shell ValveBiped.weapon_bone 0 0 0 rigid
$attachment attach_shell_eject ValveBiped.attach_shell_eject 0 0 0 rigid
$attachment attach_muzzle ValveBiped.weapon_bone -0.14 3.66 27.97 rotate -90 -90 0
$attachment muzzle_flash ValveBiped.weapon_bone -0.14 3.66 27.97 rotate -90 -90 0
$attachment flashlight ValveBiped.flashlight 0 0 0 rigid
$attachment attach_camera ValveBiped.Camera -90 0 0 rigid
$attachment fowardnode ValveBiped.weapon_bone 0 0 0 rigid
$definevariable animfile "Hunting Rifle Animations"
//Lens material was only kept on the mesh because it helps highlight the lenses when viewing solid colors. Otherwise, it's pointless to have.
$renamematerial v_sniper_reference_lens v_sniper_reference
$definemacro aimAnim animfile index frame \\
$animation l_$index$ $animfile$ frames $frame$ $frame$ subtract s_idle 0 \\
$continue l_$index$
/*
$definemacro runAnim animfile index weight \\
$weightlist w_run_$index$	ValveBiped.ValveBiped 1 ValveBiped.weapon_bone $weight$ \\
$animation a_run_$index$	$animfile$ frames 216 375 subtract idle 0 weightlist w_run_$index$ \\
$continue a_run_$index$

$definemacro idleAnim animfile index weight \\
$weightlist w_idle_$index$	ValveBiped.ValveBiped 1 ValveBiped.weapon_bone $weight$ \\
$animation a_idle_$index$	$animfile$ frames 57 215 subtract idle 0 weightlist w_idle_$index$ \\
$continue a_idle_$index$
*/
$definemacro runAnim animfile index \\
$animation a_run_$index$	$animfile$ frames 216 375 ikrule rhand touch ValveBiped.weapon_bone ikrule lhand touch ValveBiped.weapon_bone \\
$continue a_run_$index$

$definemacro idleAnim animfile index \\
$animation a_idle_$index$	$animfile$ frames 57 215 ikrule rhand touch ValveBiped.weapon_bone ikrule lhand touch ValveBiped.weapon_bone \\
$continue a_idle_$index$
$weightlist nothing ValveBiped.ValveBiped 0
$weightlist soft_camera_half ValveBiped.valveBiped 1 ValveBiped.Camera 0.5
$weightlist soft_camera_quarter ValveBiped.valveBiped 1 ValveBiped.Camera 0.25
$weightlist add_power ValveBiped.ValveBiped 1 ValveBiped.weapon_bone 1.5
$cd anims
$animation s_idle $animFile$ frames 0 0
$aimAnim $animfile$ 00 620
$aimAnim $animfile$ 01 621
$aimAnim $animfile$ 02 622
$aimAnim $animfile$ 03 623
$aimAnim $animfile$ 04 624
$aimAnim $animfile$ 05 625
$aimAnim $animfile$ 06 626
$aimAnim $animfile$ 07 627
$aimAnim $animfile$ 08 628
$aimAnim $animfile$ 09 629
$aimAnim $animfile$ 10 630
$aimAnim $animfile$ 11 631
$aimAnim $animfile$ 12 632
$aimAnim $animfile$ 13 633
$aimAnim $animfile$ 14 634
$aimAnim $animfile$ 15 635
$aimAnim $animfile$ 16 636
$aimAnim $animfile$ 17 637
$aimAnim $animfile$ 18 638
$aimAnim $animfile$ 19 639
$aimAnim $animfile$ 20 640
$aimAnim $animfile$ 21 641
$aimAnim $animfile$ 22 642
$aimAnim $animfile$ 23 643
$aimAnim $animfile$ 24 644
$aimAnim $animfile$ 25 645
$aimAnim $animfile$ 26 646
$aimAnim $animfile$ 27 647
$aimAnim $animfile$ 28 648
$aimAnim $animfile$ 29 649
$aimAnim $animfile$ 30 650
$aimAnim $animfile$ 31 651
$aimAnim $animfile$ 32 652
$aimAnim $animfile$ 33 653
$aimAnim $animfile$ 34 654
$aimAnim $animfile$ 35 655
$aimAnim $animfile$ 36 656
$aimAnim $animfile$ 37 657
$aimAnim $animfile$ 38 658
$aimAnim $animfile$ 39 659
$aimAnim $animfile$ 40 660
$aimAnim $animfile$ 41 661
$aimAnim $animfile$ 42 662
$aimAnim $animfile$ 43 663
$aimAnim $animfile$ 44 664
$aimAnim $animfile$ 45 665
$aimAnim $animfile$ 46 666
$aimAnim $animfile$ 47 667
$aimAnim $animfile$ 48 668
$aimAnim $animfile$ 49 669
$aimAnim $animfile$ 50 670
$aimAnim $animfile$ 51 671
$aimAnim $animfile$ 52 672
$aimAnim $animfile$ 53 673
$aimAnim $animfile$ 54 674
$aimAnim $animfile$ 55 675
$aimAnim $animfile$ 56 676
$aimAnim $animfile$ 57 677
$aimAnim $animfile$ 58 678
$aimAnim $animfile$ 59 679
$aimAnim $animfile$ 60 680
$sequence look_poses_advanced {
	//Fun fact: You can have up to 64 unique blends per sequence.
	//Another fun fact: I initially intended to have ~120 animation blends. I could not due to the fun fact above.
	//One more fun fact: I realized the difference between 61 and 121 animation blends is too subtle to notice.
	l_00	l_01	l_02	l_03	
	l_04	l_05	l_06	l_07
	l_08	l_09	l_10	l_11
	l_12	l_13	l_14	l_15
	l_16	l_17	l_18	l_19
	l_20	l_21	l_22	l_23
	l_24	l_25	l_26	l_27
	l_28	l_29
	l_30 //Visualized and guaranteed center blend
	l_31	l_32	l_33	l_34
	l_35	l_36	l_37	l_38
	l_39	l_40	l_41	l_42
	l_43	l_44	l_45	l_46
	l_47	l_48	l_49	l_50
	l_51	l_52	l_53	l_54
	l_55	l_56	l_57	l_58
	l_59	l_60
	blendwidth 61
	blendcenter l_30 //Tells StudioMDL not to guess where the center is and forces this to be the center
	blend ver_aims 1 -1
	delta
	hidden
}
$runAnim	$animfile$	01
$idleAnim	$animfile$	01
$sequence idle {
	a_run_01	a_idle_01	a_run_01
	blend move_x -1 1
	fps 60
	loop
	//addlayer movement_layer
	addlayer look_poses_advanced
	ACT_VM_IDLE_SNIPER 1
}
$sequence pickup_length $animfile$ hidden frames 0 0 weightlist nothing
$sequence pickup $animfile$ hidden frames 0 0 weightlist nothing
$sequence pickup_partial_length $animfile$ hidden frames 0 0 weightlist nothing
$sequence pickup_partial $animfile$ hidden frames 0 0 weightlist nothing
$sequence pickup_partial2_length $animfile$ hidden frames 0 0 weightlist nothing
$sequence pickup_partial2 $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_length $animfile$ hidden frames 376 476 fps 32 weightlist nothing ACT_VM_RELOAD_SNIPER 1
$sequence reload $animfile$ {
	weightlist soft_camera_quarter
	ikrule lhand release range 0 10 175 195
	ikrule lhand touch ValveBiped.weapon_clip range 3 48 109 118
	ikrule lhand touch ValveBiped.weapon_bone range 124 138 204 214
	ikrule rhand release range 129 135 204 214
	ikrule rhand touch ValveBiped.weapon_charger_slide range 129 135 200 230
	frames 376 615
	fps 64
	delta
	subtract s_idle 0
	event 5004 35 HuntingRifle.ClipOut
	event 5004 106 HuntingRifle.ClipIn
	event 5004 109 HuntingRifle.ClipLocked
	event 5004 164 HuntingRifle.BoltBack
	event 5004 178 HuntingRifle.BoltForward
	event AE_RELOAD_CLIPOUT 27
	ACT_VM_RELOAD_SNIPER_LAYER 1
}
$sequence reload_clipout_length $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_clipout $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_empty_length $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_empty $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_empty_clipout_length $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_empty_clipout $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_empty_partial_length $animfile$ hidden frames 0 0 weightlist nothing
$sequence reload_empty_partial $animfile$ hidden frames 0 0 weightlist nothing
$sequence deploy_length $animfile$ hidden frames 3 33 snap ACT_VM_DEPLOY_SNIPER 1
$sequence deploy $animfile$ {
	frames 3 57
	fadein 0
	fps 60
	delta
	subtract s_idle 0
	ikrule lhand release range 0 0 7 20
	event 5004 1 HuntingRifle.Deploy
	ACT_VM_DEPLOY_SNIPER_LAYER 1
}
$sequence fire_length $animfile$ hidden frames 0 30 snap ACT_VM_PRIMARYATTACK_SNIPER 1
$sequence fire $animfile$ {
	weightlist add_power //Raw animation isn't powerful enough due to the blending I enabled.
	frames 751 811
	fadein .01
	fps 60
	delta
	subtract s_idle 0
	event AE_MUZZLEFLASH 0 1
	event AE_CL_CREATE_PARTICLE_BRASS 2 weapon_shell_casing_rifle
	ACT_VM_SHOOT_SNIPER_LAYER 1
}
$sequence melee_length $animfile$ hidden frames 0 35 fps 40 ACT_VM_MELEE_SNIPER 1
$sequence melee $animfile$ {
	frames 681 751
	//Consider raising this to 80... might be a little better looking when shove -> fire maneuver is used.
	fps 75
	fadein 0.1
	delta
	subtract s_idle 0
	ACT_VM_MELEE_SNIPER_LAYER 1
}
$sequence item_loop_length $animfile$ hidden frames 30 90 loop ACT_VM_ITEMPICKUP_LOOP_SNIPER 1
$sequence item_loop $animfile$ {
	frames 861 981
	loop
	fadein 0
	ACT_VM_ITEMPICKUP_LOOP_SNIPER_LAYER 1
}
$sequence item_extend_length $animfile$ hidden frames 0 30 fps 80 ACT_VM_ITEMPICKUP_EXTEND_SNIPER 1
$sequence item_extend $animfile$ {
	blendlayer look_poses_advanced 0 0 0 50 spline
	ikrule lhand release range 0 10 50 50
	frames 811 861
	fps 100
	//delta subtract s_idle 0
	fadeout 0
	event 5004 1 HuntingRifle.ItemPickupExtend
	ACT_VM_ITEMPICKUP_EXTEND_SNIPER_LAYER 1
}
$sequence item_retract_length $animfile$ hidden frames 90 120 fps 80 ACT_VM_ITEMPICKUP_RETRACT_SNIPER 1
$sequence item_retract $animfile$ {
	blendlayer look_poses_advanced 0 50 50 50 spline
	ikrule lhand release range 0 0 40 50
	frames 981 1031
	fps 60
	fadein 0 fadeout .4
	event 5004 1 HuntingRifle.ItemPickupRetract
	ACT_VM_ITEMPICKUP_RETRACT_SNIPER_LAYER 1
}
$sequence helping_hand_loop_length $animfile$ hidden frames 30 90 loop ACT_VM_HELPINGHAND_LOOP_SNIPER 1
$sequence helping_hand_loop $animfile$ {
	frames 861 981
	addlayer lazy_helpinghand_layer
	loop
	fadein 0
	ACT_VM_HELPINGHAND_LOOP_SNIPER_LAYER 1
}
$sequence helping_hand_extend_length $animfile$ hidden frames 0 30 fps 80 ACT_VM_HELPINGHAND_EXTEND_SNIPER 1
$sequence helping_hand_extend $animfile$ {
	blendlayer look_poses_advanced 0 0 0 50 spline
	ikrule lhand release range 0 10 60 60
	blendlayer lazy_helpinghand_layer 10 25 80 80 spline
	frames 811 861
	fps 100
	fadeout 0
	event 5004 1 HuntingRifle.HelpingHandExtend
	ACT_VM_HELPINGHAND_EXTEND_SNIPER_LAYER 1
}
$sequence helping_hand_retract_length $animfile$ hidden frames 90 120 fps 80 ACT_VM_HELPINGHAND_RETRACT_SNIPER 1
$sequence helping_hand_retract $animfile$ {
	blendlayer look_poses_advanced 0 50 50 50 spline
	ikrule lhand release range 0 0 40 50
	blendlayer lazy_helpinghand_layer 0 0 0 25 spline
	frames 981 1031
	fps 60
	fadein 0 fadeout .4
	event 5004 1 HuntingRifle.HelpingHandRetract
	ACT_VM_HELPINGHAND_RETRACT_SNIPER_LAYER 1
}
//Now that all of the normal sequences are over, any extras may be added here. They will never be used by the game server.
$sequence lazy_helpinghand_layer $animfile$ frames 617 617 subtract item_loop 0 delta hidden
/*
//ANIMATION TEST: EXPONENTIAL/SPLINE ANIMATION BLENDING
//Commented values probably not necessary to achieve spline effect.
$runAnim	$animfile$	10	0
$runAnim	$animfile$	09	0.1 //0.025
$runAnim	$animfile$	08	0.2 //0.15
$runAnim	$animfile$	07	0.3 //0.275
$runAnim	$animfile$	06	0.4
$runAnim	$animfile$	05	0.5
$runAnim	$animfile$	04	0.6
$runAnim	$animfile$	03	0.7 //0.725
$runAnim	$animfile$	02	0.8 //0.85
$runAnim	$animfile$	01	0.9 //0.975
$runAnim	$animfile$	00	1
//I'm honestly not entirely sure if this will work. Everything matches up for it to work, but until
//I actually get to test it, I'm not 100% certain it will.
//00 represents full weight and 10 represents no weight.
$sequence l_run_2 {
	a_run_00
	a_run_01
	a_run_02
	a_run_03
	a_run_04
	a_run_05
	a_run_06
	a_run_07
	a_run_08
	a_run_09
	a_run_10
	a_run_09
	a_run_08
	a_run_07
	a_run_06
	a_run_05
	a_run_04
	a_run_03
	a_run_02
	a_run_01
	a_run_00
	blendcenter a_run_10
	blendwidth 21
	blend move_x -1 1
	fps 60
	delta
	hidden
	realtime
}
$idleAnim	$animfile$	10	1
$idleAnim	$animfile$	09	0.9 //0.975
$idleAnim	$animfile$	08	0.8 //0.85
$idleAnim	$animfile$	07	0.7 //0.725
$idleAnim	$animfile$	06	0.6
$idleAnim	$animfile$	05	0.5
$idleAnim	$animfile$	04	0.4
$idleAnim	$animfile$	03	0.3 //0.275
$idleAnim	$animfile$	02	0.2 //0.15
$idleAnim	$animfile$	01	0.1 //0.025
$idleAnim	$animfile$	00	0
$sequence l_idle {
	a_idle_00
	a_idle_01
	a_idle_02
	a_idle_03
	a_idle_04
	a_idle_05
	a_idle_06
	a_idle_07
	a_idle_08
	a_idle_09
	a_idle_10
	a_idle_09
	a_idle_08
	a_idle_07
	a_idle_06
	a_idle_05
	a_idle_04
	a_idle_03
	a_idle_02
	a_idle_01
	a_idle_00
	blendcenter a_idle_10
	blendwidth 21
	blend move_x -1 1
	fps 60
	delta
	hidden
	realtime
}
$sequence movement_layer {
	a_run_00	a_idle_10	a_run_00
	blend move_x -1 1
	delta
	hidden
}
*/
