upload "kind" alien swarm

This commit is contained in:
nillerusr
2023-10-03 17:23:56 +03:00
parent b7bd94c52e
commit 7d3c0d8b5a
4229 changed files with 462900 additions and 495155 deletions
+40 -166
View File
@@ -1,4 +1,4 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
//
// Purpose: Implements breakables and pushables. func_breakable is a bmodel
// that breaks into pieces after taking damage.
@@ -22,21 +22,14 @@
#include "physics_impact_damage.h"
#include "tier0/icommandline.h"
#ifdef PORTAL
#include "portal_shareddefs.h"
#include "portal_util_shared.h"
#include "prop_portal_shared.h"
#endif
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
ConVar func_break_max_pieces( "func_break_max_pieces", "15", FCVAR_ARCHIVE | FCVAR_REPLICATED );
ConVar func_break_reduction_factor( "func_break_reduction_factor", ".5" );
#ifdef HL1_DLL
extern void PlayerPickupObject( CBasePlayer *pPlayer, CBaseEntity *pObject );
#endif
extern ConVar breakable_disable_gib_limit;
extern Vector g_vecAttackDir;
@@ -44,65 +37,36 @@ extern Vector g_vecAttackDir;
// This is done instead of just a classname in the FGD so we can control which entities can
// be spawned, and still remain fairly flexible
#ifndef HL1_DLL
const char *CBreakable::pSpawnObjects[] =
{
NULL, // 0
"item_battery", // 1
"item_healthkit", // 2
"item_ammo_pistol", // 3
"item_ammo_pistol_large", // 4
"item_ammo_smg1", // 5
"item_ammo_smg1_large", // 6
"item_ammo_ar2", // 7
"item_ammo_ar2_large", // 8
"item_box_buckshot", // 9
"item_flare_round", // 10
"item_box_flare_rounds", // 11
"item_rpg_round", // 12
"unused (item_smg1_grenade) 13",// 13
"item_box_sniper_rounds", // 14
"unused (???"") 15", // 15 - split into two strings to avoid trigraph warning
"weapon_stunstick", // 16
"unused (weapon_ar1) 17", // 17
"weapon_ar2", // 18
"unused (???"") 19", // 19 - split into two strings to avoid trigraph warning
"weapon_rpg", // 20
"weapon_smg1", // 21
"unused (weapon_smg2) 22", // 22
"unused (weapon_slam) 23", // 23
"weapon_shotgun", // 24
"unused (weapon_molotov) 25",// 25
"item_dynamic_resupply", // 26
};
#else
// Half-Life 1 spawn objects!
const char *CBreakable::pSpawnObjects[] =
{
NULL, // 0
"item_battery", // 1
"item_healthkit", // 2
"weapon_glock", // 3
"ammo_9mmclip", // 4
"weapon_mp5", // 5
"ammo_9mmAR", // 6
"ammo_ARgrenades", // 7
"weapon_shotgun", // 8
"ammo_buckshot", // 9
"weapon_crossbow", // 10
"ammo_crossbow", // 11
"weapon_357", // 12
"ammo_357", // 13
"weapon_rpg", // 14
"ammo_rpgclip", // 15
"ammo_gaussclip", // 16
"weapon_handgrenade",// 17
"weapon_tripmine", // 18
"weapon_satchel", // 19
"weapon_snark", // 20
"weapon_hornetgun", // 21
};
#endif
const char *CBreakable::pSpawnObjects[] =
{
NULL, // 0
"item_battery", // 1
"item_healthkit", // 2
"item_ammo_pistol", // 3
"item_ammo_pistol_large", // 4
"item_ammo_smg1", // 5
"item_ammo_smg1_large", // 6
"item_ammo_ar2", // 7
"item_ammo_ar2_large", // 8
"item_box_buckshot", // 9
"item_flare_round", // 10
"item_box_flare_rounds", // 11
"item_rpg_round", // 12
"unused (item_smg1_grenade) 13",// 13
"item_box_sniper_rounds", // 14
"unused (???) 15", // 15
"weapon_stunstick", // 16
"unused (weapon_ar1) 17", // 17
"weapon_ar2", // 18
"unused (???) 19", // 19
"weapon_rpg", // 20
"weapon_smg1", // 21
"unused (weapon_smg2) 22", // 22
"unused (weapon_slam) 23", // 23
"weapon_shotgun", // 24
"unused (weapon_molotov) 25",// 25
"item_dynamic_resupply", // 26
};
const char *pFGDPropData[] =
{
@@ -143,7 +107,6 @@ BEGIN_DATADESC( CBreakable )
// Don't need to save/restore these because we precache after restore
//DEFINE_FIELD( m_idShard, FIELD_INTEGER ),
DEFINE_FIELD( m_angle, FIELD_FLOAT ),
DEFINE_FIELD( m_iszGibModel, FIELD_STRING ),
DEFINE_FIELD( m_iszSpawnObject, FIELD_STRING ),
DEFINE_KEYFIELD( m_ExplosionMagnitude, FIELD_INTEGER, "explodemagnitude" ),
@@ -171,6 +134,7 @@ BEGIN_DATADESC( CBreakable )
DEFINE_FIELD( m_flDmgModBullet, FIELD_FLOAT ),
DEFINE_FIELD( m_flDmgModClub, FIELD_FLOAT ),
DEFINE_FIELD( m_flDmgModExplosive, FIELD_FLOAT ),
DEFINE_FIELD( m_flDmgModFire, FIELD_FLOAT ),
DEFINE_FIELD( m_iszPhysicsDamageTableName, FIELD_STRING ),
DEFINE_FIELD( m_iszBreakableModel, FIELD_STRING ),
DEFINE_FIELD( m_iBreakableSkin, FIELD_INTEGER ),
@@ -254,6 +218,7 @@ void CBreakable::Spawn( void )
m_flDmgModBullet = func_breakdmg_bullet.GetFloat();
m_flDmgModClub = func_breakdmg_club.GetFloat();
m_flDmgModExplosive = func_breakdmg_explosive.GetFloat();
m_flDmgModFire = 1.0f;
ParsePropData();
@@ -279,10 +244,6 @@ void CBreakable::Spawn( void )
SetSolid( SOLID_BSP );
SetMoveType( MOVETYPE_PUSH );
// this is a hack to shoot the gibs in a specific yaw/direction
m_angle = GetLocalAngles().y;
SetLocalAngles( vec3_angle );
SetModel( STRING( GetModelName() ) );//set size and link into world.
SetTouch( &CBreakable::BreakTouch );
@@ -406,32 +367,9 @@ void CBreakable::Precache( void )
pGibName = "ConcreteChunks";
break;
#ifdef HL1_DLL
case matComputer:
pGibName = "ComputerGibs";
break;
case matCeilingTile:
pGibName = "CeilingTile";
break;
case matFlesh:
pGibName = "FleshGibs";
break;
case matCinderBlock:
pGibName = "CinderBlocks";
break;
case matWeb:
pGibName = "WebGibs";
break;
#else
case matCinderBlock:
pGibName = "ConcreteChunks";
break;
#endif
#if HL2_EPISODIC
case matNone:
@@ -448,10 +386,6 @@ void CBreakable::Precache( void )
if ( m_iszGibModel != NULL_STRING )
{
pGibName = STRING(m_iszGibModel);
#ifdef HL1_DLL
PrecacheModel( pGibName );
#endif
}
m_iszModelName = MAKE_STRING( pGibName );
@@ -501,7 +435,7 @@ void CBreakable::DamageSound( void )
{
int pitch;
float fvol;
const char *soundname = NULL;
char *soundname = NULL;
int material = m_Material;
if (random->RandomInt(0,2))
@@ -690,7 +624,7 @@ bool CBreakable::UpdateHealth( int iNewHealth, CBaseEntity *pActivator )
}
// Output the new health as a percentage of max health [0..1]
float flRatio = clamp( (float)m_iHealth / (float)m_iMaxHealth, 0.f, 1.f );
float flRatio = clamp( (float)m_iHealth / (float)m_iMaxHealth, 0, 1 );
m_OnHealthChanged.Set( flRatio, pActivator, this );
if ( m_iHealth <= 0 )
@@ -724,16 +658,13 @@ void CBreakable::Break( CBaseEntity *pBreaker )
{
if ( IsBreakable() )
{
QAngle angles = GetLocalAngles();
angles.y = m_angle;
SetLocalAngles( angles );
m_hBreaker = pBreaker;
Die();
}
}
void CBreakable::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr, CDmgAccumulator *pAccumulator )
void CBreakable::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir, trace_t *ptr )
{
// random spark if this is a 'computer' object
if (random->RandomInt(0,1) )
@@ -754,7 +685,7 @@ void CBreakable::TraceAttack( const CTakeDamageInfo &info, const Vector &vecDir,
}
}
BaseClass::TraceAttack( info, vecDir, ptr, pAccumulator );
BaseClass::TraceAttack( info, vecDir, ptr );
}
@@ -889,30 +820,7 @@ void CBreakable::ResetOnGroundFlags(void)
}
}
#ifdef PORTAL
// !!! HACK This should work!
// Tell touching portals to fizzle
int iPortalCount = CProp_Portal_Shared::AllPortals.Count();
if( iPortalCount != 0 )
{
Vector vMin, vMax;
CollisionProp()->WorldSpaceAABB( &vMin, &vMax );
Vector vBoxCenter = ( vMin + vMax ) * 0.5f;
Vector vBoxExtents = ( vMax - vMin ) * 0.5f;
CProp_Portal **pPortals = CProp_Portal_Shared::AllPortals.Base();
for( int i = 0; i != iPortalCount; ++i )
{
CProp_Portal *pTempPortal = pPortals[i];
if( UTIL_IsBoxIntersectingPortal( vBoxCenter, vBoxExtents, pTempPortal ) )
{
pTempPortal->DoFizzleEffect( PORTAL_FIZZLE_KILLED, false );
pTempPortal->Fizzle();
}
}
}
#endif
}
@@ -936,7 +844,7 @@ void CBreakable::Die( void )
// The more negative m_iHealth, the louder
// the sound should be.
fvol = random->RandomFloat(0.85, 1.0) + (abs(m_iHealth) / 100.0);
fvol = random->RandomFloat(0.85, 1.0) + (abs(m_iHealth.Get()) / 100.0);
if (fvol > 1.0)
{
fvol = 1.0;
@@ -1054,7 +962,6 @@ void CBreakable::Die( void )
iCount = func_break_max_pieces.GetInt();
}
ConVarRef breakable_disable_gib_limit( "breakable_disable_gib_limit" );
if ( !breakable_disable_gib_limit.GetBool() && iCount )
{
if ( m_PerformanceMode == PM_NO_GIBS )
@@ -1072,19 +979,6 @@ void CBreakable::Die( void )
{
for ( int i = 0; i < iCount; i++ )
{
#ifdef HL1_DLL
// Use the passed model instead of the propdata type
const char *modelName = STRING( m_iszModelName );
// if the map specifies a model by name
if( strstr( modelName, ".mdl" ) != NULL )
{
iModelIndex = modelinfo->GetModelIndex( modelName );
}
else // do the hl2 / normal way
#endif
iModelIndex = modelinfo->GetModelIndex( g_PropDataSystem.GetRandomChunkModel( STRING( m_iszModelName ) ) );
// All objects except the first one in this run are marked as slaves...
@@ -1249,11 +1143,6 @@ void CPushable::Spawn( void )
CreateVPhysics();
}
#ifdef HL1_DLL
// Force HL1 Pushables to stay axially aligned.
VPhysicsGetObject()->SetInertia( Vector( 3.f, 3.f, 3.f ) );
#endif//HL1_DLL
}
@@ -1274,22 +1163,7 @@ bool CPushable::CreateVPhysics( void )
// Pull the func_pushable
void CPushable::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
#ifdef HL1_DLL
if( m_spawnflags & SF_PUSH_NO_USE )
return;
// Allow pushables to be dragged by player
CBasePlayer *pPlayer = ToBasePlayer( pActivator );
if ( pPlayer )
{
if ( useType == USE_ON )
{
PlayerPickupObject( pPlayer, this );
}
}
#else
BaseClass::Use( pActivator, pCaller, useType, value );
#endif
}