// ================================================================
// 
// New Pistol Animations for Combine Soldiers
// 
// Author: Blixibon
// 
// (Metrocop animations were decompiled by Crowbar 0.71)
// 
// ================================================================
// 
// This QCI file implements full pistol idle, walk, run, aim, and crouch animations based on decompiled metrocop animations
// and soldier animations modified in Blender.
// 
// The adapated metrocop animations are combined with soldier animations using various QC commands to help make them fit in
// with the soldier's existing posture/animation set and differentiate them from metrocops. They also use soldier walk/run blends
// and "NPC_CombineS" footstep animation events.
// 
// ================================================================



// ================================================================
// Metrocop Base Animations
// ================================================================
$include "NewPistolAnimations_MetrocopBase.qci"

// ================================================================
// New Weightlists
// ================================================================
$weightlist "weights_pistol_new_arms" {
	 "ValveBiped.Bip01_Pelvis" 0
	 "ValveBiped.Bip01_Spine4" 1
	 "ValveBiped.Bip01_L_Clavicle" 1
	 "ValveBiped.Bip01_L_UpperArm" 1
	 "ValveBiped.Bip01_L_Forearm" 1
	 "ValveBiped.Bip01_L_Hand" 1
	 "ValveBiped.Bip01_R_Clavicle" 1
	 "ValveBiped.Bip01_R_UpperArm" 1
	 "ValveBiped.Bip01_R_Forearm" 1
	 "ValveBiped.Bip01_R_Hand" 1
}

$weightlist "weights_legs_only" { "ValveBiped.Bip01_Spine" 0 "ValveBiped.Bip01_Pelvis" 1 "ValveBiped.Bip01_L_Thigh" 1 "ValveBiped.Bip01_R_Thigh" 1 }

$sequence "layer_shootp1" "combine_soldier_anims_anims\custom\shootp1.smd" subtract "layer_shootp1" 4 delta hidden
$sequence "layer_reload_pistol" "police_animations_anims\reload_pistol.smd" weightlist "weights_pistol_new_arms" hidden
$sequence "layer_reload_combine" "combine_soldier_anims_anims\reload.smd" weightlist "weights_legs_only" hidden
$sequence "layer_reload_combine_low" "combine_soldier_anims_anims\reload_low.smd" weightlist "weights_legs_only" hidden

// ================================================================
// Combat Animations
// ================================================================
$sequence "CombatIdle1_Pistol" { // pistolangryidle2
	$Blend_SMD_Pistol$
	addlayer "Aim_stand_delta_all"
	activity "ACT_IDLE_ANGRY_PISTOL" 1
	loop
	cmdlist lockfeet
	ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" usesource
}

$sequence "Crouch_idle_pistol" {
	"police_animations_anims\Crouch_idle_pistol.smd"
	activity "ACT_COVER_PISTOL_LOW" 1
	//node "crouching_pistol"
	loop
	cmdlist lockfeet
	ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" usesource
}

$sequence "shootp1" {
	"combine_soldier_anims_anims\custom\shootp1.smd"
	addlayer "Aim_stand_delta_all"
	activity "ACT_RANGE_ATTACK_PISTOL" 1
	cmdlist lockfeet
	ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" usesource
}

$sequence "gesture_shoot_pistol" {
	"combine_soldier_anims_anims\custom\shootp1.smd"
	subtract "gesture_shoot_pistol" 4
	activity "ACT_GESTURE_RANGE_ATTACK_PISTOL" 1
	delta
	// Crowbar writes this subtract option to prevent jigglebone and poseparameter problems when delta sequences are recompiled.
	subtract "@gesture_shoot_pistol_corrective_animation" 0
}

$sequence "reload_pistol" {
	$Blend_SMD_Pistol$
	blendlayer "Aim_stand_delta_all" 0 0 1 5 local
	blendlayer "Aim_stand_delta_all" 33 39 41 41 local
	blendlayer "layer_reload_pistol" 0 5 33 39
	blendlayer "layer_reload_combine" 0 5 35 40
	numframes 41
	activity "ACT_RELOAD_PISTOL" 1
	{ event 3017 0 "" }
	{ event 3018 34 "" }
	cmdlist lockfeet
	ikrule "lhand" release
	ikrule "rhand" release
}

$sequence "reload_pistol_low" { // crouch_reload_pistol
	$Blend_SMD_Pistol_Crouched$
	blendlayer "Aim_stand_delta_all" 0 0 1 5 local
	blendlayer "Aim_stand_delta_all" 33 39 41 41 local
	blendlayer "layer_reload_pistol" 0 8 33 39
	blendlayer "layer_reload_combine_low" 0 5 35 40
	numframes 41

	activity "ACT_RELOAD_PISTOL_LOW" 1
	{ event 3017 0 "" }
	{ event 3018 34 "" }
	cmdlist lockfeet
	ikrule "lhand" release
	ikrule "rhand" release
}

$sequence "gesture_reload_pistolspine" {
	"police_animations_anims\gesture_reload_pistolspine.smd"
	delta
	// Crowbar writes this subtract option to prevent jigglebone and poseparameter problems when delta sequences are recompiled.
	subtract "@gesture_reload_pistolspine_corrective_animation" 0
	hidden
	weightlist "weights_neck_trans_x"
}

$sequence "gesture_reload_pistolarms" {
	"police_animations_anims\gesture_reload_pistolarms.smd"
	hidden
	//ikrule "rhand" release contact 0 fakeorigin 0 0 0 fakerotate 0 0 0 floor 0 height 0 radius 0 range 0 0 40 40 target 0
	//ikrule "lhand" release contact 0 fakeorigin 0 0 0 fakerotate 0 0 0 floor 0 height 0 radius 0 range 0 0 40 40 target 1
	weightlist "weights_gesture_reload_pistolarms"
}

$sequence "gesture_reload_pistol" {
	"police_animations_anims\gesture_reload_pistol.smd"
	activity "ACT_GESTURE_RELOAD_PISTOL" 1
	{ event 3017 0 "" }
	{ event 3018 37 "" }
	iklock "rfoot" 1 0
	iklock "lfoot" 1 0
	blendlayer "gesture_reload_pistolarms" 0 5 32 40 spline
	blendlayer "gesture_reload_pistolspine" 0 5 32 40 spline
	//node "standing_pistol"
	//ikrule "lhand" touch "ValveBiped.Bip01_Pelvis" contact 8 fakeorigin 0 0 0 fakerotate 0 0 0 floor 0 height 0 radius 0 range 1 8 16 20 target 1 usesequence 
	//ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" contact 22 fakeorigin 0 0 0 fakerotate 0 0 0 floor 0 height 0 radius 0 range 18 22 38 39 target 1 usesequence 
	weightlist "weights_gesture_reload_pistol"
}

$sequence "crouch_aim_pistol" {
	$Blend_SMD_Pistol_Crouched$
	addlayer "Aim_stand_delta_all"
	activity "ACT_RANGE_AIM_PISTOL_LOW" 1
	fps 18
	loop
	cmdlist lockfeet
	ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" usesource
}

$sequence "shootp1c" {
	$Blend_SMD_Pistol_Crouched$
	addlayer "layer_shootp1"
	addlayer "Aim_stand_delta_all" //addlayer "Aim_crouch_delta_all"
	numframes 5
	activity "ACT_RANGE_ATTACK_PISTOL_LOW" 1
	{ event 4 0 "" }
	cmdlist lockfeet
	ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" usesource
}

// ================================================================
// Aim Animations
// ================================================================
$sequence "pistol_Aim_all" {
	"a_pistol_aim_straight_up"
	"a_pistol_aim_straight_up"
	"a_pistol_aim_straight_up"
	"a_pistol_aim_up_right"
	"a_pistol_aim_up_center"
	"a_pistol_aim_up_left"
	"a_pistol_aim_mid_right"
	"a_pistol_aim_mid_center"
	"a_pistol_aim_mid_left"
	"a_pistol_aim_down_right"
	"a_pistol_aim_down_center"
	"a_pistol_aim_down_left"
	blend "aim_yaw" -43.47391 45.51665
	blend "aim_pitch" -82.85746 45.59517
	blendwidth 3
	delta
	hidden
	iklock "rfoot" 1 0
	iklock "lfoot" 1 0
}

$sequence "WalkN_pistol_Aim_all" {
	"a_WalkN_pistol_aim_straight_up"
	"a_WalkN_pistol_aim_straight_up"
	"a_WalkN_pistol_aim_straight_up"
	"a_WalkN_pistol_aim_up_right"
	"a_WalkN_pistol_aim_up_center"
	"a_WalkN_pistol_aim_up_left"
	"a_WalkN_pistol_aim_mid_right"
	"a_WalkN_pistol_aim_mid_center"
	"a_WalkN_pistol_aim_mid_left"
	"a_WalkN_pistol_aim_down_right"
	"a_WalkN_pistol_aim_down_center"
	"a_WalkN_pistol_aim_down_left"
	blend "aim_yaw" -45.59397 44.46127
	blend "aim_pitch" -78.71045 43.57745
	blendwidth 3
	delta
	hidden
	iklock "rfoot" 1 0
	iklock "lfoot" 1 0
}

// ================================================================
// Walk Animations
// ================================================================
$sequence "oldidle_to_pistol_aim_ik" "combine_soldier_anims_anims\custom\CombatIdle1_Pistol.smd" frame 0 0 subtract "layer_stimulated_aim_smg1" 0 delta hidden ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" usesource

$sequence "oldidle_to_pistol_ik" "combine_soldier_anims_anims\custom\Idle1_Pistol.smd" frame 0 0 subtract "layer_relaxed_oldidle" 0 delta hidden ikrule "lhand" touch "ValveBiped.Bip01_R_Hand" usesource

// ----------------------------------------------------------------

$sequence "layer_walk_hold_pistol" {
	"police_animations_anims\layer_walk_hold_pistol.smd"
	hidden
	addlayer "WalkN_pistol_Aim_all"
	loop
	weightlist "weights_pistol_new_arms"
}

// ----------------------------------------------------------------

$sequence "walk_aiming_pistol_all" {
	$a_WalkBlends
	activity "ACT_WALK_AIM_PISTOL" 1
	blendlayer "layer_walk_aiming" 0 0 0 0 local
	addlayer "oldidle_to_pistol_aim_ik"
}

$sequence "walk_hold_pistol" {
	$a_WalkBlends
	activity "ACT_WALK_PISTOL" 1
	addlayer "oldidle_to_pistol_ik"
}

// ================================================================
// Run Animations
// ================================================================
$sequence "run_hold_pistol" {
	$a_RunBlends
	activity "ACT_RUN_PISTOL" 1
	addlayer "oldidle_to_pistol_ik"
}

$sequence "run_aiming_pistol_all" {
	$a_RunBlends
	activity "ACT_RUN_AIM_PISTOL" 1
	blendlayer "layer_run_aiming" 0 0 0 0 local
	addlayer "oldidle_to_pistol_aim_ik"
}

// ================================================================
// Idle Animations
// ================================================================

$GenericIdle "Idle1_Pistol" "combine_soldier_anims_anims\custom\Idle1_Pistol.smd" "ACT_IDLE_PISTOL"