mirror of
https://github.com/InfinityLoader/IL-GSC.git
synced 2025-06-07 09:07:50 -05:00
Added BO1 ZM rawfiles
This commit is contained in:
parent
1a9be4df02
commit
b53c55f0c0
18
BO1/PC/ZM/aim_assist/view_input_0.graph
Normal file
18
BO1/PC/ZM/aim_assist/view_input_0.graph
Normal file
@ -0,0 +1,18 @@
|
||||
GRAPH_FLOAT_FILE
|
||||
|
||||
15
|
||||
0.0000 0.0000
|
||||
0.1218 0.0171
|
||||
0.1972 0.0295
|
||||
0.2612 0.0451
|
||||
0.3244 0.0644
|
||||
0.3872 0.0897
|
||||
0.4543 0.1281
|
||||
0.5149 0.1729
|
||||
0.5723 0.2203
|
||||
0.6263 0.2771
|
||||
0.6771 0.3483
|
||||
0.7288 0.4296
|
||||
0.7781 0.5157
|
||||
0.8387 0.6301
|
||||
1.0000 1.0000
|
16
BO1/PC/ZM/aim_assist/view_input_1.graph
Normal file
16
BO1/PC/ZM/aim_assist/view_input_1.graph
Normal file
@ -0,0 +1,16 @@
|
||||
GRAPH_FLOAT_FILE
|
||||
|
||||
13
|
||||
0.0000 0.0000
|
||||
0.1323 0.0235
|
||||
0.2102 0.0469
|
||||
0.2939 0.0778
|
||||
0.3741 0.1170
|
||||
0.4555 0.1724
|
||||
0.5401 0.2400
|
||||
0.6118 0.3149
|
||||
0.6726 0.4018
|
||||
0.7268 0.4906
|
||||
0.7797 0.5833
|
||||
0.8386 0.6926
|
||||
1.0000 1.0000
|
15
BO1/PC/ZM/aim_assist/view_input_2.graph
Normal file
15
BO1/PC/ZM/aim_assist/view_input_2.graph
Normal file
@ -0,0 +1,15 @@
|
||||
GRAPH_FLOAT_FILE
|
||||
|
||||
12
|
||||
0.0000 0.0000
|
||||
0.1322 0.0396
|
||||
0.2338 0.0780
|
||||
0.3235 0.1267
|
||||
0.4022 0.1812
|
||||
0.4809 0.2479
|
||||
0.5561 0.3254
|
||||
0.6205 0.3936
|
||||
0.6930 0.4771
|
||||
0.7819 0.5943
|
||||
0.8598 0.7299
|
||||
1.0000 1.0000
|
10
BO1/PC/ZM/aim_assist/view_input_3.graph
Normal file
10
BO1/PC/ZM/aim_assist/view_input_3.graph
Normal file
@ -0,0 +1,10 @@
|
||||
GRAPH_FLOAT_FILE
|
||||
|
||||
7
|
||||
0.0000 0.0000
|
||||
0.1242 0.0423
|
||||
0.2238 0.0885
|
||||
0.3210 0.1553
|
||||
0.4118 0.2419
|
||||
0.5116 0.3508
|
||||
1.0000 1.0000
|
BIN
BO1/PC/ZM/aitype/axis_zombie_jp_swamp.gsc
Normal file
BIN
BO1/PC/ZM/aitype/axis_zombie_jp_swamp.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_coast_zombie_barechest.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_coast_zombie_barechest.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_coast_zombie_scuba.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_coast_zombie_scuba.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_coast_zombie_soldier.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_coast_zombie_soldier.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_director_romero.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_director_romero.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_dog.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_dog.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_engineer.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_engineer.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_ger_zombie.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_ger_zombie.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_ger_zombietron.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_ger_zombietron.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_monkey_01.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_monkey_01.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_monkey_02.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_monkey_02.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_monkey_stealer.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_monkey_stealer.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_moon_quad.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_moon_quad.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_moon_zombie_astronaut.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_moon_zombie_astronaut.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_moon_zombie_militarypolice.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_moon_zombie_militarypolice.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_moss.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_moss.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_napalm.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_napalm.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_quad.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_quad.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_rus_zombie_cosmonaut.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_rus_zombie_cosmonaut.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_rus_zombie_scientist.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_rus_zombie_scientist.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_sonic.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_sonic.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_usa_zombie_militarypolice.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_usa_zombie_militarypolice.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_usa_zombie_officeworker.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_usa_zombie_officeworker.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_usa_zombie_scientist.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_usa_zombie_scientist.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_usa_zombietron_militarypolice.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_usa_zombietron_militarypolice.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/aitype/zombie_viet.gsc
Normal file
BIN
BO1/PC/ZM/aitype/zombie_viet.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/animscripts/anims.gsc
Normal file
BIN
BO1/PC/ZM/animscripts/anims.gsc
Normal file
Binary file not shown.
1405
BO1/PC/ZM/animscripts/battlechatter.gsc
Normal file
1405
BO1/PC/ZM/animscripts/battlechatter.gsc
Normal file
File diff suppressed because it is too large
Load Diff
BIN
BO1/PC/ZM/animscripts/battlechatter_ai.gsc
Normal file
BIN
BO1/PC/ZM/animscripts/battlechatter_ai.gsc
Normal file
Binary file not shown.
1519
BO1/PC/ZM/animscripts/combat_utility.gsc
Normal file
1519
BO1/PC/ZM/animscripts/combat_utility.gsc
Normal file
File diff suppressed because it is too large
Load Diff
2057
BO1/PC/ZM/animscripts/death.gsc
Normal file
2057
BO1/PC/ZM/animscripts/death.gsc
Normal file
File diff suppressed because it is too large
Load Diff
BIN
BO1/PC/ZM/animscripts/debug.gsc
Normal file
BIN
BO1/PC/ZM/animscripts/debug.gsc
Normal file
Binary file not shown.
BIN
BO1/PC/ZM/animscripts/face.gsc
Normal file
BIN
BO1/PC/ZM/animscripts/face.gsc
Normal file
Binary file not shown.
513
BO1/PC/ZM/animscripts/melee.gsc
Normal file
513
BO1/PC/ZM/animscripts/melee.gsc
Normal file
@ -0,0 +1,513 @@
|
||||
#include maps\_utility;
|
||||
#include animscripts\Utility;
|
||||
#include animscripts\SetPoseMovement;
|
||||
#include animscripts\Combat_Utility;
|
||||
#include animscripts\Debug;
|
||||
#include animscripts\anims;
|
||||
#include common_scripts\Utility;
|
||||
#using_animtree ("generic_human");
|
||||
MeleeCombat()
|
||||
{
|
||||
self endon("killanimscript");
|
||||
self melee_notify_wrapper();
|
||||
assert( CanMeleeAnyRange() );
|
||||
if(IsDefined(level.allow_ai_vs_ai_melee ))
|
||||
{
|
||||
doingAIMelee = (isAI( self.enemy ) && self.enemy.type == "human");
|
||||
}
|
||||
else
|
||||
{
|
||||
doingAIMelee = false;
|
||||
}
|
||||
if ( doingAiMelee )
|
||||
{
|
||||
assert( animscripts\utility::okToMelee( self.enemy ) );
|
||||
animscripts\utility::IAmMeleeing( self.enemy );
|
||||
AiVsAiMeleeCombat();
|
||||
animscripts\utility::ImNotMeleeing( self.enemy );
|
||||
scriptChange();
|
||||
return;
|
||||
}
|
||||
realMelee = true;
|
||||
if ( animscripts\utility::okToMelee(self.enemy) )
|
||||
{
|
||||
animscripts\utility::IAmMeleeing(self.enemy);
|
||||
}
|
||||
else
|
||||
{
|
||||
realMelee = false;
|
||||
}
|
||||
self thread EyesAtEnemy();
|
||||
self OrientMode("face enemy");
|
||||
MeleeDebugPrint("Melee begin");
|
||||
self AnimMode( "zonly_physics" );
|
||||
resetGiveUpTime();
|
||||
first_time = true;
|
||||
for ( ;; )
|
||||
{
|
||||
if ( !PrepareToMelee(first_time) )
|
||||
{
|
||||
self.lastMeleeGiveUpTime = GetTime();
|
||||
break;
|
||||
}
|
||||
first_time = false;
|
||||
assert( self.a.pose == "stand");
|
||||
MeleeDebugPrint("Melee main loop" + RandomInt(100));
|
||||
if ( !realMelee && animscripts\utility::okToMelee(self.enemy) )
|
||||
{
|
||||
realMelee = true;
|
||||
animscripts\utility::IAmMeleeing(self.enemy);
|
||||
}
|
||||
self thread EyesAtEnemy();
|
||||
self OrientMode("face current");
|
||||
if ( self maps\_bayonet::has_bayonet() && RandomInt( 100 ) < 0 )
|
||||
{
|
||||
self SetFlaggedAnimKnobAllRestart("meleeanim", animArray("bayonet"), %body, 1, .2, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
self SetFlaggedAnimKnobAllRestart("meleeanim", animArray("melee"), %body, 1, .2, 1);
|
||||
}
|
||||
while ( 1 )
|
||||
{
|
||||
self waittill("meleeanim", note);
|
||||
if ( note == "end" )
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if ( note == "fire" )
|
||||
{
|
||||
if ( !IsDefined( self.enemy ) )
|
||||
{
|
||||
break;
|
||||
}
|
||||
oldhealth = self.enemy.health;
|
||||
self melee();
|
||||
if ( self.enemy.health < oldhealth )
|
||||
{
|
||||
resetGiveUpTime();
|
||||
}
|
||||
}
|
||||
else if ( note == "stop" )
|
||||
{
|
||||
if ( !CanContinueToMelee() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
self OrientMode("face default");
|
||||
}
|
||||
if (realMelee)
|
||||
{
|
||||
animscripts\utility::ImNotMeleeing(self.enemy);
|
||||
}
|
||||
self AnimMode("none");
|
||||
self thread backToCombat();
|
||||
}
|
||||
backToCombat()
|
||||
{
|
||||
self notify("killanimscript");
|
||||
waittillframeend;
|
||||
self thread animscripts\combat::main();
|
||||
self notify ("stop EyesAtEnemy");
|
||||
self notify ("stop_melee_debug_print");
|
||||
scriptChange();
|
||||
}
|
||||
resetGiveUpTime()
|
||||
{
|
||||
if ( DistanceSquared( self.origin, self.enemy.origin ) > anim.chargeRangeSq )
|
||||
{
|
||||
self.giveUpOnMeleeTime = GetTime() + randomintrange( 2700, 3300 );
|
||||
}
|
||||
else
|
||||
{
|
||||
self.giveUpOnMeleeTime = GetTime() + randomintrange( 1700, 2300 );
|
||||
}
|
||||
}
|
||||
MeleeDebugPrint(text)
|
||||
{
|
||||
return;
|
||||
self.meleedebugprint = text;
|
||||
self thread meleeDebugPrintThreadWrapper();
|
||||
}
|
||||
meleeDebugPrintThreadWrapper()
|
||||
{
|
||||
if ( !IsDefined(self.meleedebugthread) )
|
||||
{
|
||||
self.meleedebugthread = true;
|
||||
self meleeDebugPrintThread();
|
||||
self.meleedebugthread = undefined;
|
||||
}
|
||||
}
|
||||
meleeDebugPrintThread()
|
||||
{
|
||||
self endon("death");
|
||||
self endon("killanimscript");
|
||||
self endon("stop_melee_debug_print");
|
||||
while(1)
|
||||
{
|
||||
Print3d(self.origin + (0,0,60), self.meleedebugprint, (1,1,1), 1, .1);
|
||||
wait .05;
|
||||
}
|
||||
}
|
||||
debug_melee_on_actor()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
debug_melee( msg )
|
||||
{
|
||||
}
|
||||
debug_melee_line( start, end, color, duration )
|
||||
{
|
||||
}
|
||||
getEnemyPose()
|
||||
{
|
||||
if ( IsPlayer( self.enemy ) )
|
||||
{
|
||||
return self.enemy getStance();
|
||||
}
|
||||
else
|
||||
{
|
||||
return self.enemy.a.pose;
|
||||
}
|
||||
}
|
||||
CanContinueToMelee()
|
||||
{
|
||||
return CanMeleeInternal( "already started" );
|
||||
}
|
||||
CanMeleeAnyRange()
|
||||
{
|
||||
return CanMeleeInternal( "any range" );
|
||||
}
|
||||
CanMeleeDesperate()
|
||||
{
|
||||
return CanMeleeInternal( "long range" );
|
||||
}
|
||||
CanMelee()
|
||||
{
|
||||
return CanMeleeInternal( "normal" );
|
||||
}
|
||||
CanMeleeInternal( state )
|
||||
{
|
||||
if ( !IsSentient( self.enemy ) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Does not have a valid target." );
|
||||
return false;
|
||||
}
|
||||
if (!IsAlive(self.enemy))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( IsDefined( self.disableMelee ) )
|
||||
{
|
||||
assert( self.disableMelee );
|
||||
debug_melee( "Not doing melee - Melee is disabled, self.disableMelee is set to true." );
|
||||
return false;
|
||||
}
|
||||
if (self.a.pose != "stand")
|
||||
{
|
||||
debug_melee( "Not doing melee - Cant melee in " + self.a.pose );
|
||||
return false;
|
||||
}
|
||||
enemypose = getEnemyPose();
|
||||
if ( !IsPlayer( self.enemy ) && enemypose != "stand" && enemypose != "crouch" )
|
||||
{
|
||||
if ( !( self is_banzai() && enemypose == "prone" ) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Enemy is in prone." );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
yaw = abs(getYawToEnemy());
|
||||
if ( self.a.allow_shooting && ((yaw > 60 && state != "already started") || yaw > 110) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Not facing the enemy." );
|
||||
return false;
|
||||
}
|
||||
enemyPoint = self.enemy GetOrigin();
|
||||
vecToEnemy = enemyPoint - self.origin;
|
||||
self.enemyDistanceSq = lengthSquared( vecToEnemy );
|
||||
nearest_enemy_sqrd_dist = self GetClosestEnemySqDist();
|
||||
epsilon = 0.1;
|
||||
if( IsDefined( nearest_enemy_sqrd_dist ) && ( nearest_enemy_sqrd_dist - epsilon > self.enemyDistanceSq ) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Entity " + self getEntityNumber() + " can't melee entity " + self.enemy getEntityNumber() + " at distSq " + self.enemyDistanceSq + " because there is a closer enemy at distSq " + nearest_enemy_sqrd_dist + "." );
|
||||
return false;
|
||||
}
|
||||
if(IsDefined(level.allow_ai_vs_ai_melee ))
|
||||
{
|
||||
doingAIMelee = (isAI( self.enemy ) && self.enemy.type == "human");
|
||||
}
|
||||
else
|
||||
{
|
||||
doingAIMelee = false;
|
||||
}
|
||||
if ( doingAIMelee )
|
||||
{
|
||||
if ( !animscripts\utility::okToMelee(self.enemy) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Enemy is already being meleed." );
|
||||
return false;
|
||||
}
|
||||
if ( IsDefined( self.magic_bullet_shield ) && self.magic_bullet_shield && IsDefined( self.enemy.magic_bullet_shield ) && self.enemy.magic_bullet_shield )
|
||||
{
|
||||
debug_melee( "Not doing melee - Enemy has magic bullet shield." );
|
||||
return false;
|
||||
}
|
||||
if ( !isMeleePathClear( vecToEnemy, enemyPoint ) )
|
||||
{
|
||||
self notify("melee_path_blocked");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( IsDefined( self.enemy.magic_bullet_shield ) && self.enemy.magic_bullet_shield )
|
||||
{
|
||||
if ( !( self is_banzai() ) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Enemy has magic bullet shield." );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (self.enemyDistanceSq <= anim.meleeRangeSq)
|
||||
{
|
||||
if ( !isMeleePathClear( vecToEnemy, enemyPoint ) )
|
||||
{
|
||||
if ( !self is_banzai() )
|
||||
{
|
||||
self notify("melee_path_blocked");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if ( self is_banzai() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( state != "any range" )
|
||||
{
|
||||
chargeRangeSq = anim.chargeRangeSq;
|
||||
if ( state == "long range" )
|
||||
{
|
||||
chargeRangeSq = anim.chargeLongRangeSq;
|
||||
}
|
||||
if (self.enemyDistanceSq > chargeRangeSq)
|
||||
{
|
||||
debug_melee( "Not doing melee - Enemy is not close enough to charge." );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ( state == "already started" )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( ( !self is_banzai() || IsPlayer( self.enemy ) ) && self.a.allow_shooting && IsDefined( self.lastMeleeGiveUpTime ) && GetTime() - self.lastMeleeGiveUpTime < 3000 )
|
||||
{
|
||||
debug_melee( "Not doing melee - Recently meleed someone and missed." );
|
||||
return false;
|
||||
}
|
||||
if ( !animscripts\utility::okToMelee(self.enemy) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Enemy is being meleed." );
|
||||
return false;
|
||||
}
|
||||
if ( self.enemy animscripts\banzai::in_banzai_attack() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if ( self animscripts\banzai::in_banzai_attack() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if( !isMeleePathClear( vecToEnemy, enemyPoint ) )
|
||||
{
|
||||
self notify("melee_path_blocked");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
isMeleePathClear( vecToEnemy, enemyPoint )
|
||||
{
|
||||
dirToEnemy = VectorNormalize( (vecToEnemy[0], vecToEnemy[1], 0 ) );
|
||||
meleePoint = enemyPoint - ( dirToEnemy[0]*32, dirToEnemy[1]*32, 0 );
|
||||
thread debug_melee_line( self.origin, meleePoint, ( 1,0,0 ), 1.5 );
|
||||
if ( !self IsInGoal( meleePoint ) )
|
||||
{
|
||||
debug_melee( "Not doing melee - Enemy is outside not in goal." );
|
||||
return false;
|
||||
}
|
||||
if ( self maymovetopoint(meleePoint) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
debug_melee( "Not doing melee - Can not move to the melee point, MayMoveToPoint failed." );
|
||||
return false;
|
||||
}
|
||||
PrepareToMelee(first_time)
|
||||
{
|
||||
if ( !CanMeleeAnyRange() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (self.enemyDistanceSq <= anim.meleeRangeSq)
|
||||
{
|
||||
isBatonGuard = IsDefined(self.baton_guard) && self.baton_guard;
|
||||
isRegularAi = self.animType != "spetsnaz" && !isBatonGuard;
|
||||
if( first_time || isRegularAi )
|
||||
{
|
||||
self SetFlaggedAnimKnobAll("readyanim", animArray("stand_2_melee"), %body, 1, .3, 1);
|
||||
self animscripts\shared::DoNoteTracks("readyanim");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
self PlayMeleeSound();
|
||||
prevEnemyPos = self.enemy.origin;
|
||||
sampleTime = 0.1;
|
||||
runToMeleeAnim = animArray("run_2_melee");
|
||||
raiseGunAnimTravelDist = length(getmovedelta(runToMeleeAnim, 0, 1));
|
||||
meleeAnimTravelDist = 32;
|
||||
shouldRaiseGunDist = anim.meleeRange * 0.75 + meleeAnimTravelDist + raiseGunAnimTravelDist;
|
||||
shouldRaiseGunDistSq = shouldRaiseGunDist * shouldRaiseGunDist;
|
||||
shouldMeleeDist = anim.meleeRange + meleeAnimTravelDist;
|
||||
shouldMeleeDistSq = shouldMeleeDist * shouldMeleeDist;
|
||||
raiseGunFullDuration = getanimlength(runToMeleeAnim) * 1000;
|
||||
raiseGunFinishDuration = raiseGunFullDuration - 100;
|
||||
raiseGunPredictDuration = raiseGunFullDuration - 200;
|
||||
raiseGunStartTime = 0;
|
||||
predictedEnemyDistSqAfterRaiseGun = undefined;
|
||||
runAnim = animscripts\run::GetRunAnim();
|
||||
self SetFlaggedAnimKnobAll("chargeanim", runAnim, %body, 1, .3, 1);
|
||||
raisingGun = false;
|
||||
while ( 1 )
|
||||
{
|
||||
MeleeDebugPrint("PrepareToMelee loop" + RandomInt(100));
|
||||
time = GetTime();
|
||||
willBeWithinRangeWhenGunIsRaised = (IsDefined( predictedEnemyDistSqAfterRaiseGun ) && predictedEnemyDistSqAfterRaiseGun <= shouldRaiseGunDistSq);
|
||||
if ( !raisingGun )
|
||||
{
|
||||
if ( willBeWithinRangeWhenGunIsRaised )
|
||||
{
|
||||
self SetFlaggedAnimKnobAllRestart("chargeanim", runToMeleeAnim, %body, 1, .2, 1);
|
||||
raiseGunStartTime = time;
|
||||
raisingGun = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
withinRangeNow = self.enemyDistanceSq <= shouldRaiseGunDistSq;
|
||||
if ( time - raiseGunStartTime >= raiseGunFinishDuration || (!willBeWithinRangeWhenGunIsRaised && !withinRangeNow) )
|
||||
{
|
||||
self SetFlaggedAnimKnobAll("chargeanim", runAnim, %body, 1, .3, 1);
|
||||
raisingGun = false;
|
||||
}
|
||||
}
|
||||
self animscripts\shared::DoNoteTracksForTime(sampleTime, "chargeanim");
|
||||
if ( !CanMeleeAnyRange() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
assert( IsDefined( self.enemyDistanceSq ) );
|
||||
enemyVel = vector_scale( self.enemy.origin - prevEnemyPos, 1 / (GetTime() - time) );
|
||||
prevEnemyPos = self.enemy.origin;
|
||||
predictedEnemyPosAfterRaiseGun = self.enemy.origin + vector_scale( enemyVel, raiseGunPredictDuration );
|
||||
predictedEnemyDistSqAfterRaiseGun = DistanceSquared( self.origin, predictedEnemyPosAfterRaiseGun );
|
||||
if ( raisingGun && self.enemyDistanceSq <= shouldMeleeDistSq && GetTime() - raiseGunStartTime >= raiseGunFinishDuration )
|
||||
{
|
||||
break;
|
||||
}
|
||||
if ( !raisingGun && GetTime() >= self.giveUpOnMeleeTime )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
PlayMeleeSound()
|
||||
{
|
||||
if ( !IsDefined ( self.a.nextMeleeChargeSound ) )
|
||||
{
|
||||
self.a.nextMeleeChargeSound = 0;
|
||||
}
|
||||
if ( GetTime() > self.a.nextMeleeChargeSound )
|
||||
{
|
||||
self animscripts\face::SaySpecificDialogue( undefined, "chr_play_grunt_" + self.voice, 0.3 );
|
||||
self.a.nextMeleeChargeSound = GetTime() + 8000;
|
||||
}
|
||||
}
|
||||
AiVsAiMeleeCombat()
|
||||
{
|
||||
self endon("killanimscript");
|
||||
self melee_notify_wrapper();
|
||||
self OrientMode("face enemy");
|
||||
self ClearAnim( %root, 0.3 );
|
||||
IWin = ( RandomInt(10) < 8 );
|
||||
if ( IsDefined( self.magic_bullet_shield ) && self.magic_bullet_shield )
|
||||
{
|
||||
IWin = true;
|
||||
}
|
||||
if ( IsDefined( self.enemy.magic_bullet_shield ) && self.enemy.magic_bullet_shield )
|
||||
{
|
||||
IWin = false;
|
||||
}
|
||||
winAnim = animArray("ai_vs_ai_win");
|
||||
loseAnim = animArray("ai_vs_ai_lose");
|
||||
if ( IWin )
|
||||
{
|
||||
myAnim = winAnim;
|
||||
theirAnim = loseAnim;
|
||||
}
|
||||
else
|
||||
{
|
||||
myAnim = loseAnim;
|
||||
theirAnim = winAnim;
|
||||
}
|
||||
desiredDistSqrd = 72 * 72;
|
||||
self PlayMeleeSound();
|
||||
AiVsAiMeleeCharge( desiredDistSqrd );
|
||||
if ( DistanceSquared( self.origin, self.enemy.origin ) > desiredDistSqrd )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
self.meleePartner = self.enemy;
|
||||
self.enemy.meleePartner = self;
|
||||
self.enemy.meleeAnim = theirAnim;
|
||||
self.enemy animcustom( ::AiVsAiAnimCustom );
|
||||
self.meleeAnim = myAnim;
|
||||
self animcustom( ::AiVsAiAnimCustom );
|
||||
}
|
||||
AiVsAiMeleeCharge( desiredDistSqrd )
|
||||
{
|
||||
giveUpTime = GetTime() + 2500;
|
||||
self SetAnimKnobAll( animscripts\run::GetRunAnim(), %body, 1, 0.2 );
|
||||
while ( DistanceSquared( self.origin, self.enemy.origin ) > desiredDistSqrd && GetTime() < giveUpTime )
|
||||
{
|
||||
wait .05;
|
||||
}
|
||||
}
|
||||
AiVsAiAnimCustom()
|
||||
{
|
||||
self endon("killanimscript");
|
||||
self AiVsAiMeleeAnim( self.meleeAnim );
|
||||
}
|
||||
AiVsAiMeleeAnim( myAnim )
|
||||
{
|
||||
self endon("end_melee");
|
||||
self thread endMeleeOnKillanimscript();
|
||||
partnerDir = self.meleePartner.origin - self.origin;
|
||||
self OrientMode( "face angle", VectorToAngles( partnerDir )[1] );
|
||||
self AnimMode( "zonly_physics" );
|
||||
self SetFlaggedAnimKnobAllRestart( "meleeAnim", myAnim, %body, 1, 0.2 );
|
||||
self animscripts\shared::DoNoteTracks( "meleeAnim" );
|
||||
self notify("end_melee");
|
||||
}
|
||||
endMeleeOnKillanimscript()
|
||||
{
|
||||
self endon("end_melee");
|
||||
self waittill("killanimscript");
|
||||
self.meleePartner notify("end_melee");
|
||||
}
|
||||
|