Incomplete SP dump provided by Louvenarde

This commit is contained in:
reaaLx
2024-09-05 17:14:53 +10:00
parent 1ea2370337
commit e5de1d5d55
784 changed files with 340494 additions and 0 deletions

311
common_scripts/_atbr.gsc Normal file
View File

@ -0,0 +1,311 @@
#include common_scripts\utility;
//dierction of atbr missile, just off perefectly straight up.
ATBR_MISSILE_DIRECTION = ( 1.0, 1.0, 20.0 );
ATBR_HUD_TIMER_POS_X = 0.0;
ATBR_HUD_TIMER_POS_Y = -85.0;
//*******************************************************************
// *
// *
//*******************************************************************
atbr_common_init()
{
// TagZP<NOTE> Moved atbr weapons into a new array as defined in the comment below
// I did this because now mp and sp do not share the same weapon defs.
//level._atbr_weapons["base"];
//level._atbr_weapons["detonate"];
//level._atbr_weapons["missile"];
//level._atbr_weapons["bullet"];
foreach( weapon in level._atbr_weapons )
{
PreCacheItem( weapon );
}
// Misc.
VisionSetMissilecam( "missilecam" );
PreCacheShader( "remotemissile_infantry_target" );
PreCacheShader( "hud_fofbox_self_sp" );
}
//*******************************************************************
// *
// *
//*******************************************************************
atbr_common_give()
{
self giveWeapon( level._atbr_weapons["base"] );
if( isSP( ))
{
self givemaxammo( level._atbr_weapons["base"] );
}
else
{
//mp kill streak only supports one atbr missile
self givestartammo( level._atbr_weapons["base"] );
}
if( !isDefined( self.atbr_planted ))
{
self.atbr_planted = false;
}
self SetActionSlot( 4, "weapon", level._atbr_weapons["base"] );
self.atbr_planted = false;
// Watch the ATBR for this player.
self thread atbr_common_watch_base();
}
//*******************************************************************
// *
// *
//*******************************************************************
atbr_common_watch_base()
{
self endon( "death" );
for( ;; )
{
self waittill( "grenade_fire", atbr_base, weapname );
if ( weapname == level._atbr_weapons["base"] || weapname == "claymore_mp" )
{
self.atbr_planted = true;
atbr_base.owner = self;
self.attached = false;
atbr_base thread atbr_common_watch_detonation( self );
self giveWeapon( level._atbr_weapons["detonate"] );
self givemaxammo( level._atbr_weapons["detonate"] );
self switchtoweapon( level._atbr_weapons["detonate"] );
if( !isSP( ))
{
return;
}
}
}
}
//*******************************************************************
// *
// *
//*******************************************************************
atbr_common_watch_detonation( player )
{
self endon( "death" );
for( ;; )
{
player waittill( "detonate", weapname );
if ( weapname == level._atbr_weapons["detonate"] )
{
player.atbr_planted = false;
atbr_takeoff_direction = ATBR_MISSILE_DIRECTION;
missile = MagicBullet( level._atbr_weapons["missile"], self.origin, self.origin + atbr_takeoff_direction, player );
missile.angles = (-90, self.angles[1], 0);
self hide();
atbr_common_attach_to_bullet( player, missile );
if( isSP( ))
{
player switchtoweapon( level._atbr_weapons["base"] );
}
player TakeWeapon( level._atbr_weapons["detonate"] );
// tagTMR<NOTE> Notifying complete switches weapons back to primary, causing incorrect
// killstreak and stat tallies as the player gets kills while following the missle
player notify( "atbr_complete" );
self delete();
}
wait( 0.1 );
}
}
//*******************************************************************
// *
// *
//*******************************************************************
atbr_common_attach_to_bullet( player, missile )
{
wait( 0.25 );
if( isdefined( missile ))
{
// Do not attach the player to multiple rockets.
if( player.attached == false )
{
if( isDefined( level._atbr_ammo_count ))
{
player._atbr_ammo_count = level._atbr_ammo_count;
}
if( isAlive( player ))
{
player.attached = true;
player link_camera_and_controls( missile );
player atbr_common_follow_missile( missile );
missile waittill( "death" );
player unlink_camera_and_controls();
}
}
}
}
//*******************************************************************
// *
// *
//*******************************************************************
atbr_common_follow_missile( missile )
{
self endon( "death" );
missile endon( "death" );
// Link player.
self thread atbr_common_fire_shots( missile );
}
link_camera_and_controls( missile )
{
self CameraLinkTo( missile, "tag_origin", 1);
self ControlsLinkTo( missile );
// Targets.
if( isdefined( level._atbr_callback_set_targets ))
{
self [[ level._atbr_callback_set_targets ]]( missile );
}
//if ammo count is defined create a hud elem for it.
if( isDefined( self._atbr_ammo_count ))
{
self createHudATBRAmmoCounter( self._atbr_ammo_count );
}
}
unlink_camera_and_controls( )
{
self CameraUnlink();
self ControlsUnLink();
// Targets.
if( isdefined( level._atbr_callback_remove_targets ))
{
self [[ level._atbr_callback_remove_targets ]]();
}
if( isDefined( self._atbr_ammo_count ))
{
self destroyHudATBRAmmoCounter();
}
}
//*******************************************************************
// *
// *
//*******************************************************************
atbr_common_fire_shots( missile )
{
missile endon( "death" );
self endon( "death" );
self NotifyOnPlayerCommand( "fire_shot", "+attack" );
for( ;; )
{
self waittill( "fire_shot" );
//if a ammo count is defined, update hud, and cut off when all ammo is used.
if( isDefined( self._atbr_ammo_count ))
{
if( self._atbr_ammo_count <= 0 )
{
//keep the camera attached till the missile has span its entire life
//wait( 0.05 );
//continue;
//exit missile cam back to player
wait( 0.2 );
break;
}
self._atbr_ammo_count = self._atbr_ammo_count - 1;
self updateHudATBRAmmoCounter( self._atbr_ammo_count );
}
Earthquake( 0.2, 1, missile.origin, 5000 );
start = missile.origin;
forward = AnglesToForward( missile.angles );
forward = forward * ( 1, -1, -1 );
end = start + ( forward * 2000.0 );
MagicBullet( level._atbr_weapons["bullet"], start, end, self );
wait( 0.1 );
}
}
createHudATBRAmmoCounter( count )
{
self.atbrAmmoCounter = newClientHudElem( self );
self.atbrAmmoCounter.x = ATBR_HUD_TIMER_POS_X;
self.atbrAmmoCounter.y = ATBR_HUD_TIMER_POS_Y;
self.atbrAmmoCounter.alignX = "center";
self.atbrAmmoCounter.alignY = "bottom";
self.atbrAmmoCounter.horzAlign = "center_adjustable";
self.atbrAmmoCounter.vertAlign = "bottom_adjustable";
self.atbrAmmoCounter.fontScale = 2.5;
self.atbrAmmoCounter setValue( count );
self.atbrAmmoCounter.alpha = 1.0;
}
updateHudATBRAmmoCounter( value )
{
if( isDefined( self.atbrAmmoCounter ))
{
self.atbrAmmoCounter setValue( value );
}
}
destroyHudATBRAmmoCounter()
{
if( isDefined( self.atbrAmmoCounter ))
{
self.atbrAmmoCounter Destroy();
}
}
//returns true if sWeapon is an atbr weapon
is_atbr_weapons( sWeapon )
{
if( isDefined( level._atbr_weapons ))
{
foreach( weapon in level._atbr_weapons )
{
if( weapon == sWeapon )
{
return true;
}
}
}
return false;
}

View File

@ -0,0 +1,9 @@
#using_animtree( "destructibles" );
main()
{
level._destructible_preanims[ "generator_explode" ] = %generator_explode;
level._destructible_preanims[ "generator_explode_02" ] = %generator_explode_02;
level._destructible_preanims[ "generator_explode_03" ] = %generator_explode_03;
level._destructible_preanims[ "generator_vibration" ] = %generator_vibration;
}

View File

@ -0,0 +1,9 @@
#using_animtree( "destructibles" );
main()
{
level._destructible_preanims[ "light_fluorescent_swing" ] = %light_fluorescent_swing;
level._destructible_preanims[ "light_fluorescent_null" ] = %light_fluorescent_null;
level._destructible_preanims[ "light_fluorescent_swing_02" ] = %light_fluorescent_swing_02;
level._effect[ "spotlight_fx" ] = loadfx( "misc/fluorescent_spotlight" );
}

View File

@ -0,0 +1,13 @@
#using_animtree( "destructibles" );
main()
{
level._destructible_preanims[ "locker_broken_both_doors_1" ] = %locker_broken_both_doors_1;
level._destructible_preanims[ "locker_broken_both_doors_2" ] = %locker_broken_both_doors_2;
level._destructible_preanims[ "locker_broken_both_doors_3" ] = %locker_broken_both_doors_3;
level._destructible_preanims[ "locker_broken_both_doors_4" ] = %locker_broken_both_doors_4;
level._destructible_preanims[ "locker_broken_door1_slow" ] = %locker_broken_door1_slow;
level._destructible_preanims[ "locker_broken_door1_fast" ] = %locker_broken_door1_fast;
level._destructible_preanims[ "locker_broken_door2_slow" ] = %locker_broken_door2_slow;
level._destructible_preanims[ "locker_broken_door2_fast" ] = %locker_broken_door2_fast;
}

View File

@ -0,0 +1,8 @@
#using_animtree( "destructibles" );
main()
{
level._destructible_preanims[ "wall_fan_rotate" ] = %wall_fan_rotate;
level._destructible_preanims[ "wall_fan_wobble" ] = %wall_fan_wobble;
level._destructible_preanims[ "wall_fan_stop" ] = %wall_fan_stop;
}

646
common_scripts/_nx_fx.gsc Normal file
View File

@ -0,0 +1,646 @@
//****************************************************************************
// **
// Confidential - (C) Activision Publishing, Inc. 2011 **
// **
//****************************************************************************
// **
// Module: NX FX Utility Scripts **
// **
// Created: 3/30/2011 - Johnny Ow **
// **
//****************************************************************************
#include common_scripts\utility;
#include maps\_utility;
//*******************************************************************
// *
// *
//*******************************************************************
/*
=============
///ScriptDocBegin
"Name: fx_delete_createFXEnt_by_fxID( fxID, removeFromArray, immediate )"
"Summary: Delete entities from level._createFXEnt[] by fxID"
"Module: FX Utility"
"CallOn: "
"MandatoryArg: <fxID> fxID of the entities to delete"
"OptionalArg: <removeFromArray> whether the entities should also be removed from level.createFXEnt[]"
"OptionalArg: <immediate> whether to delete particles immediately"
"Example: fx_delete_createFXEnt_by_fxID( "fx_test", false, false );"
"SPMP: both"
///ScriptDocEnd
=============
*/
fx_delete_createFXEnt_by_fxID( fxID, removeFromArray, immediate )
{
if ( !isDefined( removeFromArray ) )
removeFromArray = false;
if ( !isDefined( immediate ) )
immediate = false;
inc = 0;
foreach ( ent in level._createFXEnt )
{
if ( ent.v[ "fxid" ] == fxID )
{
if ( isDefined( ent.looper ) )
{
if ( removeFromArray )
level._createFXEnt = array_Remove( level._createFXEnt, ent );
ent.looper delete( immediate );
}
}
inc++;
if ( inc > 3 )
{
inc = 0;
wait .05;
}
}
}
//*******************************************************************
// *
// *
//*******************************************************************
/*
=============
///ScriptDocBegin
"Name: fx_delete_createFXEnt_by_vol( volName, removeFromArray, immediate )"
"Summary: Delete entities from level._createFXEnt[] by volume"
"Module: FX Utility"
"CallOn: "
"MandatoryArg: <volName> name of volume that contains entities to delete"
"OptionalArg: <removeFromArray> whether the entities should also be removed from level.createFXEnt[]"
"OptionalArg: <immediate> whether to delete particles immediately"
"Example: fx_delete_createFXEnt_by_fxID( "fx_test", false );"
"SPMP: both"
///ScriptDocEnd
=============
*/
fx_delete_createFXEnt_by_vol( volName, removeFromArray, immediate )
{
volume = getEnt( volName, "targetname" );
assert( isDefined( volume ) );
if ( !isDefined( removeFromArray ) )
removeFromArray = false;
if ( !isDefined( immediate ) )
immediate = false;
tester = spawn( "script_origin", ( 0, 0, 0) );
inc = 0;
foreach ( ent in level._createFXEnt )
{
if ( isDefined( ent.looper ) )
{
tester.origin = ent.v[ "origin" ];
if (tester isTouching( volume ) )
{
if ( removeFromArray )
level._createFXEnt = array_Remove( level._createFXEnt, ent );
ent.looper delete( immediate );
}
}
inc++;
if ( inc > 3 )
{
inc = 0;
wait .05;
}
}
tester delete();
}
//*******************************************************************
// *
// *
//*******************************************************************
/*
=============
///ScriptDocBegin
"Name: fx_restart_createFXEnt_by_vol( volName )"
"Summary: Restart level._createFXEnt[] entities by volume"
"Module: FX Utility"
"CallOn: "
"MandatoryArg: <volName> name of volume that contains entities to delete"
"Example: fx_delete_createFXEnt_by_fxID( "fx_test" );"
"SPMP: singleplayer"
///ScriptDocEnd
=============
*/
fx_restart_createFXEnt_by_vol( volName )
{
volume = getEnt( volName, "targetname" );
assert( isDefined( volume ) );
tester = spawn( "script_origin", ( 0, 0, 0) );
inc = 0;
foreach ( ent in level._createFXEnt )
{
tester.origin = ent.v[ "origin" ];
if (tester isTouching( volume ) )
{
ent restartEffect();
}
inc++;
if ( inc > 3 )
{
inc = 0;
wait .05;
}
}
tester delete();
}
//*******************************************************************
// *
// *
//*******************************************************************
/*
=============
///ScriptDocBegin
"Name: fx_delete_all( immediate )"
"Summary: Delete all entities from level._createFXEnt[]"
"Module: FX Utility"
"CallOn: "
"OptionalArg: <immediate> kills all existing FX elements belong to this entity immediately."
"Example: fx_delete_all();"
"SPMP: both"
///ScriptDocEnd
=============
*/
fx_delete_all( immediate )
{
foreach ( entFx in level._createfxent )
{
if ( isdefined( entFx.looper ) )
{
if ( isdefined( immediate ) )
{
entFx.looper delete( immediate );
}
else
{
entFx.looper delete();
}
}
entFx notify( "stop_loop" );
}
level._createFXent = [];
}
/*
=============
///ScriptDocBegin
"Name: fx_set_skyfog( height_start, height_end, height_blend, transition_time )"
"Summary: Set new target skyfog parameters"
"Module: FX Utility"
"CallOn: "
"OptionalArg: "
"Example: fx_set_skyfog( 0.6, 1.4, 0.8, 3.0 );"
"SPMP: singleplayer"
///ScriptDocEnd
=============
*/
fx_set_skyfog( height_start, height_end, height_blend, transition_time )
{
if (transition_time > 0.2)
{
thread lerp_savedDvar( "r_fog_height_blend", height_blend, transition_time );
thread lerp_savedDvar( "r_fog_height_start", height_start, transition_time );
thread lerp_savedDvar( "r_fog_height_end", height_end, transition_time );
} else {
// small values don't lerp well - just set the value
SetSavedDVar( "r_fog_height_blend", height_blend);
SetSavedDVar( "r_fog_height_start", height_start);
SetSavedDVar( "r_fog_height_end", height_end);
}
wait transition_time; // wait until they're done transitioning to return
}
/*
=============
///ScriptDocBegin
"Name: fx_secondary_damage_trigger( ent )"
"Summary: setup secondary effects trigger for this effect entity"
"Module: FX Utility"
"CallOn: "
"OptionalArg: "
"Example: fx_secondary_damage_trigger( ent );"
"SPMP: singleplayer"
///ScriptDocEnd
=============
*/
fx_secondary_damage_trigger( ent )
{
bDebugDraw = false;
// Create a node at the FX's position
org = Spawn( "script_model", ent.v[ "origin"] + (0,0,10) );
// debug locations
if (bDebugDraw)
thread draw_circle_until_notify( org.origin, 1, 0, 1, 0, ent, "stop_drawing_circle" );
// Make it damageable
org setCanDamage( true );
org SetCanRadiusDamage( true );
ent.v[ "new_org" ] = org;
while( true )
{
org waittill( "damage", damage, attacker, direction_vec, point, damageType, modelName, tagName );
wait_timer = 0;
damage_speed = 0;
delay_mult = 0.0; // delay factor to mult against distance and use for the wait timer.
// ********************************************************
// speeds of concussive forces
// speed of sound (for reference) = 13512 inches per second
// dynamite = 11811 inches/second
// c4 = 354331 inches/second
// ********************************************************
switch( damageType )
{
case "mod_melee":
case "mod_crush":
case "melee":
case "mod_pistol_bullet":
case "mod_rifle_bullet":
case "bullet":
case "mod_grenade":
case "MOD_GRENADE_SPLASH":
damage_speed = 11811; // dynamite
break;
case "mod_projectile":
case "mod_projectile_splash":
case "mod_explosive":
case "c4":
damage_speed = 354331; // c4
break;
case "splash":
damage_speed = 11811; // dynamite
break;
case "mod_impact":
case "unknown":
default:
break;
}
wait_factor = 2.0; // multiplier on the wait
if ( damage_speed > 0 )
{
// Get distance from explosion to this fx origin
distance_from_damage = distance( point, org.origin ); // raw distance
wait_timer = (distance_from_damage / damage_speed); // time to wait
direction_vec = vectornormalize(org.origin - point);
wait (wait_timer * wait_factor);
PlayFX( level._effect[ ent.v["fxid"] ], org.origin, direction_vec, ent.v[ "up" ] );
}
wait 1; // wait for reset
}
}
/*
=============
///ScriptDocBegin
"Name: fx_setup_secondary_damage_effects()"
"Summary: setup secondary effects triggers for CreateFX placed nodes with a fxid that starts with nx_fx_react"
"Module: FX Utility"
"CallOn: "
"OptionalArg: "
"Example: fx_setup_secondary_damage_effects();"
"SPMP: singleplayer"
///ScriptDocEnd
=============
*/
fx_setup_secondary_damage_effects()
{
if ( !getdvarint( "r_reflectionProbeGenerate" ) )
{
for ( i = 0; i < level._createFXent.size; i++ )
{
ent = level._createFXent[ i ];
if ( ent.v[ "type" ] == "exploder" )
{
if (string_starts_with(ent.v[ "fxid" ], "nx_fx_react") )
{
thread fx_secondary_damage_trigger( ent ); // setup the trigger on this createfx entity
}
}
}
}
thread setup_reactive_animated_models();
}
#using_animtree( "animated_props" );
setup_reactive_animated_models()
{
if ( !getdvarint( "r_reflectionProbeGenerate" ) )
{
reactive_models = GetEntArray( "reactive_animated_model", "targetname" );
/* for ( i=0; i<reactive_models.size; i++ )
{
reactive_models[i].animname = level._anim_prop_models[ reactive_models[i].model ][ "idle" ];
reactive_models[i] assign_animtree();
}
anim_rate = 0.5;
*/
for ( i=0; i<reactive_models.size; i++ )
{
// wait running_offset;
// reactive_models[i] SetAnim( reactive_models[i] getAnim("nx_pinetree_react0_idle"), 0.5, 0.1, 0.2); //(RandomFloat(0.5) + 0.5));
// reactive_models[i] SetAnimRestart( self getAnim("nx_pinetree_react0_static"), static_weight, blend_to_time, anim_speed);
reactive_models[i] thread fx_secondary_damage_anim_trigger();
}
}
}
// to do:
// + take into account the local rotation of the tree
// + re-reig with fewer trunk bones and some branch bones
// + 3 idles of varying intensity for general wind
// + adjust strength of bend based on distance
// + notetracks for bending when we want dust and such to come off
// + dust tag arrays
// + bird tag arrays
// + leaves tag arrays
// + effect names for these tag arrays
#using_animtree( "animated_props" );
fx_secondary_damage_anim_trigger()
{
bDebug = false; // debug locations
model = self.model;
if (bDebug)
thread draw_circle_until_notify( self.origin, 10, 1, 1, 1, self, "stop_drawing_circle" );
// Make it damageable
self setCanDamage( true );
self SetCanRadiusDamage( true );
while( true )
{
self UseAnimTree( #animtree );
keys = GetArrayKeys( level._anim_prop_models[ model ][ "anims" ] );
animkey = keys[0]; // idle
// animkey = keys[ RandomInt( keys.size ) ];
animation = level._anim_prop_models[ model ][ "anims" ][ animkey ];
self SetAnimRestart( animation, 1, 1, 0.33 );
//self SetAnimTime( animation, RandomFloatRange( 0, 1 ) );
// iprintln ("start waiting ...");
self waittill( "damage", damage, attacker, direction_vec, point, damageType, modelName, tagName );
if (bDebug)
IPrintLn( "damage!" );
// iprintln ("Damage Type : " + damageType );
wait_timer = 0;
damage_speed = 0;
delay_mult = 0.0; // delay factor to mult against distance and use for the wait timer.
// ********************************************************
// speeds of concussive forces
// speed of sound (for reference) = 13512 inches per second
// dynamite = 11811 inches/second
// c4 = 354331 inches/second
// ********************************************************
switch( damageType )
{
case "mod_melee":
case "mod_crush":
case "melee":
case "mod_pistol_bullet":
case "mod_rifle_bullet":
case "bullet":
case "mod_grenade":
case "MOD_GRENADE_SPLASH":
damage_speed = 11811; // dynamite
break;
case "mod_projectile":
case "mod_projectile_splash":
case "mod_explosive":
case "c4":
damage_speed = 354331; // c4
break;
case "splash":
damage_speed = 11811; // dynamite
break;
case "mod_impact":
case "unknown":
default:
break;
}
// iprintln ("Ds " + damage_speed );
if ( damage_speed > 0 )
{
// Get distance from explosion to this fx origin
distance_from_damage = distance( point, self.origin ); // raw distance
wait_timer = (distance_from_damage / damage_speed); // time to wait
direction_vec = (self.origin - point);
dir_north = false;
dir_east = false;
direction_vec *= (1,1,0); // don't consider z for this
direction_vec = vectornormalize(direction_vec);
if (bDebug)
{
thread draw_line_for_time( self.origin, self.origin + (direction_vec * 200), 1, 1, 1, 10.0 );
//thread draw_line_for_time( self.origin, self.origin + (AnglesToForward(self.angles) * 50), 1, 0, 0, 10.0 );
//thread draw_line_for_time( self.origin, self.origin + (AnglesToRight(self.angles) * 50), 0, 1, 0, 10.0 );
//thread draw_line_for_time( self.origin, self.origin + (AnglesToUp(self.angles) * 50), 0, 0, 1, 10.0 );
thread draw_line_for_time( self.origin + (0,0,10), self.origin + (20,0,10), 1, 0, 0, 10.0 );
thread draw_line_for_time( self.origin + (0,0,10), self.origin + (0,20,10), 0, 1, 0, 10.0 );
thread draw_line_for_time( self.origin + (0,0,10), self.origin + (0,0, 30), 0, 0, 1, 10.0 );
}
if ( direction_vec[0] > 0 )
dir_east = true;
if ( direction_vec[1] > 0 )
dir_north = true;
// init weights
north_weight = 0;
east_weight = 0;
west_weight = 0;
south_weight = 0;
north_weight_angle = 0;
south_weight_angle = 0;
east_weight_angle = 0;
west_weight_angle = 0;
if (dir_north)
{
north_weight_angle = acos( VectorDot(direction_vec, (0,1,0)) );
} else {
south_weight_angle = acos( VectorDot(direction_vec, (0,-1,0)) );
}
if (dir_east)
{
east_weight_angle = acos( VectorDot(direction_vec, (1,0,0)) );
} else {
west_weight_angle = acos( VectorDot(direction_vec, (-1,0,0)) );
}
//north_weight_angle = acos( VectorDot(direction_vec, (0,1,0)) );
//south_weight_angle = acos( VectorDot(direction_vec, (0,-1,0)) );
//east_weight_angle = acos( VectorDot(direction_vec, (-1,0,0)) );
//west_weight_angle = acos( VectorDot(direction_vec, (1,0,0)) );
if (north_weight_angle > 90.0) {north_weight_angle = 0;}
if (south_weight_angle > 90.0) {south_weight_angle = 0;}
if (east_weight_angle > 90.0) {east_weight_angle = 0;}
if (west_weight_angle > 90.0) {west_weight_angle = 0;}
north_weight = (north_weight_angle / 90.0);
south_weight = (south_weight_angle / 90.0);
east_weight = (east_weight_angle / 90.0);
west_weight = (west_weight_angle / 90.0);
//if (bDebug)
// IPrintLn( ("weights: " + north_weight + ", " + south_weight + ", " + east_weight + ", " + west_weight));
anim_speed = 0.2;
blend_to_time = 0.02;
// calc weight for anim of the static (unmoving animation)
// we're dampening the amount of bend based on the distance from the explosion
static_weight = 0; // (wait_timer / 0.5);
dampen_amt = abs(1.0-static_weight);
wait (wait_timer * 2.5);
if ((north_weight > 0) && (east_weight > 0))
{
if (bDebug)
IPrintLn( ("NE: " + north_weight + ", " + east_weight + ":" + (north_weight + east_weight)));
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "static" ], static_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "north" ], north_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "east" ], east_weight, blend_to_time, anim_speed);
}
else if ((north_weight > 0) && (west_weight > 0))
{
if (bDebug)
IPrintLn( ("NW: " + north_weight + ", " + west_weight + ":" + (north_weight + west_weight)));
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "static" ], static_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "north" ], north_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "west" ], west_weight, blend_to_time, anim_speed);
}
else if ((south_weight > 0) && (east_weight > 0))
{
if (bDebug)
IPrintLn( ("SE: " + south_weight + ", " + east_weight + ":" + (south_weight + east_weight)));
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "static" ], static_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "south" ], south_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "east" ], east_weight, blend_to_time, anim_speed);
}
else if ((south_weight > 0) && (west_weight > 0))
{
if (bDebug)
IPrintLn( ("SW: " + south_weight + ", " + west_weight + ":" + (south_weight + west_weight)));
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "static" ], static_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "south" ], south_weight, blend_to_time, anim_speed);
self SetAnimRestart( level._anim_prop_models[ model ][ "anims" ][ "west" ], west_weight, blend_to_time, anim_speed);
}
// dust --------------------------------------------------------------------------------------------------------
chance_to_create_dust = level._anim_prop_models[ model ][ "dust_chance" ];
if (chance_to_create_dust > 0)
{
for (i=0; i<level._anim_prop_models[ model ][ "dust_tags" ].size; i++)
{
if (randomFloat(1.0) <= chance_to_create_dust)
{
tag_pos = self getTagOrigin( level._anim_prop_models[ model ][ "dust_tags" ][i] );
PlayFX( level._effect[ level._anim_prop_models[ model ][ "dust_fx" ] ], tag_pos, direction_vec, (0,0,1) );
}
}
}
// leaves --------------------------------------------------------------------------------------------------------
chance_to_create_dust = level._anim_prop_models[ model ][ "leaves_chance" ];
if (chance_to_create_dust > 0)
{
for (i=0; i<level._anim_prop_models[ model ][ "leaves_tags" ].size; i++)
{
if (randomFloat(1.0) <= chance_to_create_dust)
{
tag_pos = self getTagOrigin( level._anim_prop_models[ model ][ "leaves_tags" ][i] );
PlayFX( level._effect[ level._anim_prop_models[ model ][ "leaves_fx" ] ], tag_pos, direction_vec, (0,0,1) );
}
}
}
// birds --------------------------------------------------------------------------------------------------------
chance_to_create_dust = level._anim_prop_models[ model ][ "birds_chance" ];
if (chance_to_create_dust > 0)
{
for (i=0; i<level._anim_prop_models[ model ][ "birds_tags" ].size; i++)
{
if (randomFloat(1.0) <= chance_to_create_dust)
{
tag_pos = self getTagOrigin( level._anim_prop_models[ model ][ "birds_tags" ][i] );
PlayFX( level._effect[ level._anim_prop_models[ model ][ "birds_fx" ] ], tag_pos, direction_vec, (0,0,1) );
}
}
}
}
wait 0.2; // wait for reset
}
}

1623
common_scripts/_sentry.gsc Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,347 @@
#include maps\_hud_util;
#include common_scripts\utility;
//*******************************************************************
// *
// *
//*******************************************************************
/*
=============
///ScriptDocBegin
"Name: viewmodel_create_ammo_counter()"
"Summary: create client hud elements to be applied to weapon view model"
"Module: Utility"
"CallOn: nothing"
"MandatoryArg:"
"Example: viewmodel_create_ammo_counter();"
"SPMP: singleplayer"
///ScriptDocEnd
=============
*/
viewmodel_apply_ui( weapon_name )
{
// always cleanup our old stuff first
// cleanup our update functions
self notify( "viewmodel_ui_update" );
// cleanup our old weapons stuff, value for _viewmodel_ui_weapon should already be set
if ( level._viewmodel_ui_weapon != "" )
{
[[ level._viewmodel_ui[ level._viewmodel_ui_weapon ][ 0 ] ]]();
}
// now we create our new stuff
if ( weapon_name != "" )
{
// set our weapon for create process and subsequent destroy
level._viewmodel_ui_weapon = weapon_name;
// create all of our elements
[[ level._viewmodel_ui[ level._viewmodel_ui_weapon ][ 1 ] ]]();
// thread our update functions
self thread viewmodel_magazine_ammo_update();
self thread viewmodel_reserve_ammo_update();
self thread viewmodel_range_update();
}
}
//*******************************************************************
// *
// *
//*******************************************************************
viewmodel_ui_setup()
{
// dvar used to help see where you elements are currently placed. Usefull when working on UV mapping
//SetSavedDvar( "r_drawUiTextureOverlay", "1" );
// make sure everything is setup properly
if ( !IsDefined( level._viewmodel_ui_weapon ) )
{
level._viewmodel_ui_weapon = "";
}
// tagMJS<TODO> we should move all our assets into the GDT entry
// so we don't make our common.csv file larger than it needs to be
// make sure all our assets are loaded
viewmodel_precache_assets();
// add to our level array all our needed functions
viewmodel_add_create_and_destroy_functions();
}
//*******************************************************************
// *
// *
//*******************************************************************
viewmodel_precache_assets()
{
// need this icon precached for viewmodel ui
PreCacheShader( "ammo_counter_med" );
}
//*******************************************************************
// *
// *
//*******************************************************************
viewmodel_add_create_and_destroy_functions()
{
level._viewmodel_ui[ "lunarrifle" ][ 0 ] = ::cleanup_lunarrifle_ui_elements;
level._viewmodel_ui[ "lunarrifle" ][ 1 ] = ::setup_lunarrifle_ui_elements;
level._viewmodel_ui[ "glo_reflex_mp" ][ 0 ] = ::delete_glo_ui_elements;
level._viewmodel_ui[ "glo_reflex_mp" ][ 1 ] = ::create_glo_ui_elements;
}
//*******************************************************************
// *
// *
//*******************************************************************
viewmodel_magazine_ammo_update()
{
self endon( "viewmodel_ui_update" );
magazine_size = level._player GetMagazineMaxAmmoCount( level._viewmodel_ui_weapon );
while( 1 )
{
remaining = level._player GetMagazineAmmoCount( level._viewmodel_ui_weapon );
if ( IsDefined( level.magazine_counter ) )
{
// update lens count
//level.ammo_counter SetText( " " + level._player getmagazineammocount( level._viewmodel_ui_weapon ) + "/" + level._player getmagazinemaxammocount( level._viewmodel_ui_weapon ) );
level.magazine_counter SetText( remaining );
}
if ( IsDefined( level.magazine_pips ) )
{
// update frame pips
for( index = 0; index < magazine_size; index++ )
{
if ( index < remaining )
{
level.magazine_pips[index].color = ( 1.0, 1.0, 1.0 );
}
else
{
level.magazine_pips[index].color = ( 0.35, 0.35, 0.35 );
}
}
}
wait( 0.05 );
}
}
//*******************************************************************
// *
// *
//*******************************************************************
viewmodel_reserve_ammo_update()
{
self endon( "viewmodel_ui_update" );
if( IsDefined( level.reserve_counter ) )
{
while( 1 )
{
level.reserve_counter SetText( level._player GetAmmoCount( level._viewmodel_ui_weapon ) - level._player GetMagazineAmmoCount( level._viewmodel_ui_weapon ) );
wait( 0.05 );
}
}
}
//*******************************************************************
// *
// *
//*******************************************************************
viewmodel_range_update()
{
self endon( "viewmodel_ui_update" );
if( IsDefined( level.range_display ) )
{
while( 1 )
{
eye = self geteye();
angles = self getplayerangles();
forward = anglestoforward( angles );
end = eye + vector_multiply( forward, 7000 );
trace = bullettrace( eye, end, true, self );
level.range_display SetText( int( distance( level._player.origin, trace["position"] ) * ( 100 / 39.37 ) ) / 100 );
wait( 0.33 );
}
}
}
//*******************************************************************
// *
// *
//*******************************************************************
// Create and Destroy Functions below here
// Please
// -MJS
//*******************************************************************
// *
// *
//*******************************************************************
setup_lunarrifle_ui_elements()
{
level.reserve_counter = newClientHudElem( level._player );
level.reserve_counter.elemType = "font";
level.reserve_counter.font = "hudbig";
level.reserve_counter.sort = 50;
level.reserve_counter.pre3d = true;
level.reserve_counter.horzAlign = "fullscreen";
level.reserve_counter.vertAlign = "fullscreen";
level.reserve_counter.alpha = 1;
level.reserve_counter.alignX = "center";
level.reserve_counter.alignY = "top";
level.reserve_counter.fontScale = 38;
level.reserve_counter.x = 3900;
level.reserve_counter.y = 768;
level.reserve_counter.color = ( 1.0, 1.0, 1.0 );
level.magazine_counter = newClientHudElem( level._player );
level.magazine_counter.elemType = "font";
level.magazine_counter.font = "hudbig";
level.magazine_counter.sort = 50;
level.magazine_counter.pre3d = true;
level.magazine_counter.horzAlign = "fullscreen";
level.magazine_counter.vertAlign = "fullscreen";
level.magazine_counter.alpha = 1;
level.magazine_counter.alignX = "center";
level.magazine_counter.alignY = "top";
level.magazine_counter.fontScale = 64;
level.magazine_counter.x = 1385;
level.magazine_counter.y = -192;
level.magazine_counter.color = ( 1.0, 0.35, 0.35 );
magazine_size = level._player GetMagazineMaxAmmoCount( level._viewmodel_ui_weapon );
level.magazine_pips = [];
spacing = 320;
for( index = 0; index < magazine_size; index++ )
{
level.magazine_pips[index] = createIcon( "ammo_counter_med", 512, 2048 );
level.magazine_pips[index].x = ( 6050 - ( spacing * index ) );
level.magazine_pips[index].y = 1536;
level.magazine_pips[index].pre3d = true;
}
}
//*******************************************************************
// *
// *
//*******************************************************************
cleanup_lunarrifle_ui_elements()
{
if ( IsDefined( level.reserve_counter ) )
{
level.reserve_counter Destroy();
level.reserve_counter = undefined;
}
if ( IsDefined( level.magazine_counter ) )
{
level.magazine_counter Destroy();
level.magazine_counter = undefined;
}
if ( IsDefined( level.magazine_pips ) )
{
magazine_size = level.magazine_pips.size;
for( index = 0; index < magazine_size; index++ )
{
level.magazine_pips[index] Destroy();
}
level.magazine_pips = undefined;
}
}
//*******************************************************************
// *
// *
//*******************************************************************
delete_glo_ui_elements()
{
if ( IsDefined( level.magazine_counter ) )
{
level.magazine_counter Destroy();
level.magazine_counter = undefined;
}
if ( IsDefined( level.range_display ) )
{
level.range_display Destroy();
level.range_display = undefined;
}
}
//*******************************************************************
// *
// *
//*******************************************************************
create_glo_ui_elements()
{
level.magazine_counter = newClientHudElem( level._player );
level.magazine_counter.elemType = "font";
level.magazine_counter.font = "hudbig";
level.magazine_counter.sort = 50;
level.magazine_counter.pre3d = true;
level.magazine_counter.horzAlign = "fullscreen";
level.magazine_counter.vertAlign = "fullscreen";
level.magazine_counter.alpha = 1;
level.magazine_counter.alignX = "center";
level.magazine_counter.alignY = "top";
level.magazine_counter.fontScale = 80;
level.magazine_counter.x = 3000;
level.magazine_counter.y = 400;
level.magazine_counter.color = ( 0.0, 0.941176471, 1.0 );
level.range_display = newClientHudElem( level._player );
level.range_display.elemType = "font";
level.range_display.font = "hudbig";
level.range_display.sort = 50;
level.range_display.pre3d = true;
level.range_display.horzAlign = "fullscreen";
level.range_display.vertAlign = "fullscreen";
level.range_display.alpha = 1;
level.range_display.alignX = "center";
level.range_display.alignY = "top";
level.range_display.fontScale = 32;
level.range_display.x = 2500;
level.range_display.y = -64;
level.range_display.color = ( 0.0, 0.941176471, 1.0 );
}
//*******************************************************************
// *
// *
//*******************************************************************