From a7e23e46e9bf798b9c851bc057a529ed9646ba7a Mon Sep 17 00:00:00 2001 From: Blixibon Date: Sat, 13 Jun 2020 20:45:37 +0000 Subject: [PATCH] Mapbase v4.0 - Fixed SDK_Refract and SDK_Water not using new cubemap method - Added missing .inc files for SDK_ShatteredGlass - Updated gitignore - Fixed parallax corrected cubemaps sometimes causing VBSP to crash - Added spawnflag to npc_headcrab which can prevent a headcrab from drowning - Added spawnflag to npc_headcrab which can prevent a headcrab from instantly dying to a melee weapon --- .gitignore | 12 + CONTRIBUTING | 61 +++-- sp/src/game/server/hl2/npc_headcrab.cpp | 13 ++ .../fxctmp9/SDK_ShatteredGlass_ps20.inc | 212 ++++++++++++++++++ .../fxctmp9/SDK_ShatteredGlass_ps20b.inc | 212 ++++++++++++++++++ .../fxctmp9/SDK_ShatteredGlass_vs20.inc | 87 +++++++ .../fxctmp9_tmp/SDK_ShatteredGlass_ps20.inc | 212 ++++++++++++++++++ .../fxctmp9_tmp/SDK_ShatteredGlass_ps20b.inc | 212 ++++++++++++++++++ .../fxctmp9_tmp/SDK_ShatteredGlass_vs20.inc | 87 +++++++ .../stdshaders/refract_dx9_helper.cpp | 13 ++ sp/src/materialsystem/stdshaders/water.cpp | 13 ++ sp/src/utils/vbsp/cubemap.cpp | 2 +- 12 files changed, 1103 insertions(+), 33 deletions(-) create mode 100644 sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20.inc create mode 100644 sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20b.inc create mode 100644 sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_vs20.inc create mode 100644 sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20.inc create mode 100644 sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20b.inc create mode 100644 sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_vs20.inc diff --git a/.gitignore b/.gitignore index 30855510..ceeca319 100644 --- a/.gitignore +++ b/.gitignore @@ -53,6 +53,7 @@ config.cfg # shader files *.tmp +*.vcs # Unnecessary files *.lib @@ -75,3 +76,14 @@ sp/src/game/server/Release_mod_episodic/ sp/src/game/server/Release_mod_hl2/ sp/src/*/Debug/ sp/src/*/Release/ +sp/game/*.dll +sp/game/*.pdb +sp/game/*.exe +sp/src/utils/*.dll +sp/src/utils/*.pdb +sp/src/utils/*.exe +sp/src/utils/*.res +sp/src/materialsystem/*.dll +sp/src/materialsystem/*.pdb +sp/src/vgui2/*.dll +sp/src/vgui2/*.pdb diff --git a/CONTRIBUTING b/CONTRIBUTING index feeb7dab..72d86b6f 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -1,39 +1,36 @@ -Thanks for your interest in the Source SDK 2013 project. When you make a -contribution to the project (e.g. create an Issue or submit a Pull Request) -(a "Contribution"), Valve wants to be able to use your Contribution to improve -the SDK and other Valve products. +This file details how to contribute to the Mapbase project on GitHub: + https://github.com/mapbase-source/source-sdk-2013 -As a condition of providing a Contribution, you agree that: -- You grant Valve a non-exclusive, irrevocable, royalty-free, worldwide license -to make, use, sell, reproduce, modify, distribute (directly and indirectly), -and publicly display and perform the Contribution, and any derivative works -that Valve may make from the Contribution, under any intellectual property you -own or have the right to license. -- You warrant and represent that the Contribution is your original creation, -that you have the authority to grant this license to Valve, and that this -license does not require the permission of any third party. Otherwise, you -provide your Contribution "as is" without warranties. +For the original Source SDK 2013 contribution guidelines, click here: + https://github.com/ValveSoftware/source-sdk-2013/blob/master/CONTRIBUTING -Should you wish to submit a suggestion or work that is not your original -creation, you may submit it to Valve separate from any Contribution, -explicitly identifying it as sourced from a third party, stating the details -of its origin, and informing Valve of any license or other restriction of -which you are personally aware. +--- +Mapbase is a project which many Source modders draw from, so it has its own unique standards +for contributions which differ from other projects, but it is still an open-source repository +that is always open to contributions. -Valve is happy to accept pull requests and issues in the source-sdk-2013 -repository in these cases: - * Changes that fix bugs in the SDK deployment process itself. The repository - should build out of the box, and anything that prevents that is a pull - request we want. - * High priority bugs in HL2, the Episodes, or HL2MP that can be fixed in - client.dll or server.dll. +Whenever you contribute to the Mapbase repository, you must keep in mind that any contributions +made could be deployed to all mods utilizing Mapbase, which can include everything from high-profile +Steam mods to amateur HL2 maps. -For other changes we suggest that you issue a pull request to one of these -fine community-maintained repositories instead: - https://developer.valvesoftware.com/wiki/Source-sdk-2013-community-repos +All contributions must follow the following rules: -If you are going to make a pull request, please keep them as granular as -possible. Pull requests with 3-4 unrelated changes in them aren't going to -be accepted. + * A contribution must be aligned with Mapbase's goals and priorities and should not be "subjective" + or related to a specific mod or type of mod. For example, fixing an existing issue or adding a + new tool for mappers to use is usually fine, but adding a new custom weapon with its own assets + is usually not fit for Mapbase. + + * All content in a contribution must be either already legally open-source or done with the + full permission of the contribution's original creator(s). + + * A code contribution should typically follow Mapbase's preprocessor conventions unless it's a massive + feature which makes fundamental changes to several different parts of the code (e.g. reductor's VScript PR). + When following these standards, all changes should be nested within "#ifdef MAPBASE", "#ifndef MAPBASE", etc. + +If your contribution is accepted, you may be listed in Mapbase's credits: + https://github.com/mapbase-source/source-sdk-2013/wiki/Mapbase-Credits#Contributors + +You may also receive the "Contributor" or "Major Contributor" role on Mapbase's Discord server if you are +a member of it. diff --git a/sp/src/game/server/hl2/npc_headcrab.cpp b/sp/src/game/server/hl2/npc_headcrab.cpp index 33f21107..22f44d3d 100644 --- a/sp/src/game/server/hl2/npc_headcrab.cpp +++ b/sp/src/game/server/hl2/npc_headcrab.cpp @@ -72,6 +72,10 @@ ConVar g_debug_headcrab( "g_debug_headcrab", "0", FCVAR_CHEAT ); //------------------------------------ #define SF_HEADCRAB_START_HIDDEN (1 << 16) #define SF_HEADCRAB_START_HANGING (1 << 17) +#ifdef MAPBASE +#define SF_HEADCRAB_DONT_DROWN (1 << 18) +#define SF_HEADCRAB_NO_MELEE_INSTAKILL (1 << 19) +#endif //----------------------------------------------------------------------------- @@ -1045,7 +1049,11 @@ void CBaseHeadcrab::GatherConditions( void ) BaseClass::GatherConditions(); +#ifdef MAPBASE + if (GetWaterLevel() > 1 && m_lifeState == LIFE_ALIVE && !HasSpawnFlags( SF_HEADCRAB_DONT_DROWN )) +#else if( m_lifeState == LIFE_ALIVE && GetWaterLevel() > 1 ) +#endif { // Start Drowning! SetCondition( COND_HEADCRAB_IN_WATER ); @@ -1725,7 +1733,12 @@ int CBaseHeadcrab::OnTakeDamage_Alive( const CTakeDamageInfo &inputInfo ) // // Certain death from melee bludgeon weapons! // +#ifdef MAPBASE + // (unless the mapper said no) + if ( info.GetDamageType() & DMG_CLUB && !HasSpawnFlags( SF_HEADCRAB_NO_MELEE_INSTAKILL ) ) +#else if ( info.GetDamageType() & DMG_CLUB ) +#endif { info.SetDamage( m_iHealth ); } diff --git a/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20.inc b/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20.inc new file mode 100644 index 00000000..161c4c79 --- /dev/null +++ b/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20.inc @@ -0,0 +1,212 @@ +#include "shaderlib/cshader.h" +class sdk_shatteredglass_ps20_Static_Index +{ +private: + int m_nCUBEMAP; +#ifdef _DEBUG + bool m_bCUBEMAP; +#endif +public: + void SetCUBEMAP( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nCUBEMAP = i; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } + void SetCUBEMAP( bool i ) + { + m_nCUBEMAP = i ? 1 : 0; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } +private: + int m_nVERTEXCOLOR; +#ifdef _DEBUG + bool m_bVERTEXCOLOR; +#endif +public: + void SetVERTEXCOLOR( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nVERTEXCOLOR = i; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } + void SetVERTEXCOLOR( bool i ) + { + m_nVERTEXCOLOR = i ? 1 : 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } +private: + int m_nENVMAPMASK; +#ifdef _DEBUG + bool m_bENVMAPMASK; +#endif +public: + void SetENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nENVMAPMASK = i; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } + void SetENVMAPMASK( bool i ) + { + m_nENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } +private: + int m_nBASEALPHAENVMAPMASK; +#ifdef _DEBUG + bool m_bBASEALPHAENVMAPMASK; +#endif +public: + void SetBASEALPHAENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nBASEALPHAENVMAPMASK = i; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } + void SetBASEALPHAENVMAPMASK( bool i ) + { + m_nBASEALPHAENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } +private: + int m_nHDRTYPE; +#ifdef _DEBUG + bool m_bHDRTYPE; +#endif +public: + void SetHDRTYPE( int i ) + { + Assert( i >= 0 && i <= 2 ); + m_nHDRTYPE = i; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } + void SetHDRTYPE( bool i ) + { + m_nHDRTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } +private: + int m_nPARALLAXCORRECT; +#ifdef _DEBUG + bool m_bPARALLAXCORRECT; +#endif +public: + void SetPARALLAXCORRECT( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPARALLAXCORRECT = i; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } + void SetPARALLAXCORRECT( bool i ) + { + m_nPARALLAXCORRECT = i ? 1 : 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } +public: + sdk_shatteredglass_ps20_Static_Index( ) + { +#ifdef _DEBUG + m_bCUBEMAP = false; +#endif // _DEBUG + m_nCUBEMAP = 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = false; +#endif // _DEBUG + m_nVERTEXCOLOR = 0; +#ifdef _DEBUG + m_bENVMAPMASK = false; +#endif // _DEBUG + m_nENVMAPMASK = 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = false; +#endif // _DEBUG + m_nBASEALPHAENVMAPMASK = 0; +#ifdef _DEBUG + m_bHDRTYPE = false; +#endif // _DEBUG + m_nHDRTYPE = 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = false; +#endif // _DEBUG + m_nPARALLAXCORRECT = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllStaticVarsDefined = m_bCUBEMAP && m_bVERTEXCOLOR && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bHDRTYPE && m_bPARALLAXCORRECT; + Assert( bAllStaticVarsDefined ); +#endif // _DEBUG + return ( 2 * m_nCUBEMAP ) + ( 4 * m_nVERTEXCOLOR ) + ( 8 * m_nENVMAPMASK ) + ( 16 * m_nBASEALPHAENVMAPMASK ) + ( 32 * m_nHDRTYPE ) + ( 96 * m_nPARALLAXCORRECT ) + 0; + } +}; +#define shaderStaticTest_sdk_shatteredglass_ps20 psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_PARALLAXCORRECT + 0 +class sdk_shatteredglass_ps20_Dynamic_Index +{ +private: + int m_nPIXELFOGTYPE; +#ifdef _DEBUG + bool m_bPIXELFOGTYPE; +#endif +public: + void SetPIXELFOGTYPE( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPIXELFOGTYPE = i; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } + void SetPIXELFOGTYPE( bool i ) + { + m_nPIXELFOGTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } +public: + sdk_shatteredglass_ps20_Dynamic_Index() + { +#ifdef _DEBUG + m_bPIXELFOGTYPE = false; +#endif // _DEBUG + m_nPIXELFOGTYPE = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE; + Assert( bAllDynamicVarsDefined ); +#endif // _DEBUG + return ( 1 * m_nPIXELFOGTYPE ) + 0; + } +}; +#define shaderDynamicTest_sdk_shatteredglass_ps20 psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0 diff --git a/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20b.inc b/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20b.inc new file mode 100644 index 00000000..5c79bd11 --- /dev/null +++ b/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_ps20b.inc @@ -0,0 +1,212 @@ +#include "shaderlib/cshader.h" +class sdk_shatteredglass_ps20b_Static_Index +{ +private: + int m_nCUBEMAP; +#ifdef _DEBUG + bool m_bCUBEMAP; +#endif +public: + void SetCUBEMAP( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nCUBEMAP = i; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } + void SetCUBEMAP( bool i ) + { + m_nCUBEMAP = i ? 1 : 0; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } +private: + int m_nVERTEXCOLOR; +#ifdef _DEBUG + bool m_bVERTEXCOLOR; +#endif +public: + void SetVERTEXCOLOR( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nVERTEXCOLOR = i; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } + void SetVERTEXCOLOR( bool i ) + { + m_nVERTEXCOLOR = i ? 1 : 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } +private: + int m_nENVMAPMASK; +#ifdef _DEBUG + bool m_bENVMAPMASK; +#endif +public: + void SetENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nENVMAPMASK = i; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } + void SetENVMAPMASK( bool i ) + { + m_nENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } +private: + int m_nBASEALPHAENVMAPMASK; +#ifdef _DEBUG + bool m_bBASEALPHAENVMAPMASK; +#endif +public: + void SetBASEALPHAENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nBASEALPHAENVMAPMASK = i; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } + void SetBASEALPHAENVMAPMASK( bool i ) + { + m_nBASEALPHAENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } +private: + int m_nHDRTYPE; +#ifdef _DEBUG + bool m_bHDRTYPE; +#endif +public: + void SetHDRTYPE( int i ) + { + Assert( i >= 0 && i <= 2 ); + m_nHDRTYPE = i; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } + void SetHDRTYPE( bool i ) + { + m_nHDRTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } +private: + int m_nPARALLAXCORRECT; +#ifdef _DEBUG + bool m_bPARALLAXCORRECT; +#endif +public: + void SetPARALLAXCORRECT( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPARALLAXCORRECT = i; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } + void SetPARALLAXCORRECT( bool i ) + { + m_nPARALLAXCORRECT = i ? 1 : 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } +public: + sdk_shatteredglass_ps20b_Static_Index( ) + { +#ifdef _DEBUG + m_bCUBEMAP = false; +#endif // _DEBUG + m_nCUBEMAP = 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = false; +#endif // _DEBUG + m_nVERTEXCOLOR = 0; +#ifdef _DEBUG + m_bENVMAPMASK = false; +#endif // _DEBUG + m_nENVMAPMASK = 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = false; +#endif // _DEBUG + m_nBASEALPHAENVMAPMASK = 0; +#ifdef _DEBUG + m_bHDRTYPE = false; +#endif // _DEBUG + m_nHDRTYPE = 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = false; +#endif // _DEBUG + m_nPARALLAXCORRECT = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllStaticVarsDefined = m_bCUBEMAP && m_bVERTEXCOLOR && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bHDRTYPE && m_bPARALLAXCORRECT; + Assert( bAllStaticVarsDefined ); +#endif // _DEBUG + return ( 2 * m_nCUBEMAP ) + ( 4 * m_nVERTEXCOLOR ) + ( 8 * m_nENVMAPMASK ) + ( 16 * m_nBASEALPHAENVMAPMASK ) + ( 32 * m_nHDRTYPE ) + ( 96 * m_nPARALLAXCORRECT ) + 0; + } +}; +#define shaderStaticTest_sdk_shatteredglass_ps20b psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_PARALLAXCORRECT + 0 +class sdk_shatteredglass_ps20b_Dynamic_Index +{ +private: + int m_nPIXELFOGTYPE; +#ifdef _DEBUG + bool m_bPIXELFOGTYPE; +#endif +public: + void SetPIXELFOGTYPE( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPIXELFOGTYPE = i; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } + void SetPIXELFOGTYPE( bool i ) + { + m_nPIXELFOGTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } +public: + sdk_shatteredglass_ps20b_Dynamic_Index() + { +#ifdef _DEBUG + m_bPIXELFOGTYPE = false; +#endif // _DEBUG + m_nPIXELFOGTYPE = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE; + Assert( bAllDynamicVarsDefined ); +#endif // _DEBUG + return ( 1 * m_nPIXELFOGTYPE ) + 0; + } +}; +#define shaderDynamicTest_sdk_shatteredglass_ps20b psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0 diff --git a/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_vs20.inc b/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_vs20.inc new file mode 100644 index 00000000..a3e18d53 --- /dev/null +++ b/sp/src/materialsystem/stdshaders/fxctmp9/SDK_ShatteredGlass_vs20.inc @@ -0,0 +1,87 @@ +#include "shaderlib/cshader.h" +class sdk_shatteredglass_vs20_Static_Index +{ +private: + int m_nENVMAP_MASK; +#ifdef _DEBUG + bool m_bENVMAP_MASK; +#endif +public: + void SetENVMAP_MASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nENVMAP_MASK = i; +#ifdef _DEBUG + m_bENVMAP_MASK = true; +#endif + } + void SetENVMAP_MASK( bool i ) + { + m_nENVMAP_MASK = i ? 1 : 0; +#ifdef _DEBUG + m_bENVMAP_MASK = true; +#endif + } +public: + sdk_shatteredglass_vs20_Static_Index( ) + { +#ifdef _DEBUG + m_bENVMAP_MASK = false; +#endif // _DEBUG + m_nENVMAP_MASK = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllStaticVarsDefined = m_bENVMAP_MASK; + Assert( bAllStaticVarsDefined ); +#endif // _DEBUG + return ( 2 * m_nENVMAP_MASK ) + 0; + } +}; +#define shaderStaticTest_sdk_shatteredglass_vs20 vsh_forgot_to_set_static_ENVMAP_MASK + 0 +class sdk_shatteredglass_vs20_Dynamic_Index +{ +private: + int m_nDOWATERFOG; +#ifdef _DEBUG + bool m_bDOWATERFOG; +#endif +public: + void SetDOWATERFOG( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nDOWATERFOG = i; +#ifdef _DEBUG + m_bDOWATERFOG = true; +#endif + } + void SetDOWATERFOG( bool i ) + { + m_nDOWATERFOG = i ? 1 : 0; +#ifdef _DEBUG + m_bDOWATERFOG = true; +#endif + } +public: + sdk_shatteredglass_vs20_Dynamic_Index() + { +#ifdef _DEBUG + m_bDOWATERFOG = false; +#endif // _DEBUG + m_nDOWATERFOG = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllDynamicVarsDefined = m_bDOWATERFOG; + Assert( bAllDynamicVarsDefined ); +#endif // _DEBUG + return ( 1 * m_nDOWATERFOG ) + 0; + } +}; +#define shaderDynamicTest_sdk_shatteredglass_vs20 vsh_forgot_to_set_dynamic_DOWATERFOG + 0 diff --git a/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20.inc b/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20.inc new file mode 100644 index 00000000..161c4c79 --- /dev/null +++ b/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20.inc @@ -0,0 +1,212 @@ +#include "shaderlib/cshader.h" +class sdk_shatteredglass_ps20_Static_Index +{ +private: + int m_nCUBEMAP; +#ifdef _DEBUG + bool m_bCUBEMAP; +#endif +public: + void SetCUBEMAP( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nCUBEMAP = i; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } + void SetCUBEMAP( bool i ) + { + m_nCUBEMAP = i ? 1 : 0; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } +private: + int m_nVERTEXCOLOR; +#ifdef _DEBUG + bool m_bVERTEXCOLOR; +#endif +public: + void SetVERTEXCOLOR( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nVERTEXCOLOR = i; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } + void SetVERTEXCOLOR( bool i ) + { + m_nVERTEXCOLOR = i ? 1 : 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } +private: + int m_nENVMAPMASK; +#ifdef _DEBUG + bool m_bENVMAPMASK; +#endif +public: + void SetENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nENVMAPMASK = i; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } + void SetENVMAPMASK( bool i ) + { + m_nENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } +private: + int m_nBASEALPHAENVMAPMASK; +#ifdef _DEBUG + bool m_bBASEALPHAENVMAPMASK; +#endif +public: + void SetBASEALPHAENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nBASEALPHAENVMAPMASK = i; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } + void SetBASEALPHAENVMAPMASK( bool i ) + { + m_nBASEALPHAENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } +private: + int m_nHDRTYPE; +#ifdef _DEBUG + bool m_bHDRTYPE; +#endif +public: + void SetHDRTYPE( int i ) + { + Assert( i >= 0 && i <= 2 ); + m_nHDRTYPE = i; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } + void SetHDRTYPE( bool i ) + { + m_nHDRTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } +private: + int m_nPARALLAXCORRECT; +#ifdef _DEBUG + bool m_bPARALLAXCORRECT; +#endif +public: + void SetPARALLAXCORRECT( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPARALLAXCORRECT = i; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } + void SetPARALLAXCORRECT( bool i ) + { + m_nPARALLAXCORRECT = i ? 1 : 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } +public: + sdk_shatteredglass_ps20_Static_Index( ) + { +#ifdef _DEBUG + m_bCUBEMAP = false; +#endif // _DEBUG + m_nCUBEMAP = 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = false; +#endif // _DEBUG + m_nVERTEXCOLOR = 0; +#ifdef _DEBUG + m_bENVMAPMASK = false; +#endif // _DEBUG + m_nENVMAPMASK = 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = false; +#endif // _DEBUG + m_nBASEALPHAENVMAPMASK = 0; +#ifdef _DEBUG + m_bHDRTYPE = false; +#endif // _DEBUG + m_nHDRTYPE = 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = false; +#endif // _DEBUG + m_nPARALLAXCORRECT = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllStaticVarsDefined = m_bCUBEMAP && m_bVERTEXCOLOR && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bHDRTYPE && m_bPARALLAXCORRECT; + Assert( bAllStaticVarsDefined ); +#endif // _DEBUG + return ( 2 * m_nCUBEMAP ) + ( 4 * m_nVERTEXCOLOR ) + ( 8 * m_nENVMAPMASK ) + ( 16 * m_nBASEALPHAENVMAPMASK ) + ( 32 * m_nHDRTYPE ) + ( 96 * m_nPARALLAXCORRECT ) + 0; + } +}; +#define shaderStaticTest_sdk_shatteredglass_ps20 psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_PARALLAXCORRECT + 0 +class sdk_shatteredglass_ps20_Dynamic_Index +{ +private: + int m_nPIXELFOGTYPE; +#ifdef _DEBUG + bool m_bPIXELFOGTYPE; +#endif +public: + void SetPIXELFOGTYPE( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPIXELFOGTYPE = i; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } + void SetPIXELFOGTYPE( bool i ) + { + m_nPIXELFOGTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } +public: + sdk_shatteredglass_ps20_Dynamic_Index() + { +#ifdef _DEBUG + m_bPIXELFOGTYPE = false; +#endif // _DEBUG + m_nPIXELFOGTYPE = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE; + Assert( bAllDynamicVarsDefined ); +#endif // _DEBUG + return ( 1 * m_nPIXELFOGTYPE ) + 0; + } +}; +#define shaderDynamicTest_sdk_shatteredglass_ps20 psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0 diff --git a/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20b.inc b/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20b.inc new file mode 100644 index 00000000..5c79bd11 --- /dev/null +++ b/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_ps20b.inc @@ -0,0 +1,212 @@ +#include "shaderlib/cshader.h" +class sdk_shatteredglass_ps20b_Static_Index +{ +private: + int m_nCUBEMAP; +#ifdef _DEBUG + bool m_bCUBEMAP; +#endif +public: + void SetCUBEMAP( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nCUBEMAP = i; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } + void SetCUBEMAP( bool i ) + { + m_nCUBEMAP = i ? 1 : 0; +#ifdef _DEBUG + m_bCUBEMAP = true; +#endif + } +private: + int m_nVERTEXCOLOR; +#ifdef _DEBUG + bool m_bVERTEXCOLOR; +#endif +public: + void SetVERTEXCOLOR( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nVERTEXCOLOR = i; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } + void SetVERTEXCOLOR( bool i ) + { + m_nVERTEXCOLOR = i ? 1 : 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = true; +#endif + } +private: + int m_nENVMAPMASK; +#ifdef _DEBUG + bool m_bENVMAPMASK; +#endif +public: + void SetENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nENVMAPMASK = i; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } + void SetENVMAPMASK( bool i ) + { + m_nENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bENVMAPMASK = true; +#endif + } +private: + int m_nBASEALPHAENVMAPMASK; +#ifdef _DEBUG + bool m_bBASEALPHAENVMAPMASK; +#endif +public: + void SetBASEALPHAENVMAPMASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nBASEALPHAENVMAPMASK = i; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } + void SetBASEALPHAENVMAPMASK( bool i ) + { + m_nBASEALPHAENVMAPMASK = i ? 1 : 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = true; +#endif + } +private: + int m_nHDRTYPE; +#ifdef _DEBUG + bool m_bHDRTYPE; +#endif +public: + void SetHDRTYPE( int i ) + { + Assert( i >= 0 && i <= 2 ); + m_nHDRTYPE = i; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } + void SetHDRTYPE( bool i ) + { + m_nHDRTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bHDRTYPE = true; +#endif + } +private: + int m_nPARALLAXCORRECT; +#ifdef _DEBUG + bool m_bPARALLAXCORRECT; +#endif +public: + void SetPARALLAXCORRECT( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPARALLAXCORRECT = i; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } + void SetPARALLAXCORRECT( bool i ) + { + m_nPARALLAXCORRECT = i ? 1 : 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = true; +#endif + } +public: + sdk_shatteredglass_ps20b_Static_Index( ) + { +#ifdef _DEBUG + m_bCUBEMAP = false; +#endif // _DEBUG + m_nCUBEMAP = 0; +#ifdef _DEBUG + m_bVERTEXCOLOR = false; +#endif // _DEBUG + m_nVERTEXCOLOR = 0; +#ifdef _DEBUG + m_bENVMAPMASK = false; +#endif // _DEBUG + m_nENVMAPMASK = 0; +#ifdef _DEBUG + m_bBASEALPHAENVMAPMASK = false; +#endif // _DEBUG + m_nBASEALPHAENVMAPMASK = 0; +#ifdef _DEBUG + m_bHDRTYPE = false; +#endif // _DEBUG + m_nHDRTYPE = 0; +#ifdef _DEBUG + m_bPARALLAXCORRECT = false; +#endif // _DEBUG + m_nPARALLAXCORRECT = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllStaticVarsDefined = m_bCUBEMAP && m_bVERTEXCOLOR && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bHDRTYPE && m_bPARALLAXCORRECT; + Assert( bAllStaticVarsDefined ); +#endif // _DEBUG + return ( 2 * m_nCUBEMAP ) + ( 4 * m_nVERTEXCOLOR ) + ( 8 * m_nENVMAPMASK ) + ( 16 * m_nBASEALPHAENVMAPMASK ) + ( 32 * m_nHDRTYPE ) + ( 96 * m_nPARALLAXCORRECT ) + 0; + } +}; +#define shaderStaticTest_sdk_shatteredglass_ps20b psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_VERTEXCOLOR + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_HDRTYPE + psh_forgot_to_set_static_PARALLAXCORRECT + 0 +class sdk_shatteredglass_ps20b_Dynamic_Index +{ +private: + int m_nPIXELFOGTYPE; +#ifdef _DEBUG + bool m_bPIXELFOGTYPE; +#endif +public: + void SetPIXELFOGTYPE( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nPIXELFOGTYPE = i; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } + void SetPIXELFOGTYPE( bool i ) + { + m_nPIXELFOGTYPE = i ? 1 : 0; +#ifdef _DEBUG + m_bPIXELFOGTYPE = true; +#endif + } +public: + sdk_shatteredglass_ps20b_Dynamic_Index() + { +#ifdef _DEBUG + m_bPIXELFOGTYPE = false; +#endif // _DEBUG + m_nPIXELFOGTYPE = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllDynamicVarsDefined = m_bPIXELFOGTYPE; + Assert( bAllDynamicVarsDefined ); +#endif // _DEBUG + return ( 1 * m_nPIXELFOGTYPE ) + 0; + } +}; +#define shaderDynamicTest_sdk_shatteredglass_ps20b psh_forgot_to_set_dynamic_PIXELFOGTYPE + 0 diff --git a/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_vs20.inc b/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_vs20.inc new file mode 100644 index 00000000..a3e18d53 --- /dev/null +++ b/sp/src/materialsystem/stdshaders/fxctmp9_tmp/SDK_ShatteredGlass_vs20.inc @@ -0,0 +1,87 @@ +#include "shaderlib/cshader.h" +class sdk_shatteredglass_vs20_Static_Index +{ +private: + int m_nENVMAP_MASK; +#ifdef _DEBUG + bool m_bENVMAP_MASK; +#endif +public: + void SetENVMAP_MASK( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nENVMAP_MASK = i; +#ifdef _DEBUG + m_bENVMAP_MASK = true; +#endif + } + void SetENVMAP_MASK( bool i ) + { + m_nENVMAP_MASK = i ? 1 : 0; +#ifdef _DEBUG + m_bENVMAP_MASK = true; +#endif + } +public: + sdk_shatteredglass_vs20_Static_Index( ) + { +#ifdef _DEBUG + m_bENVMAP_MASK = false; +#endif // _DEBUG + m_nENVMAP_MASK = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllStaticVarsDefined = m_bENVMAP_MASK; + Assert( bAllStaticVarsDefined ); +#endif // _DEBUG + return ( 2 * m_nENVMAP_MASK ) + 0; + } +}; +#define shaderStaticTest_sdk_shatteredglass_vs20 vsh_forgot_to_set_static_ENVMAP_MASK + 0 +class sdk_shatteredglass_vs20_Dynamic_Index +{ +private: + int m_nDOWATERFOG; +#ifdef _DEBUG + bool m_bDOWATERFOG; +#endif +public: + void SetDOWATERFOG( int i ) + { + Assert( i >= 0 && i <= 1 ); + m_nDOWATERFOG = i; +#ifdef _DEBUG + m_bDOWATERFOG = true; +#endif + } + void SetDOWATERFOG( bool i ) + { + m_nDOWATERFOG = i ? 1 : 0; +#ifdef _DEBUG + m_bDOWATERFOG = true; +#endif + } +public: + sdk_shatteredglass_vs20_Dynamic_Index() + { +#ifdef _DEBUG + m_bDOWATERFOG = false; +#endif // _DEBUG + m_nDOWATERFOG = 0; + } + int GetIndex() + { + // Asserts to make sure that we aren't using any skipped combinations. + // Asserts to make sure that we are setting all of the combination vars. +#ifdef _DEBUG + bool bAllDynamicVarsDefined = m_bDOWATERFOG; + Assert( bAllDynamicVarsDefined ); +#endif // _DEBUG + return ( 1 * m_nDOWATERFOG ) + 0; + } +}; +#define shaderDynamicTest_sdk_shatteredglass_vs20 vsh_forgot_to_set_dynamic_DOWATERFOG + 0 diff --git a/sp/src/materialsystem/stdshaders/refract_dx9_helper.cpp b/sp/src/materialsystem/stdshaders/refract_dx9_helper.cpp index 05689c24..757928bf 100644 --- a/sp/src/materialsystem/stdshaders/refract_dx9_helper.cpp +++ b/sp/src/materialsystem/stdshaders/refract_dx9_helper.cpp @@ -76,6 +76,19 @@ void InitRefract_DX9( CBaseVSShader *pShader, IMaterialVar** params, Refract_DX9 if( params[info.m_nEnvmap]->IsDefined() ) { pShader->LoadCubeMap( info.m_nEnvmap, TEXTUREFLAGS_SRGB ); + +#ifdef MAPBASE + if (mat_specular_disable_on_missing.GetBool()) + { + // Revert to defaultcubemap when the envmap texture is missing + // (should be equivalent to toolsblack in Mapbase) + if (!IS_FLAG_SET( MATERIAL_VAR_MODEL ) && params[info.m_nEnvmap]->GetTextureValue()->IsError()) + { + params[info.m_nEnvmap]->SetStringValue( "engine/defaultcubemap" ); + pShader->LoadCubeMap( info.m_nEnvmap, TEXTUREFLAGS_SRGB ); + } + } +#endif } if( params[info.m_nRefractTintTexture]->IsDefined() ) { diff --git a/sp/src/materialsystem/stdshaders/water.cpp b/sp/src/materialsystem/stdshaders/water.cpp index 74374334..27b807de 100644 --- a/sp/src/materialsystem/stdshaders/water.cpp +++ b/sp/src/materialsystem/stdshaders/water.cpp @@ -151,6 +151,19 @@ BEGIN_VS_SHADER( SDK_Water_DX90, if ( params[ENVMAP]->IsDefined() ) { LoadCubeMap( ENVMAP, TEXTUREFLAGS_SRGB ); + +#ifdef MAPBASE + if (mat_specular_disable_on_missing.GetBool()) + { + // Revert to defaultcubemap when the envmap texture is missing + // (should be equivalent to toolsblack in Mapbase) + if (params[ENVMAP]->GetTextureValue()->IsError()) + { + params[ENVMAP]->SetStringValue( "engine/defaultcubemap" ); + LoadCubeMap( ENVMAP, TEXTUREFLAGS_SRGB ); + } + } +#endif } if ( params[NORMALMAP]->IsDefined() ) { diff --git a/sp/src/utils/vbsp/cubemap.cpp b/sp/src/utils/vbsp/cubemap.cpp index 9156900e..b44e739b 100644 --- a/sp/src/utils/vbsp/cubemap.cpp +++ b/sp/src/utils/vbsp/cubemap.cpp @@ -689,7 +689,7 @@ static int Cubemap_CreateTexInfo( int originalTexInfo, int origin[3] ) #ifdef PARALLAX_CORRECTED_CUBEMAPS // Append origin info if this cubemap has a parallax OBB char originAppendedString[1024] = ""; - if (g_pParallaxObbStrs[cubemapIndex][0] != '\0') + if (g_pParallaxObbStrs[cubemapIndex] && g_pParallaxObbStrs[cubemapIndex][0] != '\0') { Q_snprintf(originAppendedString, 1024, "%s;[%d %d %d]", g_pParallaxObbStrs[cubemapIndex], origin[0], origin[1], origin[2]); }