Move more code into headers

Make sure everything I need to call in my other mod is accessible. I want these simple edits in the base game.
This commit is contained in:
Chris Roxby 2016-07-24 16:26:10 -04:00
parent f1dcf496e4
commit 9ce0f0f0bb
7 changed files with 164 additions and 155 deletions

View file

@ -6,41 +6,11 @@
#include "cbase.h"
#include "shareddefs.h"
#include "env_screenoverlay.h"
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CEnvScreenOverlay : public CPointEntity
{
DECLARE_CLASS( CEnvScreenOverlay, CPointEntity );
public:
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
CEnvScreenOverlay();
// Always transmit to clients
virtual int UpdateTransmitState();
virtual void Spawn( void );
virtual void Precache( void );
void InputStartOverlay( inputdata_t &inputdata );
void InputStopOverlay( inputdata_t &inputdata );
void InputSwitchOverlay( inputdata_t &inputdata );
void SetActive( bool bActive ) { m_bIsActive = bActive; }
protected:
CNetworkArray( string_t, m_iszOverlayNames, MAX_SCREEN_OVERLAYS );
CNetworkArray( float, m_flOverlayTimes, MAX_SCREEN_OVERLAYS );
CNetworkVar( float, m_flStartTime );
CNetworkVar( int, m_iDesiredOverlay );
CNetworkVar( bool, m_bIsActive );
};
LINK_ENTITY_TO_CLASS( env_screenoverlay, CEnvScreenOverlay );
BEGIN_DATADESC( CEnvScreenOverlay )
@ -193,28 +163,6 @@ void CEnvScreenOverlay::InputStopOverlay( inputdata_t &inputdata )
//
// ====================================================================================
class CEnvScreenEffect : public CPointEntity
{
DECLARE_CLASS( CEnvScreenEffect, CPointEntity );
public:
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
// We always want to be sent to the client
CEnvScreenEffect( void ) { AddEFlags( EFL_FORCE_CHECK_TRANSMIT ); }
virtual int UpdateTransmitState( void ) { return SetTransmitState( FL_EDICT_ALWAYS ); }
virtual void Spawn( void );
virtual void Precache( void );
private:
void InputStartEffect( inputdata_t &inputdata );
void InputStopEffect( inputdata_t &inputdata );
CNetworkVar( float, m_flDuration );
CNetworkVar( int, m_nType );
};
LINK_ENTITY_TO_CLASS( env_screeneffect, CEnvScreenEffect );
// CEnvScreenEffect

View file

@ -0,0 +1,71 @@
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: Entity to control screen overlays on a player
//
//=============================================================================//
#ifndef ENVSCREENOVERLAY_H
#define ENVSCREENOVERLAY_H
#ifdef _WIN32
#pragma once
#endif
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CEnvScreenOverlay : public CPointEntity
{
DECLARE_CLASS(CEnvScreenOverlay, CPointEntity);
public:
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
CEnvScreenOverlay();
// Always transmit to clients
virtual int UpdateTransmitState();
virtual void Spawn(void);
virtual void Precache(void);
void InputStartOverlay(inputdata_t &inputdata);
void InputStopOverlay(inputdata_t &inputdata);
void InputSwitchOverlay(inputdata_t &inputdata);
void SetActive(bool bActive) { m_bIsActive = bActive; }
protected:
CNetworkArray(string_t, m_iszOverlayNames, MAX_SCREEN_OVERLAYS);
CNetworkArray(float, m_flOverlayTimes, MAX_SCREEN_OVERLAYS);
CNetworkVar(float, m_flStartTime);
CNetworkVar(int, m_iDesiredOverlay);
CNetworkVar(bool, m_bIsActive);
};
// ====================================================================================
//
// Screen-space effects
//
// ====================================================================================
class CEnvScreenEffect : public CPointEntity
{
DECLARE_CLASS(CEnvScreenEffect, CPointEntity);
public:
DECLARE_DATADESC();
DECLARE_SERVERCLASS();
// We always want to be sent to the client
CEnvScreenEffect(void) { AddEFlags(EFL_FORCE_CHECK_TRANSMIT); }
virtual int UpdateTransmitState(void) { return SetTransmitState(FL_EDICT_ALWAYS); }
virtual void Spawn(void);
virtual void Precache(void);
private:
void InputStartEffect(inputdata_t &inputdata);
void InputStopEffect(inputdata_t &inputdata);
CNetworkVar(float, m_flDuration);
CNetworkVar(int, m_nType);
};
#endif // ENVSCREENOVERLAY_H

View file

@ -357,26 +357,6 @@ END_DATADESC()
// ###################################################################
// > FilterDamageType
// ###################################################################
class FilterDamageType : public CBaseFilter
{
DECLARE_CLASS( FilterDamageType, CBaseFilter );
DECLARE_DATADESC();
protected:
bool PassesFilterImpl(CBaseEntity *pCaller, CBaseEntity *pEntity )
{
ASSERT( false );
return true;
}
bool PassesDamageFilterImpl(const CTakeDamageInfo &info)
{
return info.GetDamageType() == m_iDamageType;
}
int m_iDamageType;
};
LINK_ENTITY_TO_CLASS( filter_damage_type, FilterDamageType );

View file

@ -57,4 +57,29 @@ protected:
virtual bool PassesDamageFilterImpl(const CTakeDamageInfo &info);
};
// ###################################################################
// > FilterDamageType
// ###################################################################
class FilterDamageType : public CBaseFilter
{
DECLARE_CLASS(FilterDamageType, CBaseFilter);
DECLARE_DATADESC();
protected:
bool PassesFilterImpl(CBaseEntity *pCaller, CBaseEntity *pEntity)
{
ASSERT(false);
return true;
}
bool PassesDamageFilterImpl(const CTakeDamageInfo &info)
{
return info.GetDamageType() == m_iDamageType;
}
public:
int m_iDamageType;
};
#endif // FILTERS_H

View file

@ -14,10 +14,6 @@
// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"
extern short g_sModelIndexFireball;
#define SPRITE_FIREBALL "sprites/zerogxplode.vmt"
#define SPRITE_SMOKE "sprites/steam1.vmt"
void UTIL_RemoveHierarchy( CBaseEntity *pDead )
{
if ( !pDead )
@ -44,8 +40,6 @@ public:
void Spawn( void );
// Filter out damage messages that don't contain blast damage (impervious to other forms of attack)
/*int OnTakeDamage( const CTakeDamageInfo &info ); BM: this has to go */
void Event_Killed( const CTakeDamageInfo &info );
void Blocked( CBaseEntity *pOther )
{
@ -70,19 +64,9 @@ END_DATADESC()
void CFuncTankTrain::Spawn( void )
{
m_takedamage = DAMAGE_YES; /* BM: true;? */
m_takedamage = DAMAGE_YES;
BaseClass::Spawn();
}
/* BM: What? I don't even...
// Filter out damage messages that don't contain blast damage (impervious to other forms of attack)
int CFuncTankTrain::OnTakeDamage( const CTakeDamageInfo &info )
{
if ( ! (info.GetDamageType() & DMG_BLAST) )
return 0;
return BaseClass::OnTakeDamage( info );
}
//*/
//-----------------------------------------------------------------------------
// Purpose: Called when the train is killed.

View file

@ -2765,71 +2765,6 @@ void CAI_ChangeHintGroup::InputActivate( inputdata_t &inputdata )
#define SF_CAMERA_PLAYER_INTERRUPT 64
#define SF_CAMERA_PLAYER_LOOK 128 // Allow player look to pan/tilt the point_viewcontrol
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CTriggerCamera : public CBaseEntity
{
public:
DECLARE_CLASS( CTriggerCamera, CBaseEntity );
void Spawn( void );
bool KeyValue( const char *szKeyName, const char *szValue );
void Enable( void );
void Disable( void );
void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
void FollowTarget( void );
void Move(void);
// Always transmit to clients so they know where to move the view to
virtual int UpdateTransmitState();
DECLARE_DATADESC();
// Input handlers
void InputEnable( inputdata_t &inputdata );
void InputDisable( inputdata_t &inputdata );
private:
EHANDLE m_hPlayer;
EHANDLE m_hTarget;
// used for moving the camera along a path (rail rides)
CBaseEntity *m_pPath;
string_t m_sPath;
float m_flWait;
float m_flReturnTime;
float m_flStopTime;
float m_moveDistance;
float m_targetSpeed;
float m_initialSpeed;
float m_acceleration;
float m_deceleration;
int m_state;
Vector m_vecMoveDir;
QAngle m_angOldPlrView; // To save & restore the player's view for the new SF
string_t m_iszTargetAttachment;
int m_iAttachmentIndex;
bool m_bSnapToGoal;
#if HL2_EPISODIC
bool m_bInterpolatePosition;
// these are interpolation vars used for interpolating the camera over time
Vector m_vStartPos, m_vEndPos;
float m_flInterpStartTime;
const static float kflPosInterpTime; // seconds
#endif
int m_nPlayerButtons;
int m_nOldTakeDamage;
private:
COutputEvent m_OnEndFollow;
};
#if HL2_EPISODIC
const float CTriggerCamera::kflPosInterpTime = 2.0f;
#endif

View file

@ -207,4 +207,70 @@ public:
CUtlVector<EHANDLE> m_hurtEntities;
};
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
class CTriggerCamera : public CBaseEntity
{
public:
DECLARE_CLASS(CTriggerCamera, CBaseEntity);
void Spawn(void);
bool KeyValue(const char *szKeyName, const char *szValue);
void Enable(void);
void Disable(void);
void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value);
void FollowTarget(void);
void Move(void);
// Always transmit to clients so they know where to move the view to
virtual int UpdateTransmitState();
DECLARE_DATADESC();
// Input handlers
void InputEnable(inputdata_t &inputdata);
void InputDisable(inputdata_t &inputdata);
private:
EHANDLE m_hPlayer;
EHANDLE m_hTarget;
// used for moving the camera along a path (rail rides)
CBaseEntity *m_pPath;
string_t m_sPath;
float m_flWait;
float m_flReturnTime;
float m_flStopTime;
float m_moveDistance;
float m_targetSpeed;
float m_initialSpeed;
float m_acceleration;
float m_deceleration;
int m_state;
Vector m_vecMoveDir;
QAngle m_angOldPlrView; // To save & restore the player's view for the new SF
string_t m_iszTargetAttachment;
int m_iAttachmentIndex;
bool m_bSnapToGoal;
#if HL2_EPISODIC
bool m_bInterpolatePosition;
// these are interpolation vars used for interpolating the camera over time
Vector m_vStartPos, m_vEndPos;
float m_flInterpStartTime;
const static float kflPosInterpTime; // seconds
#endif
int m_nPlayerButtons;
int m_nOldTakeDamage;
private:
COutputEvent m_OnEndFollow;
};
#endif // TRIGGERS_H