diff options
| author | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:31:46 -0800 |
|---|---|---|
| committer | Jørgen P. Tjernø <[email protected]> | 2013-12-02 19:46:31 -0800 |
| commit | f56bb35301836e56582a575a75864392a0177875 (patch) | |
| tree | de61ddd39de3e7df52759711950b4c288592f0dc /mp/src/game/client/c_func_areaportalwindow.cpp | |
| parent | Mark some more files as text. (diff) | |
| download | source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.tar.xz source-sdk-2013-f56bb35301836e56582a575a75864392a0177875.zip | |
Fix line endings. WHAMMY.
Diffstat (limited to 'mp/src/game/client/c_func_areaportalwindow.cpp')
| -rw-r--r-- | mp/src/game/client/c_func_areaportalwindow.cpp | 294 |
1 files changed, 147 insertions, 147 deletions
diff --git a/mp/src/game/client/c_func_areaportalwindow.cpp b/mp/src/game/client/c_func_areaportalwindow.cpp index e15e75ec..b910e7a8 100644 --- a/mp/src/game/client/c_func_areaportalwindow.cpp +++ b/mp/src/game/client/c_func_areaportalwindow.cpp @@ -1,147 +1,147 @@ -//========= Copyright Valve Corporation, All rights reserved. ============//
-//
-// Purpose:
-//
-// $NoKeywords: $
-//
-//=============================================================================//
-#include "cbase.h"
-#include "view.h"
-#include "model_types.h"
-#include "ivrenderview.h"
-#include "engine/ivmodelinfo.h"
-
-// memdbgon must be the last include file in a .cpp file!!!
-#include "tier0/memdbgon.h"
-
-#define VIEWER_PADDING 80.0f
-
-class C_FuncAreaPortalWindow : public C_BaseEntity
-{
-public:
- DECLARE_CLIENTCLASS();
- DECLARE_CLASS( C_FuncAreaPortalWindow, C_BaseEntity );
-
-
-// Overrides.
-public:
-
- virtual void ComputeFxBlend();
- virtual bool IsTransparent();
- virtual int DrawModel( int flags );
- virtual bool ShouldReceiveProjectedTextures( int flags );
-
-private:
-
- float GetDistanceBlend();
-
-
-
-public:
- float m_flFadeStartDist; // Distance at which it starts fading (when <= this, alpha=m_flTranslucencyLimit).
- float m_flFadeDist; // Distance at which it becomes solid.
-
- // 0-1 value - minimum translucency it's allowed to get to.
- float m_flTranslucencyLimit;
-
- int m_iBackgroundModelIndex;
-};
-
-
-
-IMPLEMENT_CLIENTCLASS_DT( C_FuncAreaPortalWindow, DT_FuncAreaPortalWindow, CFuncAreaPortalWindow )
- RecvPropFloat( RECVINFO( m_flFadeStartDist ) ),
- RecvPropFloat( RECVINFO( m_flFadeDist ) ),
- RecvPropFloat( RECVINFO( m_flTranslucencyLimit ) ),
- RecvPropInt( RECVINFO( m_iBackgroundModelIndex ) )
-END_RECV_TABLE()
-
-
-
-void C_FuncAreaPortalWindow::ComputeFxBlend()
-{
- // We reset our blend down below so pass anything except 0 to the renderer.
- m_nRenderFXBlend = 255;
-
-#ifdef _DEBUG
- m_nFXComputeFrame = gpGlobals->framecount;
-#endif
-
-}
-
-
-bool C_FuncAreaPortalWindow::IsTransparent()
-{
- return true;
-}
-
-
-int C_FuncAreaPortalWindow::DrawModel( int flags )
-{
- if ( !m_bReadyToDraw )
- return 0;
-
- if( !GetModel() )
- return 0;
-
- // Make sure we're a brush model.
- int modelType = modelinfo->GetModelType( GetModel() );
- if( modelType != mod_brush )
- return 0;
-
- // Draw the fading version.
- render->SetBlend( GetDistanceBlend() );
-
- DrawBrushModelMode_t mode = DBM_DRAW_ALL;
- if ( flags & STUDIO_TWOPASS )
- {
- mode = ( flags & STUDIO_TRANSPARENCY ) ? DBM_DRAW_TRANSLUCENT_ONLY : DBM_DRAW_OPAQUE_ONLY;
- }
-
- render->DrawBrushModelEx(
- this,
- (model_t *)GetModel(),
- GetAbsOrigin(),
- GetAbsAngles(),
- mode );
-
- // Draw the optional foreground model next.
- // Only use the alpha in the texture from the thing in the front.
- if (m_iBackgroundModelIndex >= 0)
- {
- render->SetBlend( 1 );
- model_t *pBackground = ( model_t * )modelinfo->GetModel( m_iBackgroundModelIndex );
- if( pBackground && modelinfo->GetModelType( pBackground ) == mod_brush )
- {
- render->DrawBrushModelEx(
- this,
- pBackground,
- GetAbsOrigin(),
- GetAbsAngles(),
- mode );
- }
- }
-
- return 1;
-}
-
-
-float C_FuncAreaPortalWindow::GetDistanceBlend()
-{
- // Get the viewer's distance to us.
- float flDist = CollisionProp()->CalcDistanceFromPoint( CurrentViewOrigin() );
- C_BasePlayer *local = C_BasePlayer::GetLocalPlayer();
- if ( local )
- {
- flDist *= local->GetFOVDistanceAdjustFactor();
- }
-
- return RemapValClamped( flDist, m_flFadeStartDist, m_flFadeDist, m_flTranslucencyLimit, 1 );
-}
-
-bool C_FuncAreaPortalWindow::ShouldReceiveProjectedTextures( int flags )
-{
- return false;
-}
-
-
+//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#include "cbase.h" +#include "view.h" +#include "model_types.h" +#include "ivrenderview.h" +#include "engine/ivmodelinfo.h" + +// memdbgon must be the last include file in a .cpp file!!! +#include "tier0/memdbgon.h" + +#define VIEWER_PADDING 80.0f + +class C_FuncAreaPortalWindow : public C_BaseEntity +{ +public: + DECLARE_CLIENTCLASS(); + DECLARE_CLASS( C_FuncAreaPortalWindow, C_BaseEntity ); + + +// Overrides. +public: + + virtual void ComputeFxBlend(); + virtual bool IsTransparent(); + virtual int DrawModel( int flags ); + virtual bool ShouldReceiveProjectedTextures( int flags ); + +private: + + float GetDistanceBlend(); + + + +public: + float m_flFadeStartDist; // Distance at which it starts fading (when <= this, alpha=m_flTranslucencyLimit). + float m_flFadeDist; // Distance at which it becomes solid. + + // 0-1 value - minimum translucency it's allowed to get to. + float m_flTranslucencyLimit; + + int m_iBackgroundModelIndex; +}; + + + +IMPLEMENT_CLIENTCLASS_DT( C_FuncAreaPortalWindow, DT_FuncAreaPortalWindow, CFuncAreaPortalWindow ) + RecvPropFloat( RECVINFO( m_flFadeStartDist ) ), + RecvPropFloat( RECVINFO( m_flFadeDist ) ), + RecvPropFloat( RECVINFO( m_flTranslucencyLimit ) ), + RecvPropInt( RECVINFO( m_iBackgroundModelIndex ) ) +END_RECV_TABLE() + + + +void C_FuncAreaPortalWindow::ComputeFxBlend() +{ + // We reset our blend down below so pass anything except 0 to the renderer. + m_nRenderFXBlend = 255; + +#ifdef _DEBUG + m_nFXComputeFrame = gpGlobals->framecount; +#endif + +} + + +bool C_FuncAreaPortalWindow::IsTransparent() +{ + return true; +} + + +int C_FuncAreaPortalWindow::DrawModel( int flags ) +{ + if ( !m_bReadyToDraw ) + return 0; + + if( !GetModel() ) + return 0; + + // Make sure we're a brush model. + int modelType = modelinfo->GetModelType( GetModel() ); + if( modelType != mod_brush ) + return 0; + + // Draw the fading version. + render->SetBlend( GetDistanceBlend() ); + + DrawBrushModelMode_t mode = DBM_DRAW_ALL; + if ( flags & STUDIO_TWOPASS ) + { + mode = ( flags & STUDIO_TRANSPARENCY ) ? DBM_DRAW_TRANSLUCENT_ONLY : DBM_DRAW_OPAQUE_ONLY; + } + + render->DrawBrushModelEx( + this, + (model_t *)GetModel(), + GetAbsOrigin(), + GetAbsAngles(), + mode ); + + // Draw the optional foreground model next. + // Only use the alpha in the texture from the thing in the front. + if (m_iBackgroundModelIndex >= 0) + { + render->SetBlend( 1 ); + model_t *pBackground = ( model_t * )modelinfo->GetModel( m_iBackgroundModelIndex ); + if( pBackground && modelinfo->GetModelType( pBackground ) == mod_brush ) + { + render->DrawBrushModelEx( + this, + pBackground, + GetAbsOrigin(), + GetAbsAngles(), + mode ); + } + } + + return 1; +} + + +float C_FuncAreaPortalWindow::GetDistanceBlend() +{ + // Get the viewer's distance to us. + float flDist = CollisionProp()->CalcDistanceFromPoint( CurrentViewOrigin() ); + C_BasePlayer *local = C_BasePlayer::GetLocalPlayer(); + if ( local ) + { + flDist *= local->GetFOVDistanceAdjustFactor(); + } + + return RemapValClamped( flDist, m_flFadeStartDist, m_flFadeDist, m_flTranslucencyLimit, 1 ); +} + +bool C_FuncAreaPortalWindow::ShouldReceiveProjectedTextures( int flags ) +{ + return false; +} + + |