Skip to content

Commit

Permalink
Mapbase v6.1
Browse files Browse the repository at this point in the history
- Added postprocess_controller entity from later versions of Source
- Added env_dof_controller entity from later versions of Source
- Added SDK_Engine_Post and DepthOfField shaders from the Momentum repo/Alien Swarm SDK
- Fixed auto-breaking game_text/choreo text not null terminating
- Fixed console groups showing up at the wrong developer levels
- Added more mesages to console groups, including a new "NPC AI" console group
- Fixed typos and added elaboration in various cvars, console messages, etc.
- Fixed npc_metropolice not using frag grenades correctly when allowed to use them
- Fixed npc_metropolice not registering stitching squad slots in AI
- Fixed SetModel input late precache warning
- Fixed env_global_light angles resetting upon loading a save
- Fixed an issue with ScriptKeyValuesRead using the wrong name and having a memory leak
- Allowed VScript functions which return null strings to actually return null instead of empty strings
- Added VScript member variable documentation
- Fixed VScript documentation lines sometimes mixing together
- Fixed VScript singletons having a ! at the beginning of descriptions
- Added Color struct to VScript and allowed color-related inputs to use it
- Added more VScript functions for weapons, ammo, ragdolling, and response contexts
- Added GameRules singleton for VScript
- Exposed AI interaction system to VScript
- Recovered some lost documentation from older revisions of the Mapbase wiki
- Added a way to get the current game's load type in VScript
- Fixed Precache/SpawnEntityFromTable not accounting for a few important field types
- Added VScript functions for getting a player's eye vectors
- Fixed a crash caused by removing the active weapon of a Combine soldier while it's firing
- Changed the way metrocops deploy their manhacks so they could use their manhack death response properly
- Fixed "Use Server" keyvalue on game_convar_mod not working
- Adjusted CAI_Expresser in VScript
  • Loading branch information
Blixibon committed Dec 17, 2020
1 parent 6d45d95 commit 87cd9b2
Show file tree
Hide file tree
Showing 82 changed files with 4,589 additions and 330 deletions.
1 change: 1 addition & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Here's a list of Mapbase's other known external code sources:
- https://github.com/KyleGospo/City-17-Episode-One-Source (Brush phong and projected texture changes, included indirectly via Insolence repo)
- https://github.com/DownFall-Team/DownFall (Multiple skybox code and fix for ent_fire delay not using floats; Also used as a guide to port certain Alien Swarm SDK changes to Source 2013,
including radial fog, rope code, and treesway)
- https://github.com/momentum-mod/game (Used as a guide to port postprocess_controller and env_dof_controller to Source 2013)
- https://github.com/DeathByNukes/source-sdk-2013 (VBSP manifest fixes)
- https://github.com/entropy-zero/source-sdk-2013 (skill_changed game event)

Expand Down
10 changes: 10 additions & 0 deletions sp/src/game/client/c_baseplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ END_RECV_TABLE()

RecvPropString( RECVINFO(m_szLastPlaceName) ),

RecvPropEHandle(RECVINFO(m_hPostProcessCtrl)), // Send to everybody - for spectating

#if defined USES_ECON_ITEMS
RecvPropUtlVector( RECVINFO_UTLVECTOR( m_hMyWearables ), MAX_WEARABLES_SENT_FROM_SERVER, RecvPropEHandle(NULL, 0, 0) ),
#endif
Expand Down Expand Up @@ -2907,6 +2909,14 @@ void C_BasePlayer::UpdateFogBlend( void )
}
}

//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
C_PostProcessController* C_BasePlayer::GetActivePostProcessController() const
{
return m_hPostProcessCtrl.Get();
}

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down
6 changes: 6 additions & 0 deletions sp/src/game/client/c_baseplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "hintsystem.h"
#include "SoundEmitterSystem/isoundemittersystembase.h"
#include "c_env_fog_controller.h"
#include "c_postprocesscontroller.h"
#include "igameevents.h"
#include "GameEventListener.h"

Expand All @@ -37,6 +38,7 @@ class C_BaseViewModel;
class C_FuncLadder;
class CFlashlightEffect;
class C_EconWearable;
class C_PostProcessController;

extern int g_nKillCamMode;
extern int g_nKillCamTarget1;
Expand Down Expand Up @@ -379,6 +381,8 @@ class C_BasePlayer : public C_BaseCombatCharacter, public CGameEventListener
void UpdateFogController( void );
void UpdateFogBlend( void );

C_PostProcessController* GetActivePostProcessController() const;

float GetFOVTime( void ){ return m_flFOVTime; }

virtual void OnAchievementAchieved( int iAchievement ) {}
Expand Down Expand Up @@ -641,6 +645,8 @@ class C_BasePlayer : public C_BaseCombatCharacter, public CGameEventListener
// One for left and one for right side of step
StepSoundCache_t m_StepSoundCache[ 2 ];

CNetworkHandle(C_PostProcessController, m_hPostProcessCtrl); // active postprocessing controller

public:

const char *GetLastKnownPlaceName( void ) const { return m_szLastPlaceName; } // return the last nav place name the player occupied
Expand Down
2 changes: 1 addition & 1 deletion sp/src/game/client/c_effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ConVar r_RainSplashPercentage( "r_RainSplashPercentage", "20", FCVAR_CHEAT ); //
ConVar r_RainParticleDensity( "r_RainParticleDensity", "1", FCVAR_NONE, "Density of Particle Rain 0-1" );

#ifdef MAPBASE
ConVar r_RainParticleClampOffset( "r_RainParticleClampOffset", "112", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systemss" );
ConVar r_RainParticleClampOffset( "r_RainParticleClampOffset", "112", FCVAR_NONE, "How far inward or outward to extrude clamped precipitation particle systems" );
ConVar r_RainParticleClampDebug( "r_RainParticleClampDebug", "0", FCVAR_NONE, "Enables debug code for precipitation particle system clamping" );
#endif

Expand Down
88 changes: 88 additions & 0 deletions sp/src/game/client/c_env_dof_controller.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//====== Copyright © 1996-2005, Valve Corporation, All rights reserved. =======
//
// Purpose: Depth of field controller entity
//
//=============================================================================

#include "cbase.h"

// NOTE: This has to be the last file included!
#include "tier0/memdbgon.h"


extern bool g_bDOFEnabled;
extern float g_flDOFNearBlurDepth;
extern float g_flDOFNearFocusDepth;
extern float g_flDOFFarFocusDepth;
extern float g_flDOFFarBlurDepth;
extern float g_flDOFNearBlurRadius;
extern float g_flDOFFarBlurRadius;

EHANDLE g_hDOFControllerInUse = NULL;

class C_EnvDOFController : public C_BaseEntity
{
DECLARE_CLASS( C_EnvDOFController, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();

C_EnvDOFController();
~C_EnvDOFController();
virtual void OnDataChanged( DataUpdateType_t updateType );

private:
bool m_bDOFEnabled;
float m_flNearBlurDepth;
float m_flNearFocusDepth;
float m_flFarFocusDepth;
float m_flFarBlurDepth;
float m_flNearBlurRadius;
float m_flFarBlurRadius;

private:
C_EnvDOFController( const C_EnvDOFController & );
};

IMPLEMENT_CLIENTCLASS_DT( C_EnvDOFController, DT_EnvDOFController, CEnvDOFController )
RecvPropInt( RECVINFO(m_bDOFEnabled) ),
RecvPropFloat( RECVINFO(m_flNearBlurDepth) ),
RecvPropFloat( RECVINFO(m_flNearFocusDepth) ),
RecvPropFloat( RECVINFO(m_flFarFocusDepth) ),
RecvPropFloat( RECVINFO(m_flFarBlurDepth) ),
RecvPropFloat( RECVINFO(m_flNearBlurRadius) ),
RecvPropFloat( RECVINFO(m_flFarBlurRadius) )
END_RECV_TABLE()

C_EnvDOFController::C_EnvDOFController()
: m_bDOFEnabled( true ),
m_flNearBlurDepth( 20.0f ),
m_flNearFocusDepth( 100.0f ),
m_flFarFocusDepth( 250.0f ),
m_flFarBlurDepth( 1000.0f ),
m_flNearBlurRadius( 0.0f ), // no near blur by default
m_flFarBlurRadius( 5.0f )
{
}

C_EnvDOFController::~C_EnvDOFController()
{
if ( g_hDOFControllerInUse == this )
{
g_bDOFEnabled = false;
}
}

void C_EnvDOFController::OnDataChanged( DataUpdateType_t updateType )
{
BaseClass::OnDataChanged( updateType );

g_bDOFEnabled = m_bDOFEnabled && ( ( m_flNearBlurRadius > 0.0f ) || ( m_flFarBlurRadius > 0.0f ) );
g_flDOFNearBlurDepth = m_flNearBlurDepth;
g_flDOFNearFocusDepth = m_flNearFocusDepth;
g_flDOFFarFocusDepth = m_flFarFocusDepth;
g_flDOFFarBlurDepth = m_flFarBlurDepth;
g_flDOFNearBlurRadius = m_flNearBlurRadius;
g_flDOFFarBlurRadius = m_flFarBlurRadius;

g_hDOFControllerInUse = this;
}
63 changes: 63 additions & 0 deletions sp/src/game/client/c_postprocesscontroller.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
//====== Copyright © 1996-2008, Valve Corporation, All rights reserved. =======
//
// Purpose: stores map postprocess params
//
//=============================================================================
#include "cbase.h"
#include "c_postprocesscontroller.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

IMPLEMENT_CLIENTCLASS_DT( C_PostProcessController, DT_PostProcessController, CPostProcessController )
RecvPropArray3( RECVINFO_NAME( m_PostProcessParameters.m_flParameters[0], m_flPostProcessParameters ), POST_PROCESS_PARAMETER_COUNT, RecvPropFloat( RECVINFO_NAME( m_PostProcessParameters.m_flParameters[0], m_flPostProcessParameters[0] ) ) ),
RecvPropBool( RECVINFO(m_bMaster) )
END_RECV_TABLE()

C_PostProcessController* C_PostProcessController::ms_pMasterController = nullptr;

//-----------------------------------------------------------------------------
C_PostProcessController::C_PostProcessController()
: m_bMaster( false )
{
if ( ms_pMasterController == nullptr)
{
ms_pMasterController = this;
}
}

//-----------------------------------------------------------------------------
C_PostProcessController::~C_PostProcessController()
{
if ( ms_pMasterController == this )
{
ms_pMasterController = nullptr;
}
}

void C_PostProcessController::PostDataUpdate( DataUpdateType_t updateType )
{
BaseClass::PostDataUpdate( updateType );

if ( m_bMaster )
{
ms_pMasterController = this;
}
}

#ifdef MAPBASE
// Prevents parameters from fading after a save/restore
bool g_bPostProcessNeedsRestore = false;

void C_PostProcessController::OnRestore()
{
BaseClass::OnRestore();

C_BasePlayer *pPlayer = C_BasePlayer::GetLocalPlayer();
if ( pPlayer && pPlayer->GetActivePostProcessController() == this )
{
// Tell clientmode this is part of a save/restore
g_bPostProcessNeedsRestore = true;
}
}
#endif
33 changes: 33 additions & 0 deletions sp/src/game/client/c_postprocesscontroller.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#include "postprocess_shared.h"

//=============================================================================
//
// Class Postprocess Controller:
//
class C_PostProcessController : public C_BaseEntity
{
DECLARE_CLASS( C_PostProcessController, C_BaseEntity );
public:
DECLARE_CLIENTCLASS();

C_PostProcessController();
virtual ~C_PostProcessController();

virtual void PostDataUpdate( DataUpdateType_t updateType );

static C_PostProcessController* GetMasterController() { return ms_pMasterController; }

PostProcessParameters_t m_PostProcessParameters;

#ifdef MAPBASE
// Prevents fade time from being used in save/restore
virtual void OnRestore();
#endif

private:
bool m_bMaster;

static C_PostProcessController* ms_pMasterController;
};
3 changes: 3 additions & 0 deletions sp/src/game/client/client_mapbase.vpc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ $Project
$File "c_gameinstructor.h"
$File "hud_locator_target.cpp"
$File "hud_locator_target.h"
$File "c_postprocesscontroller.cpp"
$File "c_postprocesscontroller.h"
$File "c_env_dof_controller.cpp"

$Folder "Mapbase"
{
Expand Down
80 changes: 80 additions & 0 deletions sp/src/game/client/clientmode_shared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <vgui/ILocalize.h>
#include "hud_vote.h"
#include "ienginevgui.h"
#include "viewpostprocess.h"
#include "sourcevr/isourcevirtualreality.h"
#if defined( _X360 )
#include "xbox/xbox_console.h"
Expand Down Expand Up @@ -291,6 +292,9 @@ ClientModeShared::ClientModeShared()
m_pWeaponSelection = NULL;
m_nRootSize[ 0 ] = m_nRootSize[ 1 ] = -1;

m_pCurrentPostProcessController = NULL;
m_PostProcessLerpTimer.Invalidate();

#if defined( REPLAY_ENABLED )
m_pReplayReminderPanel = NULL;
m_flReplayStartRecordTime = 0.0f;
Expand Down Expand Up @@ -604,6 +608,8 @@ void ClientModeShared::Update()
m_pViewport->SetVisible( cl_drawhud.GetBool() );
}

UpdatePostProcessingEffects();

UpdateRumbleEffects();

if ( cl_show_num_particle_systems.GetBool() )
Expand Down Expand Up @@ -914,6 +920,17 @@ void ClientModeShared::LevelShutdown( void )
s_hVGuiContext = DEFAULT_VGUI_CONTEXT;
}

#ifdef MAPBASE
// Always reset post-processing on level unload
//if (m_pCurrentPostProcessController)
{
m_CurrentPostProcessParameters = PostProcessParameters_t();
m_LerpEndPostProcessParameters = PostProcessParameters_t();
m_pCurrentPostProcessController = NULL;
SetPostProcessParams( &m_CurrentPostProcessParameters );
}
#endif

// Reset any player explosion/shock effects
CLocalPlayerFilter filter;
enginesound->SetPlayerDSP( filter, 0, true );
Expand Down Expand Up @@ -988,6 +1005,69 @@ float ClientModeShared::GetViewModelFOV( void )
return v_viewmodel_fov.GetFloat();
}

#ifdef MAPBASE
extern bool g_bPostProcessNeedsRestore;
#endif

void ClientModeShared::UpdatePostProcessingEffects()
{
C_PostProcessController* pNewPostProcessController = NULL;
C_BasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer();

if (pPlayer)
pNewPostProcessController = pPlayer->GetActivePostProcessController();

if (!pNewPostProcessController)
{
m_CurrentPostProcessParameters = PostProcessParameters_t();
m_pCurrentPostProcessController = NULL;
SetPostProcessParams( &m_CurrentPostProcessParameters );
return;
}

if (pNewPostProcessController != m_pCurrentPostProcessController)
m_pCurrentPostProcessController = pNewPostProcessController;

// Start a lerp timer if the parameters changed, regardless of whether the controller changed
if (m_LerpEndPostProcessParameters != pNewPostProcessController->m_PostProcessParameters)
{
m_LerpStartPostProcessParameters = m_CurrentPostProcessParameters;
m_LerpEndPostProcessParameters = pNewPostProcessController ? pNewPostProcessController->m_PostProcessParameters : m_CurrentPostProcessParameters;

float flFadeTime = pNewPostProcessController ? pNewPostProcessController->m_PostProcessParameters.m_flParameters[PPPN_FADE_TIME] : 0.0f;
if (flFadeTime <= 0.0f)
{
flFadeTime = 0.001f;
}

m_PostProcessLerpTimer.Start( flFadeTime );
}
#ifdef MAPBASE
// HACKHACK: Needs to be checked here because OnRestore() doesn't seem to run before a lerp begins
else if (g_bPostProcessNeedsRestore)
{
// The player just loaded a saved game.
// Don't fade parameters from 0; instead, take what's already there and assume they were already active.
// (we have no way of knowing if they were in the middle of a lerp)
m_PostProcessLerpTimer.Invalidate();
g_bPostProcessNeedsRestore = false;
}
#endif

// Lerp between old and new parameters
float flLerpFactor = 1.0f - m_PostProcessLerpTimer.GetRemainingRatio();
for (int nParameter = 0; nParameter < POST_PROCESS_PARAMETER_COUNT; ++nParameter)
{
m_CurrentPostProcessParameters.m_flParameters[nParameter] =
Lerp(
flLerpFactor,
m_LerpStartPostProcessParameters.m_flParameters[nParameter],
m_LerpEndPostProcessParameters.m_flParameters[nParameter] );
}

SetPostProcessParams( &m_CurrentPostProcessParameters );
}

class CHudChat;

bool PlayerNameNotSetYet( const char *pszName )
Expand Down
Loading

0 comments on commit 87cd9b2

Please sign in to comment.