-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add neo_bloom_controller * magic number * int? * keyvalue input correction --------- Co-authored-by: brysondev <[email protected]> Co-authored-by: DESTROYGIRL <[email protected]>
- Loading branch information
1 parent
0ce4a35
commit f67dac7
Showing
5 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
//========= Copyright Valve Corporation, All rights reserved. ============// | ||
// | ||
// Purpose: Neo Bloom Controller | ||
// | ||
// $NoKeywords: $ | ||
//===========================================================================// | ||
#include "cbase.h" | ||
|
||
extern bool g_bUseCustomBloomScale; | ||
extern float g_flCustomBloomScale; | ||
extern EHANDLE g_hTonemapControllerInUse; | ||
|
||
EHANDLE g_hNeoBloomControllerInUse = NULL; | ||
|
||
//----------------------------------------------------------------------------- | ||
// Purpose: neo_bloom_controller entity for mapmakers to control bloom amount in maps | ||
//----------------------------------------------------------------------------- | ||
class C_NeoBloomController : public C_BaseEntity | ||
{ | ||
DECLARE_CLASS(C_NeoBloomController, C_BaseEntity); | ||
public: | ||
DECLARE_CLIENTCLASS(); | ||
|
||
C_NeoBloomController(); | ||
~C_NeoBloomController(); | ||
virtual void OnDataChanged(DataUpdateType_t updateType); | ||
private: | ||
float m_flBloomAmountSetting; | ||
}; | ||
|
||
IMPLEMENT_CLIENTCLASS_DT(C_NeoBloomController, DT_NeoBloomController, CNeoBloomController) | ||
RecvPropFloat(RECVINFO(m_flBloomAmountSetting)), | ||
END_RECV_TABLE() | ||
|
||
//----------------------------------------------------------------------------- | ||
// Purpose: | ||
//----------------------------------------------------------------------------- | ||
C_NeoBloomController::C_NeoBloomController(void) | ||
{ | ||
m_flBloomAmountSetting = 1.0f; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
// Purpose: | ||
//----------------------------------------------------------------------------- | ||
C_NeoBloomController::~C_NeoBloomController(void) | ||
{ | ||
if (g_hNeoBloomControllerInUse == this && g_hTonemapControllerInUse == NULL) | ||
{ | ||
g_flCustomBloomScale = 1.0f; // Whatever the default bloom amount value is here | ||
g_bUseCustomBloomScale = false; | ||
} | ||
} | ||
|
||
void C_NeoBloomController::OnDataChanged(DataUpdateType_t updateType) | ||
{ | ||
BaseClass::OnDataChanged(updateType); | ||
|
||
if (g_hTonemapControllerInUse != NULL) | ||
{ | ||
return; | ||
} | ||
|
||
g_flCustomBloomScale = m_flBloomAmountSetting; | ||
g_bUseCustomBloomScale = true; | ||
g_hNeoBloomControllerInUse = this; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
//========= Copyright Valve Corporation, All rights reserved. ============// | ||
// | ||
// Purpose: | ||
// | ||
//============================================================================= | ||
|
||
#include "cbase.h" | ||
#include "baseentity.h" | ||
#include "entityoutput.h" | ||
#include "convar.h" | ||
// memdbgon must be the last include file in a .cpp file!!! | ||
#include "tier0/memdbgon.h" | ||
|
||
//----------------------------------------------------------------------------- | ||
// Purpose: Entity that controls player's tonemap | ||
//----------------------------------------------------------------------------- | ||
class CNeoBloomController : public CPointEntity | ||
{ | ||
DECLARE_CLASS( CNeoBloomController, CPointEntity ); | ||
public: | ||
DECLARE_DATADESC(); | ||
DECLARE_SERVERCLASS(); | ||
|
||
void Spawn( void ); | ||
int UpdateTransmitState( void ); | ||
|
||
// Inputs | ||
void InputSetBloomScale( inputdata_t &inputdata ); | ||
|
||
private: | ||
CNetworkVar( float, m_flBloomAmountSetting); | ||
}; | ||
|
||
LINK_ENTITY_TO_CLASS( neo_bloom_controller, CNeoBloomController ); | ||
|
||
BEGIN_DATADESC( CNeoBloomController ) | ||
DEFINE_KEYFIELD( m_flBloomAmountSetting, FIELD_FLOAT, "bloomamount" ), | ||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetBloomScale", InputSetBloomScale ), | ||
END_DATADESC() | ||
|
||
|
||
IMPLEMENT_SERVERCLASS_ST( CNeoBloomController, DT_NeoBloomController ) | ||
SendPropFloat( SENDINFO(m_flBloomAmountSetting), 0, SPROP_NOSCALE), | ||
END_SEND_TABLE() | ||
|
||
//----------------------------------------------------------------------------- | ||
// Purpose: | ||
//----------------------------------------------------------------------------- | ||
void CNeoBloomController::Spawn( void ) | ||
{ | ||
SetSolid( SOLID_NONE ); | ||
SetMoveType( MOVETYPE_NONE ); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
// Purpose: | ||
//----------------------------------------------------------------------------- | ||
int CNeoBloomController::UpdateTransmitState() | ||
{ | ||
return SetTransmitState( FL_EDICT_ALWAYS ); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
// Purpose: | ||
//----------------------------------------------------------------------------- | ||
void CNeoBloomController::InputSetBloomScale( inputdata_t &inputdata ) | ||
{ | ||
m_flBloomAmountSetting = inputdata.value.Float(); | ||
} |