blob: 6bdea85d21bc351a06b2040c304b3097bf569e72 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
//=============================================================================
#ifndef ECON_WEARABLE_H
#define ECON_WEARABLE_H
#ifdef _WIN32
#pragma once
#endif
#include "econ_entity.h"
enum
{
MAX_WEARABLES_SENT_FROM_SERVER =
#ifdef LOADOUT_MAX_WEARABLES_COUNT // we actually do want to just check for macro definition here -- undefined means "fall back to whatever default"
LOADOUT_MAX_WEARABLES_COUNT
#else
8 // hard-coded constant to match old behavior
#endif
};
#if defined( CLIENT_DLL )
#define CEconWearable C_EconWearable
#define CTFWearableItem C_TFWearableItem
#endif
enum
{
ITEM_DROP_TYPE_NULL,
ITEM_DROP_TYPE_NONE,
ITEM_DROP_TYPE_DROP,
ITEM_DROP_TYPE_BREAK,
};
class CEconWearable : public CEconEntity
{
DECLARE_CLASS( CEconWearable, CEconEntity );
public:
DECLARE_NETWORKCLASS();
DECLARE_DATADESC();
CEconWearable();
virtual bool IsWearable( void ) const { return true; }
// Shared
virtual void Spawn( void );
virtual void GiveTo( CBaseEntity *pOther );
virtual void RemoveFrom( CBaseEntity *pOther );
virtual bool CanEquip( CBaseEntity *pOther ) { return true; }
virtual void Equip( CBasePlayer *pOwner );
virtual void UnEquip( CBasePlayer* pOwner );
virtual void OnWearerDeath( void );
virtual int GetDropType( void );
// virtual bool UpdateBodygroups( CBasePlayer* pOwner, int iState );
void SetAlwaysAllow( bool bVal ) { m_bAlwaysAllow = bVal; }
bool AlwaysAllow( void ) { return m_bAlwaysAllow; }
virtual bool IsViewModelWearable( void ) { return false; }
// Server
#if defined( GAME_DLL )
#endif
// Client
#if defined( CLIENT_DLL )
virtual ShadowType_t ShadowCastType() OVERRIDE;
virtual bool ShouldDraw();
virtual bool ShouldDrawWhenPlayerIsDead() { return true; }
virtual void OnDataChanged( DataUpdateType_t updateType );
virtual void ClientThink( void );
virtual bool ShouldDrawParticleSystems( void );
virtual RenderGroup_t GetRenderGroup();
#endif
virtual int GetSkin( void );
// Static
static void UpdateWearableBodyGroups( CBasePlayer *pPlayer );
protected:
virtual void InternalSetPlayerDisplayModel( void );
private:
bool m_bAlwaysAllow; // Wearable will not be removed by ManageRegularWeapons. Only use this for wearables managed by other items!
};
//-----------------------------------------------------------------------------
// Purpose: For backwards compatibility with older demos
//-----------------------------------------------------------------------------
class CTFWearableItem : public CEconWearable
{
DECLARE_CLASS( CTFWearableItem, CEconWearable );
public:
DECLARE_NETWORKCLASS();
DECLARE_DATADESC();
CTFWearableItem();
};
#ifdef CLIENT_DLL
// Clientside wearable physics props. Used to have wearables fall off dying players.
class C_EconWearableGib : public CEconEntity
{
DECLARE_CLASS( C_EconWearableGib, CEconEntity );
public:
C_EconWearableGib();
~C_EconWearableGib();
bool Initialize( bool bWillBeParented );
bool FinishModelInitialization( void );
virtual CStudioHdr *OnNewModel( void );
virtual bool ValidateEntityAttachedToPlayer( bool &bShouldRetry );
virtual void SpawnClientEntity();
virtual void Spawn();
virtual void ClientThink( void );
void StartFadeOut( float fDelay );
virtual void ImpactTrace( trace_t *pTrace, int iDamageType, const char *pCustomImpactName );
virtual CollideType_t GetCollideType( void ) { return ENTITY_SHOULD_RESPOND; }
bool UpdateThinkState( void );
private:
bool m_bParented;
bool m_bDelayedInit;
float m_fDeathTime; // Point at which this object self destructs.
// The default of -1 indicates the object shouldn't destruct.
};
#endif
#endif // ECON_WEARABLE_H
|