Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
3.1 KiB

7 years ago
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
* Use, distribution, and modification of this source code and/or resulting
* object code is restricted to non-commercial enhancements to products from
* Valve LLC. All other use, distribution, or modification is prohibited
* without written permission from Valve LLC.
*
****/
#pragma once
7 years ago
#ifndef FUNC_BREAK_H
#define FUNC_BREAK_H
8 years ago
typedef enum
{
expRandom,
expDirected
} Explosions;
typedef enum
{
matGlass = 0,
matWood,
matMetal,
matFlesh,
matCinderBlock,
matCeilingTile,
matComputer,
matUnbreakableGlass,
matRocks,
matNone,
matLastMaterial
} Materials;
7 years ago
#define NUM_SHARDS 6 // this many shards spawned when breakable objects break;
class CBreakable : public CBaseDelay
{
public:
// basic functions
void Spawn( void );
void Precache( void );
void KeyValue( KeyValueData* pkvd);
void EXPORT BreakTouch( CBaseEntity *pOther );
void EXPORT BreakUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT RespawnUse( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void EXPORT RespawnThink( void );
void EXPORT RespawnFadeThink( void );
void DamageSound( void );
virtual int Classify ( void ) { return m_iClass; }
// breakables use an overridden takedamage
8 years ago
virtual int TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType );
7 years ago
// To spark when hit
void TraceAttack( entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType );
BOOL IsBreakable( void );
BOOL SparkWhenHit( void );
STATE GetState( void );
8 years ago
int DamageDecal( int bitsDamageType );
7 years ago
8 years ago
void EXPORT Die( void );
virtual int ObjectCaps( void ) { return ( CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION ); }
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );
7 years ago
8 years ago
inline BOOL Explodable( void ) { return ExplosionMagnitude() > 0; }
inline int ExplosionMagnitude( void ) { return pev->impulse; }
inline void ExplosionSetMagnitude( int magnitude ) { pev->impulse = magnitude; }
7 years ago
static void MaterialSoundPrecache( Materials precacheMaterial );
static void MaterialSoundRandom( edict_t *pEdict, Materials soundMaterial, float volume );
static const char **MaterialSoundList( Materials precacheMaterial, int &soundCount );
static const char *pSoundsWood[];
static const char *pSoundsFlesh[];
static const char *pSoundsGlass[];
static const char *pSoundsMetal[];
static const char *pSoundsConcrete[];
static const char *pSpawnObjects[];
8 years ago
static TYPEDESCRIPTION m_SaveData[];
7 years ago
8 years ago
Materials m_Material;
Explosions m_Explosion;
int m_idShard;
float m_angle;
string_t m_iszGibModel;
string_t m_iszSpawnObject;
7 years ago
//LRC
int m_iRespawnTime;
int m_iInitialHealth;
int m_iInitialRenderAmt;
int m_iInitialRenderMode;
int m_iClass; //so that monsters will attack it
int m_iszWhenHit; // locus trigger
CPointEntity *m_pHitProxy;
};
#endif // FUNC_BREAK_H