mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2025-01-24 20:57:58 +03:00
Merged dev changes 10/24/2019
- Applied the nexttoken security fix (suggested by ficool2, important for MP port, no #ifdef MAPBASE because of volume of changes and irrelevance to readers) - Fixed a crash with the follower wait point start/stop using handlers - Fixed game_ui activator crash - Changed vphysics triggers to accept more entities - Fixed player squadmates not obeying hint node facing (e.g. wait points) - Fixed npc_snipers - prop_vehicle_jeep_old no longer changes classname - Restored and added the other CTakeDamageInfo fields for point_damageinfo - Fixed game_metadata not saving correctly - Fixed logic_measure_movement not functioning while possessing spawnflags - Added scripts/mapbase_rpc.txt script with choosable app ID and game image - Fixed some casing that broke Linux support - Added proper WorldVertexTransition blending to translucency and selfillum (translucency may need the translucent texture to be $basetexture, not $basetexture2) - Added modified parallax corrected cubemaps to shader code (although currently unusable) - Fixed Variant_ParseInput - Added/restored custom scanner speed (experimental, needs more work) - Several miscellaneous code changes/fixes and comment adjustments
This commit is contained in:
parent
756caa92e4
commit
27b026c5d9
1
README
1
README
@ -7,6 +7,7 @@ The original code for phong reflections on LightmappedGeneric-derived shaders ar
|
||||
The Alien Swarm-based radial fog and rope code as well as the multiple skybox support are from Half-Life 2: Downfall. (https://github.com/DownFall-Team/DownFall)
|
||||
The dynamic RTT shadow angles code is from Saul Rennison on the VDC. (https://developer.valvesoftware.com/wiki/Dynamic_RTT_shadow_angles_in_Source_2007)
|
||||
The vortigaunt LOS fix is from Half-Life 2: Community Edition (dky.tehkingd.u in particular). (https://gitlab.com/RaraCerberus/HL2CE)
|
||||
The parallax corrected cubemap code (which is partly in Mapbase's code, but not yet usable) was originally created by Brian Charles. (https://developer.valvesoftware.com/wiki/Parallax_Corrected_Cubemaps)
|
||||
Various other code and contributions were based off of pull requests in the Source 2013 SDK (https://github.com/ValveSoftware/source-sdk-2013/pulls) and snippets on the Valve Developer Community (http://developer.valvesoftware.com/).
|
||||
|
||||
All of the work mentioned above was open source when it was borrowed.
|
||||
|
@ -3542,7 +3542,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
||||
int weaponType = 0;
|
||||
|
||||
// Get the first parameter
|
||||
p = nexttoken( token, p, ' ' );
|
||||
p = nexttoken( token, p, ' ' , sizeof(token) );
|
||||
|
||||
// Find the weapon type
|
||||
if ( token )
|
||||
@ -3586,7 +3586,7 @@ bool C_BaseAnimating::DispatchMuzzleEffect( const char *options, bool isFirstPer
|
||||
}
|
||||
|
||||
// Get the second parameter
|
||||
p = nexttoken( token, p, ' ' );
|
||||
p = nexttoken( token, p, ' ' , sizeof(token) );
|
||||
|
||||
int attachmentIndex = -1;
|
||||
|
||||
@ -3697,7 +3697,7 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
||||
|
||||
// Get the particle effect name
|
||||
const char *p = options;
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
if ( token )
|
||||
{
|
||||
const char* mtoken = ModifyEventParticles( token );
|
||||
@ -3707,7 +3707,7 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
||||
}
|
||||
|
||||
// Get the attachment type
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
if ( token )
|
||||
{
|
||||
iAttachType = GetAttachTypeFromString( token );
|
||||
@ -3719,7 +3719,7 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
||||
}
|
||||
|
||||
// Get the attachment point index
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
if ( token )
|
||||
{
|
||||
iAttachment = atoi(token);
|
||||
@ -3924,14 +3924,14 @@ void C_BaseAnimating::FireEvent( const Vector& origin, const QAngle& angles, int
|
||||
const char *p = options;
|
||||
|
||||
// Bodygroup Name
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
if ( token )
|
||||
{
|
||||
Q_strncpy( szBodygroupName, token, sizeof(szBodygroupName) );
|
||||
}
|
||||
|
||||
// Get the desired value
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
if ( token )
|
||||
{
|
||||
value = atoi( token );
|
||||
@ -3971,21 +3971,21 @@ void C_BaseAnimating::FireObsoleteEvent( const Vector& origin, const QAngle& ang
|
||||
|
||||
const char *p = options;
|
||||
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
|
||||
if( token )
|
||||
{
|
||||
Q_strncpy( effectFunc, token, sizeof(effectFunc) );
|
||||
}
|
||||
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
|
||||
if( token )
|
||||
{
|
||||
iAttachment = atoi(token);
|
||||
}
|
||||
|
||||
p = nexttoken(token, p, ' ');
|
||||
p = nexttoken(token, p, ' ', sizeof(token));
|
||||
|
||||
if( token )
|
||||
{
|
||||
|
@ -747,11 +747,14 @@ CBaseEntity *CEntitySphereQuery::GetCurrentEntity()
|
||||
// sep - Character to use as separator. UNDONE: allow multiple separator chars
|
||||
// Output : Returns a pointer to the next token to be parsed.
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *nexttoken(char *token, const char *str, char sep)
|
||||
const char *nexttoken(char *token, const char *str, char sep, size_t tokenLen)
|
||||
{
|
||||
if ((str == NULL) || (*str == '\0'))
|
||||
{
|
||||
*token = '\0';
|
||||
if(tokenLen)
|
||||
{
|
||||
*token = '\0';
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -759,11 +762,25 @@ const char *nexttoken(char *token, const char *str, char sep)
|
||||
// Copy everything up to the first separator into the return buffer.
|
||||
// Do not include separators in the return buffer.
|
||||
//
|
||||
while ((*str != sep) && (*str != '\0'))
|
||||
while ((*str != sep) && (*str != '\0') && (tokenLen > 1))
|
||||
{
|
||||
*token++ = *str++;
|
||||
tokenLen--;
|
||||
}
|
||||
|
||||
//
|
||||
// If token is to big for return buffer, skip rest of token.
|
||||
//
|
||||
while ((*str != sep) && (*str != '\0'))
|
||||
{
|
||||
str++;
|
||||
}
|
||||
|
||||
if(tokenLen)
|
||||
{
|
||||
*token = '\0';
|
||||
tokenLen--;
|
||||
}
|
||||
*token = '\0';
|
||||
|
||||
//
|
||||
// Advance the pointer unless we hit the end of the input string.
|
||||
|
@ -89,7 +89,7 @@ void NormalizeAngles( QAngle& angles );
|
||||
void InterpolateAngles( const QAngle& start, const QAngle& end, QAngle& output, float frac );
|
||||
void InterpolateVector( float frac, const Vector& src, const Vector& dest, Vector& output );
|
||||
|
||||
const char *nexttoken(char *token, const char *str, char sep);
|
||||
const char *nexttoken(char *token, const char *str, char sep, size_t tokenLen);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Base light indices to avoid index collision
|
||||
|
@ -1259,15 +1259,11 @@ CClientShadowMgr::CClientShadowMgr() :
|
||||
m_nPrevFrameCount( -1 ),
|
||||
#endif
|
||||
m_RenderToTextureActive( false ),
|
||||
#ifdef ASW_PROJECTED_TEXTURES
|
||||
m_bDepthTextureActive( false ),
|
||||
#else
|
||||
m_bDepthTextureActive( false )
|
||||
#endif
|
||||
#ifdef DYNAMIC_RTT_SHADOWS
|
||||
m_bShadowFromWorldLights( false ),
|
||||
m_bSuppressShadowFromWorldLights( false )
|
||||
m_bSuppressShadowFromWorldLights( false ),
|
||||
#endif
|
||||
m_bDepthTextureActive( false )
|
||||
{
|
||||
m_nDepthTextureResolution = r_flashlightdepthres.GetInt();
|
||||
m_bThreaded = false;
|
||||
|
@ -2364,11 +2364,11 @@ bool CHudCloseCaption::AddAsyncWork( const char *tokenstream, bool bIsStream, fl
|
||||
char tokenname[ 512 ];
|
||||
tokenname[ 0 ] = 0;
|
||||
const char *p = tokenstream;
|
||||
p = nexttoken( tokenname, p, ' ' );
|
||||
p = nexttoken( tokenname, p, ' ' , sizeof(tokenname) );
|
||||
// p points to reset of sentence tokens, build up a unicode string from them...
|
||||
while ( p && Q_strlen( tokenname ) > 0 )
|
||||
{
|
||||
p = nexttoken( tokenname, p, ' ' );
|
||||
p = nexttoken( tokenname, p, ' ' , sizeof(tokenname) );
|
||||
|
||||
if ( Q_strlen( tokenname ) == 0 )
|
||||
break;
|
||||
@ -2403,7 +2403,7 @@ void CHudCloseCaption::ProcessSentenceCaptionStream( const char *tokenstream )
|
||||
|
||||
const char *p = tokenstream;
|
||||
|
||||
p = nexttoken( tokenname, p, ' ' );
|
||||
p = nexttoken( tokenname, p, ' ' , sizeof(tokenname) );
|
||||
|
||||
if ( Q_strlen( tokenname ) > 0 )
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ Vector CRagdollMagnet::GetForceVector( CBaseEntity *pNPC )
|
||||
if (pBone)
|
||||
{
|
||||
CBaseAnimating *pAnimating = pNPC->GetBaseAnimating();
|
||||
Assert( pAniamting != NULL );
|
||||
Assert( pAnimating != NULL );
|
||||
|
||||
const char *szBoneTarget = BoneTarget();
|
||||
Assert( szBoneTarget != NULL );
|
||||
|
@ -921,7 +921,7 @@ void CAI_FollowBehavior::ClearFollowPoint()
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
// If we were in range, we were probably already using it
|
||||
if ((GetHintNode()->GetAbsOrigin() - GetFollowTarget()->GetAbsOrigin()).LengthSqr() < Square(MAX(m_FollowNavGoal.followPointTolerance, GetGoalRange())))
|
||||
if (GetFollowTarget() && (GetHintNode()->GetAbsOrigin() - GetFollowTarget()->GetAbsOrigin()).LengthSqr() < Square(MAX(m_FollowNavGoal.followPointTolerance, GetGoalRange())))
|
||||
GetHintNode()->NPCStoppedUsing(GetOuter());
|
||||
#endif
|
||||
GetHintNode()->Unlock();
|
||||
|
@ -70,7 +70,7 @@ CON_COMMAND( ai_debug_node_connect, "Debug the attempted connection between two
|
||||
|
||||
ConVar g_ai_norebuildgraph( "ai_norebuildgraph", "0" );
|
||||
#ifdef MAPBASE
|
||||
ConVar g_ai_nographrebuildmessage( "ai_nographrebuildmessage", "0", FCVAR_ARCHIVE, "Stops the \"Node graph out of date\" message from appearing when rbeuilding node graph" );
|
||||
ConVar g_ai_nographrebuildmessage( "ai_nographrebuildmessage", "0", FCVAR_ARCHIVE, "Stops the \"Node graph out of date\" message from appearing when rebuilding node graph" );
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -1736,6 +1736,12 @@ void CAI_PlayerAlly::ModifyOrAppendCriteria( AI_CriteriaSet& set )
|
||||
{
|
||||
BaseClass::ModifyOrAppendCriteria( set );
|
||||
|
||||
#ifdef MAPBASE
|
||||
// For the below speechtarget criteria
|
||||
if (GetSpeechTarget() && !m_hPotentialSpeechTarget)
|
||||
m_hPotentialSpeechTarget = GetSpeechTarget();
|
||||
#endif
|
||||
|
||||
if ( m_hPotentialSpeechTarget )
|
||||
{
|
||||
set.AppendCriteria( "speechtarget", m_hPotentialSpeechTarget->GetClassname() );
|
||||
|
@ -5070,7 +5070,7 @@ void CBaseEntity::PrecacheModelComponents( int nModelIndex )
|
||||
{
|
||||
char token[256];
|
||||
const char *pOptions = pEvent->pszOptions();
|
||||
nexttoken( token, pOptions, ' ' );
|
||||
nexttoken( token, pOptions, ' ', sizeof( token ) );
|
||||
if ( token )
|
||||
{
|
||||
PrecacheParticleSystem( token );
|
||||
|
@ -136,7 +136,7 @@ CEventAction::CEventAction( const char *ActionData )
|
||||
//
|
||||
// Parse the target name.
|
||||
//
|
||||
const char *psz = nexttoken(szToken, ActionData, ',');
|
||||
const char *psz = nexttoken(szToken, ActionData, ',', sizeof(szToken));
|
||||
if (szToken[0] != '\0')
|
||||
{
|
||||
m_iTarget = AllocPooledString(szToken);
|
||||
@ -145,7 +145,7 @@ CEventAction::CEventAction( const char *ActionData )
|
||||
//
|
||||
// Parse the input name.
|
||||
//
|
||||
psz = nexttoken(szToken, psz, ',');
|
||||
psz = nexttoken(szToken, psz, ',', sizeof(szToken));
|
||||
if (szToken[0] != '\0')
|
||||
{
|
||||
m_iTargetInput = AllocPooledString(szToken);
|
||||
@ -158,7 +158,7 @@ CEventAction::CEventAction( const char *ActionData )
|
||||
//
|
||||
// Parse the parameter override.
|
||||
//
|
||||
psz = nexttoken(szToken, psz, ',');
|
||||
psz = nexttoken(szToken, psz, ',', sizeof(szToken));
|
||||
if (szToken[0] != '\0')
|
||||
{
|
||||
m_iParameter = AllocPooledString(szToken);
|
||||
@ -167,7 +167,7 @@ CEventAction::CEventAction( const char *ActionData )
|
||||
//
|
||||
// Parse the delay.
|
||||
//
|
||||
psz = nexttoken(szToken, psz, ',');
|
||||
psz = nexttoken(szToken, psz, ',', sizeof(szToken));
|
||||
if (szToken[0] != '\0')
|
||||
{
|
||||
m_flDelay = atof(szToken);
|
||||
@ -176,7 +176,7 @@ CEventAction::CEventAction( const char *ActionData )
|
||||
//
|
||||
// Parse the number of times to fire.
|
||||
//
|
||||
nexttoken(szToken, psz, ',');
|
||||
nexttoken(szToken, psz, ',', sizeof(szToken));
|
||||
if (szToken[0] != '\0')
|
||||
{
|
||||
m_nTimesToFire = atoi(szToken);
|
||||
|
@ -214,7 +214,11 @@ void CGameUI::Deactivate( CBaseEntity *pActivator )
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
Warning("%s Deactivate(): I have no player when called by %s!\n", GetEntityName().ToCStr(), pActivator ? pActivator->GetEntityName().ToCStr() : "(null)");
|
||||
#else
|
||||
Warning("%s Deactivate(): I have no player when called by %s!\n", GetEntityName().ToCStr(), pActivator->GetEntityName().ToCStr());
|
||||
#endif
|
||||
}
|
||||
|
||||
// Stop thinking
|
||||
|
@ -1655,7 +1655,7 @@ void CNPC_BaseZombie::HandleAnimEvent( animevent_t *pEvent )
|
||||
|
||||
const char *pString = pEvent->options;
|
||||
char token[128];
|
||||
pString = nexttoken( token, pString, ' ' );
|
||||
pString = nexttoken( token, pString, ' ', sizeof(token) );
|
||||
|
||||
int boneIndex = GetInteractionPartner()->LookupBone( token );
|
||||
|
||||
@ -1665,7 +1665,7 @@ void CNPC_BaseZombie::HandleAnimEvent( animevent_t *pEvent )
|
||||
return;
|
||||
}
|
||||
|
||||
pString = nexttoken( token, pString, ' ' );
|
||||
pString = nexttoken( token, pString, ' ', sizeof( token ) );
|
||||
|
||||
if ( !token )
|
||||
{
|
||||
|
@ -41,6 +41,10 @@ BEGIN_DATADESC( CNPC_BaseScanner )
|
||||
DEFINE_FIELD( m_flAttackFarDist, FIELD_FLOAT ),
|
||||
DEFINE_FIELD( m_flAttackRange, FIELD_FLOAT ),
|
||||
|
||||
#ifdef MAPBASE
|
||||
DEFINE_KEYFIELD( m_flCustomMaxSpeed, FIELD_FLOAT, "CustomFlightSpeed" ),
|
||||
#endif
|
||||
|
||||
DEFINE_FIELD( m_nPoseTail, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( m_nPoseDynamo, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( m_nPoseFlare, FIELD_INTEGER ),
|
||||
@ -52,7 +56,11 @@ BEGIN_DATADESC( CNPC_BaseScanner )
|
||||
DEFINE_FIELD( m_pSmokeTrail, FIELD_CLASSPTR ),
|
||||
|
||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDistanceOverride", InputSetDistanceOverride ),
|
||||
#ifdef MAPBASE
|
||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetFlightSpeed", InputSetFlightSpeed ),
|
||||
#else
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetFlightSpeed", InputSetFlightSpeed ),
|
||||
#endif
|
||||
|
||||
DEFINE_THINKFUNC( DiveBombSoundThink ),
|
||||
END_DATADESC()
|
||||
@ -861,12 +869,16 @@ void CNPC_BaseScanner::SpeakSentence( int sentenceType )
|
||||
//-----------------------------------------------------------------------------
|
||||
void CNPC_BaseScanner::InputSetFlightSpeed(inputdata_t &inputdata)
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
m_flCustomMaxSpeed = inputdata.value.Float();
|
||||
#else
|
||||
//FIXME: Currently unsupported
|
||||
|
||||
/*
|
||||
m_flFlightSpeed = inputdata.value.Int();
|
||||
m_bFlightSpeedOverridden = (m_flFlightSpeed > 0);
|
||||
*/
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -1655,6 +1667,11 @@ void CNPC_BaseScanner::PainSound( const CTakeDamageInfo &info )
|
||||
//-----------------------------------------------------------------------------
|
||||
float CNPC_BaseScanner::GetMaxSpeed()
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
if (m_flCustomMaxSpeed > 0.0f)
|
||||
return m_flCustomMaxSpeed;
|
||||
#endif
|
||||
|
||||
return SCANNER_MAX_SPEED;
|
||||
}
|
||||
|
||||
|
@ -200,6 +200,11 @@ protected:
|
||||
float m_flAttackFarDist;
|
||||
float m_flAttackRange;
|
||||
|
||||
#ifdef MAPBASE
|
||||
// Custom max speed for mappers to control
|
||||
float m_flCustomMaxSpeed;
|
||||
#endif
|
||||
|
||||
private:
|
||||
CSoundPatch *m_pEngineSound;
|
||||
|
||||
|
@ -1556,14 +1556,14 @@ Activity CNPC_Combine::NPC_TranslateActivity( Activity eNewActivity )
|
||||
}
|
||||
}
|
||||
#ifdef MAPBASE
|
||||
else if (!GetActiveWeapon() && npc_combine_unarmed_anims.GetBool())
|
||||
else if (!GetActiveWeapon() && npc_combine_unarmed_anims.GetBool() && HaveSequenceForActivity(ACT_IDLE_UNARMED))
|
||||
{
|
||||
if (eNewActivity == ACT_IDLE || eNewActivity == ACT_IDLE_ANGRY)
|
||||
eNewActivity = ACT_IDLE_UNARMED;
|
||||
else if (eNewActivity == ACT_WALK)
|
||||
eNewActivity = ACT_WALK_UNARMED;
|
||||
}
|
||||
else if (eNewActivity == ACT_WALK && m_NPCState == NPC_STATE_IDLE && npc_combine_idle_walk_easy.GetBool())
|
||||
else if (eNewActivity == ACT_WALK && m_NPCState == NPC_STATE_IDLE && npc_combine_idle_walk_easy.GetBool() && HaveSequenceForActivity(ACT_WALK_EASY))
|
||||
{
|
||||
eNewActivity = ACT_WALK_EASY;
|
||||
}
|
||||
@ -3528,11 +3528,7 @@ Vector CNPC_Combine::EyePosition( void )
|
||||
//-----------------------------------------------------------------------------
|
||||
Vector CNPC_Combine::GetAltFireTarget()
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
Assert( IsAltFireCapable() );
|
||||
#else
|
||||
Assert( IsElite() );
|
||||
#endif
|
||||
|
||||
return m_vecAltFireTarget;
|
||||
}
|
||||
|
@ -1531,7 +1531,7 @@ void CNPC_Manhack::Slice( CBaseEntity *pHitEntity, float flInterval, trace_t &tr
|
||||
|
||||
// Spawn some extra blood where we hit
|
||||
#ifdef MAPBASE
|
||||
if ( pHitEntity->BloodColor() == DONT_BLEED || (m_bHackedByAlyx && !pHitEntity->PassesDamageFilter(info)) )
|
||||
if ( pHitEntity->BloodColor() == DONT_BLEED || (IRelationType(pHitEntity) > D_FR && !pHitEntity->PassesDamageFilter(info)) )
|
||||
#else
|
||||
if ( pHitEntity->BloodColor() == DONT_BLEED )
|
||||
#endif
|
||||
|
@ -1093,6 +1093,12 @@ bool CNPC_PlayerCompanion::IsValidReasonableFacing( const Vector &vecSightDir, f
|
||||
|
||||
if( ai_new_aiming.GetBool() )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
// Hint node facing should still be obeyed
|
||||
if (GetHintNode() && GetHintNode()->GetIgnoreFacing() != HIF_YES)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
Vector vecEyePositionCentered = GetAbsOrigin();
|
||||
vecEyePositionCentered.z = EyePosition().z;
|
||||
|
||||
@ -1928,11 +1934,10 @@ bool CNPC_PlayerCompanion::IsReadinessCapable()
|
||||
pWeapon->ActivityOverride( ACT_IDLE_AGITATED, NULL ) == ACT_IDLE_AGITATED )
|
||||
return false;
|
||||
|
||||
#ifdef MAPBASE
|
||||
if (LookupActivity( "ACT_IDLE_AIM_RIFLE_STIMULATED" ) == ACT_INVALID)
|
||||
return false;
|
||||
|
||||
if (EntIsClass(GetActiveWeapon(), gm_isz_class_RPG))
|
||||
#else
|
||||
if (FClassnameIs( GetActiveWeapon(), "weapon_rpg" ))
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
|
@ -990,7 +990,12 @@ void CNPC_CScanner::DeployMine()
|
||||
//-----------------------------------------------------------------------------
|
||||
float CNPC_CScanner::GetMaxSpeed()
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
// Don't stomp custom max speed in base class
|
||||
if( IsStriderScout() && m_flCustomMaxSpeed <= 0.0f )
|
||||
#else
|
||||
if( IsStriderScout() )
|
||||
#endif
|
||||
{
|
||||
return SCANNER_SCOUT_MAX_SPEED;
|
||||
}
|
||||
|
@ -602,7 +602,7 @@ bool CProtoSniper::QuerySeeEntity( CBaseEntity *pEntity, bool bOnlyHateOrFearIfN
|
||||
{
|
||||
Disposition_t disp = IRelationType(pEntity);
|
||||
#ifdef MAPBASE
|
||||
if( disp <= D_FR )
|
||||
if( disp > D_FR )
|
||||
#else
|
||||
if( disp != D_HT )
|
||||
#endif
|
||||
|
@ -177,12 +177,6 @@ CPropJeep::CPropJeep( void )
|
||||
|
||||
m_bUnableToFire = true;
|
||||
m_flAmmoCrateCloseTime = 0;
|
||||
|
||||
#ifdef MAPBASE
|
||||
// Turn prop_vehicle_jeep_olds into prop_vehicle_jeeps
|
||||
if (FStrEq(GetClassname(), "prop_vehicle_jeep_old"))
|
||||
SetClassname("prop_vehicle_jeep");
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -1163,7 +1163,11 @@ void CPlayerPickupController::Use( CBaseEntity *pActivator, CBaseEntity *pCaller
|
||||
Vector vecLaunch;
|
||||
m_pPlayer->EyeVectors( &vecLaunch );
|
||||
// JAY: Scale this with mass because some small objects really go flying
|
||||
#ifdef MAPBASE
|
||||
float massFactor = pPhys ? clamp( pPhys->GetMass(), 0.5, 15 ) : 7.5;
|
||||
#else
|
||||
float massFactor = clamp( pPhys->GetMass(), 0.5, 15 );
|
||||
#endif
|
||||
massFactor = RemapVal( massFactor, 0.5, 15, 0.5, 4 );
|
||||
vecLaunch *= player_throwforce.GetFloat() * massFactor;
|
||||
|
||||
|
@ -276,7 +276,7 @@ void CLogicMeasureMovement::MeasureThink( )
|
||||
if (m_bOutputPosition)
|
||||
{
|
||||
m_OutPosition.Set(vecNewOrigin, m_hTarget.Get(), this);
|
||||
m_OutAngles.Set(Vector(vecNewAngles.x, vecNewAngles.y, vecNewAngles.z), m_hTarget.Get(), this);
|
||||
m_OutAngles.Set(*(reinterpret_cast<Vector*>(vecNewAngles.Base())), m_hTarget.Get(), this);
|
||||
}
|
||||
|
||||
if (HasSpawnFlags( SF_LOGIC_MEASURE_MOVEMENT_TELEPORT ))
|
||||
@ -369,31 +369,6 @@ void CLogicMeasureMovement::DoMeasure( Vector &vecOrigin, QAngle &angAngles )
|
||||
}
|
||||
|
||||
ConcatTransforms( matWorldToMeasure, m_hMeasureReference->EntityToWorldTransform(), matRefToMeasure );
|
||||
|
||||
// If we have spawn flags, we might be supposed to ignore something
|
||||
if (GetSpawnFlags() > 0)
|
||||
{
|
||||
if (HasSpawnFlags( SF_LOGIC_MEASURE_MOVEMENT_USE_IGNORE_FLAGS_FOR_ORIGIN ))
|
||||
{
|
||||
// Get the position from the matrix's column directly and re-assign it
|
||||
Vector vecPosition;
|
||||
MatrixGetColumn( matRefToMeasure, 3, vecPosition );
|
||||
|
||||
HandleIgnoreFlags( vecPosition.Base() );
|
||||
|
||||
MatrixSetColumn( vecPosition, 3, matRefToMeasure );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the angles from the matrix and re-assign it
|
||||
QAngle angMod;
|
||||
MatrixAngles( matWorldToMeasure, angMod );
|
||||
|
||||
HandleIgnoreFlags( angMod.Base() );
|
||||
|
||||
AngleMatrix( angMod, matWorldToMeasure );
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the scale factor
|
||||
if ( ( m_flScale != 0.0f ) && ( m_flScale != 1.0f ) )
|
||||
@ -408,9 +383,27 @@ void CLogicMeasureMovement::DoMeasure( Vector &vecOrigin, QAngle &angAngles )
|
||||
matrix3x4_t matMeasureToRef, matNewTargetToWorld;
|
||||
MatrixInvert( matRefToMeasure, matMeasureToRef );
|
||||
|
||||
// Handle origin ignorance
|
||||
if (HasSpawnFlags( SF_LOGIC_MEASURE_MOVEMENT_USE_IGNORE_FLAGS_FOR_ORIGIN ))
|
||||
{
|
||||
// Get the position from the matrix's column directly and re-assign it
|
||||
Vector vecPosition;
|
||||
MatrixGetColumn( matRefToMeasure, 3, vecPosition );
|
||||
|
||||
HandleIgnoreFlags( vecPosition.Base() );
|
||||
|
||||
MatrixSetColumn( vecPosition, 3, matRefToMeasure );
|
||||
}
|
||||
|
||||
ConcatTransforms( m_hTargetReference->EntityToWorldTransform(), matMeasureToRef, matNewTargetToWorld );
|
||||
|
||||
MatrixAngles( matNewTargetToWorld, angAngles, vecOrigin );
|
||||
|
||||
// If our spawnflags are greater than 0 (and don't just contain our default "TELEPORT" flag), we might need to ignore one of our angles.
|
||||
if (GetSpawnFlags() && GetSpawnFlags() != SF_LOGIC_MEASURE_MOVEMENT_TELEPORT && !HasSpawnFlags(SF_LOGIC_MEASURE_MOVEMENT_USE_IGNORE_FLAGS_FOR_ORIGIN))
|
||||
{
|
||||
HandleIgnoreFlags( angAngles.Base() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -765,31 +758,6 @@ void CLogicMirrorMovement::DoMeasure( Vector &vecOrigin, QAngle &angAngles )
|
||||
}
|
||||
|
||||
ConcatTransforms( matWorldToMeasure, m_hMeasureReference->EntityToWorldTransform(), matRefToMeasure );
|
||||
|
||||
// If we have spawn flags, we might be supposed to ignore something
|
||||
if (GetSpawnFlags() > 0)
|
||||
{
|
||||
if (HasSpawnFlags( SF_LOGIC_MEASURE_MOVEMENT_USE_IGNORE_FLAGS_FOR_ORIGIN ))
|
||||
{
|
||||
// Get the position from the matrix's column directly and re-assign it
|
||||
Vector vecPosition;
|
||||
MatrixGetColumn( matRefToMeasure, 3, vecPosition );
|
||||
|
||||
HandleIgnoreFlags( vecPosition.Base() );
|
||||
|
||||
MatrixSetColumn( vecPosition, 3, matRefToMeasure );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get the angles from the matrix and re-assign it
|
||||
QAngle angMod;
|
||||
MatrixAngles( matWorldToMeasure, angMod );
|
||||
|
||||
HandleIgnoreFlags( angMod.Base() );
|
||||
|
||||
AngleMatrix( angMod, matWorldToMeasure );
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the scale factor
|
||||
if ( ( m_flScale != 0.0f ) && ( m_flScale != 1.0f ) )
|
||||
@ -814,10 +782,28 @@ void CLogicMirrorMovement::DoMeasure( Vector &vecOrigin, QAngle &angAngles )
|
||||
matrix3x4_t matMeasureToRef, matNewTargetToWorld;
|
||||
MatrixInvert( matRefToMeasure, matMeasureToRef );
|
||||
|
||||
// Handle origin ignorance
|
||||
if (HasSpawnFlags( SF_LOGIC_MEASURE_MOVEMENT_USE_IGNORE_FLAGS_FOR_ORIGIN ))
|
||||
{
|
||||
// Get the position from the matrix's column directly and re-assign it
|
||||
Vector vecPosition;
|
||||
MatrixGetColumn( matRefToMeasure, 3, vecPosition );
|
||||
|
||||
HandleIgnoreFlags( vecPosition.Base() );
|
||||
|
||||
MatrixSetColumn( vecPosition, 3, matRefToMeasure );
|
||||
}
|
||||
|
||||
ConcatTransforms( m_hTargetReference->EntityToWorldTransform(), matMeasureToRef, matNewTargetToWorld );
|
||||
|
||||
MatrixAngles( matNewTargetToWorld, angAngles, vecOrigin );
|
||||
|
||||
// If our spawnflags are greater than 0 (and don't just contain our default "TELEPORT" flag), we might need to ignore one of our angles.
|
||||
if (GetSpawnFlags() && GetSpawnFlags() != SF_LOGIC_MEASURE_MOVEMENT_TELEPORT && !HasSpawnFlags(SF_LOGIC_MEASURE_MOVEMENT_USE_IGNORE_FLAGS_FOR_ORIGIN))
|
||||
{
|
||||
HandleIgnoreFlags( angAngles.Base() );
|
||||
}
|
||||
|
||||
/*
|
||||
VMatrix matPortal1ToWorldInv, matPortal2ToWorld;
|
||||
MatrixInverseGeneral( m_hMeasureReference->EntityToWorldTransform(), matPortal1ToWorldInv );
|
||||
|
@ -54,7 +54,8 @@
|
||||
|
||||
// Mask used for Combine ball hull traces.
|
||||
// This used MASK_SHOT before, but this has been changed to MASK_SHOT_HULL.
|
||||
// Hopefully this doesn't have any major consequences...
|
||||
// This fixes the existing problem of soldiers trying to fire energy balls through grates,
|
||||
// but it's also important to prevent soldiers from blowing themselves up with their newfound SMG grenades.
|
||||
#define MASK_COMBINE_BALL_LOS MASK_SHOT_HULL
|
||||
|
||||
extern int COMBINE_AE_BEGIN_ALTFIRE;
|
||||
|
@ -45,15 +45,18 @@ public:
|
||||
|
||||
void InputSetDamage( inputdata_t &inputdata ) { m_info.SetDamage(inputdata.value.Float()); }
|
||||
void InputSetMaxDamage( inputdata_t &inputdata ) { m_info.SetMaxDamage(inputdata.value.Float()); }
|
||||
//void InputSetDamageBonus( inputdata_t &inputdata ) { m_info.SetDamageBonus(inputdata.value.Float()); }
|
||||
void InputSetDamageBonus( inputdata_t &inputdata ) { m_info.SetDamageBonus(inputdata.value.Float()); }
|
||||
|
||||
void InputSetDamageType( inputdata_t &inputdata ) { m_info.SetDamageType(inputdata.value.Int()); }
|
||||
void InputSetDamageCustom( inputdata_t &inputdata ) { m_info.SetDamageCustom(inputdata.value.Int()); }
|
||||
//void InputSetDamageStats( inputdata_t &inputdata ) { m_info.SetDamageStats(inputdata.value.Int()); }
|
||||
void InputSetDamageStats( inputdata_t &inputdata ) { m_info.SetDamageStats(inputdata.value.Int()); }
|
||||
void InputSetForceFriendlyFire( inputdata_t &inputdata ) { m_info.SetForceFriendlyFire(inputdata.value.Bool()); }
|
||||
|
||||
void InputSetAmmoType( inputdata_t &inputdata ) { m_info.SetAmmoType(inputdata.value.Int()); }
|
||||
|
||||
void InputSetPlayerPenetrationCount( inputdata_t &inputdata ) { m_info.SetPlayerPenetrationCount( inputdata.value.Int() ); }
|
||||
void InputSetDamagedOtherPlayers( inputdata_t &inputdata ) { m_info.SetDamagedOtherPlayers( inputdata.value.Int() ); }
|
||||
|
||||
void InputSetDamageForce( inputdata_t &inputdata ) { Vector vec; inputdata.value.Vector3D(vec); m_info.SetDamageForce(vec); }
|
||||
void InputSetDamagePosition( inputdata_t &inputdata ) { Vector vec; inputdata.value.Vector3D(vec); m_info.SetDamagePosition(vec); }
|
||||
void InputSetReportedPosition( inputdata_t &inputdata ) { Vector vec; inputdata.value.Vector3D(vec); m_info.SetReportedPosition(vec); }
|
||||
@ -92,12 +95,14 @@ BEGIN_DATADESC( CPointDamageInfo )
|
||||
DEFINE_INPUTFUNC( FIELD_STRING, "SetWeapon", InputSetWeapon ),
|
||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDamage", InputSetDamage ),
|
||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetMaxDamage", InputSetMaxDamage ),
|
||||
//DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDamageBonus", InputSetDamageBonus ),
|
||||
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDamageBonus", InputSetDamageBonus ),
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetDamageType", InputSetDamageType ),
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetDamageCustom", InputSetDamageCustom ),
|
||||
//DEFINE_INPUTFUNC( FIELD_INTEGER, "SetDamageStats", InputSetDamageStats ),
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetDamageStats", InputSetDamageStats ),
|
||||
DEFINE_INPUTFUNC( FIELD_BOOLEAN, "SetForceFriendlyFire", InputSetForceFriendlyFire ),
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetAmmoType", InputSetAmmoType ),
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetPlayerPenetrationCount", InputSetPlayerPenetrationCount ),
|
||||
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetDamagedOtherPlayers", InputSetDamagedOtherPlayers ),
|
||||
DEFINE_INPUTFUNC( FIELD_VECTOR, "SetDamageForce", InputSetDamageForce ),
|
||||
DEFINE_INPUTFUNC( FIELD_VECTOR, "SetDamagePosition", InputSetDamagePosition ),
|
||||
DEFINE_INPUTFUNC( FIELD_VECTOR, "SetReportedPosition", InputSetReportedPosition ),
|
||||
@ -139,29 +144,27 @@ bool CPointDamageInfo::KeyValue( const char *szKeyName, const char *szValue )
|
||||
m_info.SetDamage(atof(szValue));
|
||||
else if (FStrEq(szKeyName, "MaxDamage"))
|
||||
m_info.SetMaxDamage(atof(szValue));
|
||||
//else if (FStrEq(szKeyName, "DamageBonus"))
|
||||
// m_info.SetDamageBonus(atof(szValue));
|
||||
else if (FStrEq(szKeyName, "DamageBonus"))
|
||||
m_info.SetDamageBonus(atof(szValue));
|
||||
|
||||
else if (FStrEq(szKeyName, "DamageType"))
|
||||
else if (FStrEq(szKeyName, "DamageType") || FStrEq(szKeyName, "DamagePresets"))
|
||||
m_info.AddDamageType(atoi(szValue));
|
||||
else if (FStrEq(szKeyName, "DamageOr"))
|
||||
m_info.AddDamageType(atoi(szValue));
|
||||
else if (FStrEq(szKeyName, "DamageCustom"))
|
||||
m_info.SetDamageCustom(atoi(szValue));
|
||||
//else if (FStrEq(szKeyName, "DamageStats"))
|
||||
// m_info.SetDamageStats(atoi(szValue));
|
||||
else if (FStrEq(szKeyName, "DamageStats"))
|
||||
m_info.SetDamageStats(atoi(szValue));
|
||||
else if (FStrEq(szKeyName, "ForceFriendlyFire"))
|
||||
m_info.SetForceFriendlyFire(FStrEq(szValue, "1"));
|
||||
|
||||
else if (FStrEq(szKeyName, "AmmoType"))
|
||||
m_info.SetAmmoType(atoi(szValue));
|
||||
|
||||
/*
|
||||
else if (FStrEq(szKeyName, "PlayerPenetrationCount"))
|
||||
m_info.SetPlayerPenetrationCount(atoi(szValue));
|
||||
else if (FStrEq(szKeyName, "DamagedOtherPlayers"))
|
||||
m_info.SetDamagedOtherPlayers(atoi(szValue));
|
||||
*/
|
||||
|
||||
else
|
||||
{
|
||||
@ -214,27 +217,25 @@ bool CPointDamageInfo::GetKeyValue( const char *szKeyName, char *szValue, int iM
|
||||
Q_snprintf(szValue, iMaxLen, "%f", m_info.GetDamage());
|
||||
else if (FStrEq(szKeyName, "MaxDamage"))
|
||||
Q_snprintf(szValue, iMaxLen, "%f", m_info.GetMaxDamage());
|
||||
//else if (FStrEq(szKeyName, "DamageBonus"))
|
||||
// Q_snprintf(szValue, iMaxLen, "%f", m_info.GetDamageBonus());
|
||||
else if (FStrEq(szKeyName, "DamageBonus"))
|
||||
Q_snprintf(szValue, iMaxLen, "%f", m_info.GetDamageBonus());
|
||||
|
||||
else if (FStrEq(szKeyName, "DamageType"))
|
||||
Q_snprintf(szValue, iMaxLen, "%i", m_info.GetDamageType());
|
||||
else if (FStrEq(szKeyName, "DamageCustom"))
|
||||
Q_snprintf(szValue, iMaxLen, "%i", m_info.GetDamageCustom());
|
||||
//else if (FStrEq(szKeyName, "DamageStats"))
|
||||
// Q_snprintf(szValue, iMaxLen, "%i", m_info.GetDamageStats());
|
||||
else if (FStrEq(szKeyName, "DamageStats"))
|
||||
Q_snprintf(szValue, iMaxLen, "%i", m_info.GetDamageStats());
|
||||
else if (FStrEq(szKeyName, "ForceFriendlyFire"))
|
||||
Q_snprintf(szValue, iMaxLen, "%s", m_info.IsForceFriendlyFire() ? "1" : "0");
|
||||
|
||||
else if (FStrEq(szKeyName, "AmmoType"))
|
||||
Q_snprintf(szValue, iMaxLen, "%i", m_info.GetAmmoType());
|
||||
|
||||
/*
|
||||
else if (FStrEq(szKeyName, "PlayerPenetrationCount"))
|
||||
Q_snprintf(szValue, iMaxLen, "%i", m_info.GetPlayerPenetrationCount());
|
||||
else if (FStrEq(szKeyName, "DamagedOtherPlayers"))
|
||||
Q_snprintf(szValue, iMaxLen, "%i", m_info.GetDamagedOtherPlayers());
|
||||
*/
|
||||
|
||||
else if (FStrEq(szKeyName, "DamageForce"))
|
||||
Q_snprintf(szValue, iMaxLen, "%f %f %f", m_info.GetDamageForce().x, m_info.GetDamageForce().y, m_info.GetDamageForce().z);
|
||||
@ -272,8 +273,6 @@ void CPointDamageInfo::ApplyDamage( const char *target, inputdata_t &inputdata )
|
||||
{
|
||||
if (m_iszAttacker != NULL_STRING)
|
||||
m_info.SetAttacker( gEntList.FindEntityByName(NULL, STRING(m_iszAttacker), this, inputdata.pActivator, inputdata.pCaller) );
|
||||
else
|
||||
m_info.SetAttacker( this );
|
||||
|
||||
if (m_iszInflictor != NULL_STRING)
|
||||
m_info.SetInflictor( gEntList.FindEntityByName(NULL, STRING(m_iszInflictor), this, inputdata.pActivator, inputdata.pCaller) );
|
||||
@ -284,8 +283,6 @@ void CPointDamageInfo::ApplyDamage( const char *target, inputdata_t &inputdata )
|
||||
{
|
||||
m_info.SetInflictor(pBCC->GetActiveWeapon());
|
||||
}
|
||||
else
|
||||
m_info.SetInflictor(this);
|
||||
}
|
||||
|
||||
if (m_iszWeapon != NULL_STRING)
|
||||
@ -297,10 +294,17 @@ void CPointDamageInfo::ApplyDamage( const char *target, inputdata_t &inputdata )
|
||||
{
|
||||
m_info.SetWeapon(pBCC->GetActiveWeapon());
|
||||
}
|
||||
else
|
||||
m_info.SetWeapon(this);
|
||||
}
|
||||
|
||||
if (!m_info.GetAttacker())
|
||||
m_info.SetAttacker( this );
|
||||
|
||||
if (!m_info.GetInflictor())
|
||||
m_info.SetInflictor( this );
|
||||
|
||||
if (!m_info.GetWeapon())
|
||||
m_info.SetWeapon( this );
|
||||
|
||||
CBaseEntity *pTarget = NULL;
|
||||
if (m_iMaxEnts > 0)
|
||||
{
|
||||
@ -309,10 +313,7 @@ void CPointDamageInfo::ApplyDamage( const char *target, inputdata_t &inputdata )
|
||||
pTarget = gEntList.FindEntityGeneric(pTarget, target, this, inputdata.pActivator, inputdata.pCaller);
|
||||
if (pTarget)
|
||||
{
|
||||
pTarget->TakeDamage(m_info);
|
||||
m_OnApplyDamage.FireOutput(pTarget, this);
|
||||
if (pTarget->m_lifeState == LIFE_DYING)
|
||||
m_OnApplyDeath.FireOutput(pTarget, this);
|
||||
HandleDamage( pTarget );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -321,10 +322,7 @@ void CPointDamageInfo::ApplyDamage( const char *target, inputdata_t &inputdata )
|
||||
pTarget = gEntList.FindEntityGeneric(NULL, target, this, inputdata.pActivator, inputdata.pCaller);
|
||||
while (pTarget)
|
||||
{
|
||||
pTarget->TakeDamage(m_info);
|
||||
m_OnApplyDamage.FireOutput(pTarget, this);
|
||||
if (pTarget->m_lifeState == LIFE_DYING)
|
||||
m_OnApplyDeath.FireOutput(pTarget, this);
|
||||
HandleDamage( pTarget );
|
||||
pTarget = gEntList.FindEntityGeneric(pTarget, target, this, inputdata.pActivator, inputdata.pCaller);
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ string_t ExtractParentName(string_t parentName)
|
||||
return parentName;
|
||||
|
||||
char szToken[256];
|
||||
nexttoken(szToken, STRING(parentName), ',');
|
||||
nexttoken(szToken, STRING(parentName), ',', sizeof(szToken));
|
||||
return AllocPooledString(szToken);
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ void SetupParentsForSpawnList( int nEntities, HierarchicalSpawn_t *pSpawnList )
|
||||
if ( strchr(STRING(pEntity->m_iParent), ',') )
|
||||
{
|
||||
char szToken[256];
|
||||
const char *pAttachmentName = nexttoken(szToken, STRING(pEntity->m_iParent), ',');
|
||||
const char *pAttachmentName = nexttoken(szToken, STRING(pEntity->m_iParent), ',', sizeof(szToken));
|
||||
pEntity->m_iParent = AllocPooledString(szToken);
|
||||
CBaseEntity *pParent = gEntList.FindEntityByName( NULL, pEntity->m_iParent );
|
||||
|
||||
|
@ -1148,13 +1148,13 @@ void PhysSolidOverride( solid_t &solid, string_t overrideScript )
|
||||
|
||||
// suck out the comma delimited tokens and turn them into quoted key/values
|
||||
char szToken[256];
|
||||
const char *pStr = nexttoken(szToken, STRING(overrideScript), ',');
|
||||
const char *pStr = nexttoken(szToken, STRING(overrideScript), ',', sizeof(szToken));
|
||||
while ( szToken[0] != 0 )
|
||||
{
|
||||
Q_strncat( pTmpString, "\"", sizeof(pTmpString), COPY_ALL_CHARACTERS );
|
||||
Q_strncat( pTmpString, szToken, sizeof(pTmpString), COPY_ALL_CHARACTERS );
|
||||
Q_strncat( pTmpString, "\" ", sizeof(pTmpString), COPY_ALL_CHARACTERS );
|
||||
pStr = nexttoken(szToken, pStr, ',');
|
||||
pStr = nexttoken(szToken, pStr, ',', sizeof(szToken));
|
||||
}
|
||||
// terminate the script
|
||||
Q_strncat( pTmpString, "}", sizeof(pTmpString), COPY_ALL_CHARACTERS );
|
||||
|
@ -751,14 +751,14 @@ void CRagdollProp::InitRagdoll( const Vector &forceVector, int forceBone, const
|
||||
if ( m_anglesOverrideString != NULL_STRING && Q_strlen(m_anglesOverrideString.ToCStr()) > 0 )
|
||||
{
|
||||
char szToken[2048];
|
||||
const char *pStr = nexttoken(szToken, STRING(m_anglesOverrideString), ',');
|
||||
const char *pStr = nexttoken(szToken, STRING(m_anglesOverrideString), ',', sizeof(szToken));
|
||||
// anglesOverride is index,angles,index,angles (e.g. "1, 22.5 123.0 0.0, 2, 0 0 0, 3, 0 0 180.0")
|
||||
while ( szToken[0] != 0 )
|
||||
{
|
||||
int objectIndex = atoi(szToken);
|
||||
// sanity check to make sure this token is an integer
|
||||
Assert( atof(szToken) == ((float)objectIndex) );
|
||||
pStr = nexttoken(szToken, pStr, ',');
|
||||
pStr = nexttoken(szToken, pStr, ',', sizeof(szToken));
|
||||
Assert( szToken[0] );
|
||||
if ( objectIndex >= m_ragdoll.listCount )
|
||||
{
|
||||
@ -785,7 +785,7 @@ void CRagdollProp::InitRagdoll( const Vector &forceVector, int forceBone, const
|
||||
MatrixSetColumn( out, 3, pBoneToWorld[boneIndex] );
|
||||
element.pObject->SetPositionMatrix( pBoneToWorld[boneIndex], true );
|
||||
}
|
||||
pStr = nexttoken(szToken, pStr, ',');
|
||||
pStr = nexttoken(szToken, pStr, ',', sizeof(szToken));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4701,7 +4701,11 @@ void CBaseVPhysicsTrigger::EndTouch( CBaseEntity *pOther )
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CBaseVPhysicsTrigger::PassesTriggerFilters( CBaseEntity *pOther )
|
||||
{
|
||||
#ifdef MAPBASE
|
||||
if ( !pOther->VPhysicsGetObject() )
|
||||
#else
|
||||
if ( pOther->GetMoveType() != MOVETYPE_VPHYSICS && !pOther->IsPlayer() )
|
||||
#endif
|
||||
return false;
|
||||
|
||||
#ifdef MAPBASE
|
||||
|
@ -2095,11 +2095,14 @@ void UTIL_ValidateSoundName( string_t &name, const char *defaultStr )
|
||||
// sep - Character to use as separator. UNDONE: allow multiple separator chars
|
||||
// Output : Returns a pointer to the next token to be parsed.
|
||||
//-----------------------------------------------------------------------------
|
||||
const char *nexttoken(char *token, const char *str, char sep)
|
||||
const char *nexttoken(char *token, const char *str, char sep, size_t tokenLen)
|
||||
{
|
||||
if ((str == NULL) || (*str == '\0'))
|
||||
{
|
||||
*token = '\0';
|
||||
if(tokenLen)
|
||||
{
|
||||
*token = '\0';
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
@ -2107,11 +2110,25 @@ const char *nexttoken(char *token, const char *str, char sep)
|
||||
// Copy everything up to the first separator into the return buffer.
|
||||
// Do not include separators in the return buffer.
|
||||
//
|
||||
while ((*str != sep) && (*str != '\0') && (tokenLen > 1))
|
||||
{
|
||||
*token++ = *str++;
|
||||
tokenLen--;
|
||||
}
|
||||
|
||||
//
|
||||
// If token is to big for return buffer, skip rest of token.
|
||||
//
|
||||
while ((*str != sep) && (*str != '\0'))
|
||||
{
|
||||
*token++ = *str++;
|
||||
str++;
|
||||
}
|
||||
*token = '\0';
|
||||
|
||||
if(tokenLen)
|
||||
{
|
||||
*token = '\0';
|
||||
tokenLen--;
|
||||
}
|
||||
|
||||
//
|
||||
// Advance the pointer unless we hit the end of the input string.
|
||||
|
@ -206,7 +206,7 @@ inline bool FStrEq( string_t str1, string_t str2 )
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *nexttoken(char *token, const char *str, char sep);
|
||||
const char *nexttoken(char *token, const char *str, char sep, size_t tokenLen);
|
||||
|
||||
// Misc. Prototypes
|
||||
void UTIL_SetSize (CBaseEntity *pEnt, const Vector &vecMin, const Vector &vecMax);
|
||||
|
@ -141,15 +141,15 @@ variant_t Variant_Parse(const char *szValue)
|
||||
// Passes strings to Variant_Parse, uses the other input data for finding procedural entities.
|
||||
variant_t Variant_ParseInput(inputdata_t inputdata)
|
||||
{
|
||||
if (inputdata.value.FieldType() != FIELD_STRING)
|
||||
return inputdata.value;
|
||||
|
||||
if (inputdata.value.String()[0] == '!')
|
||||
if (inputdata.value.FieldType() == FIELD_STRING)
|
||||
{
|
||||
variant_t var = variant_t();
|
||||
var.SetEntity(gEntList.FindEntityProcedural(inputdata.value.String(), inputdata.pCaller, inputdata.pActivator, inputdata.pCaller));
|
||||
if (var.Entity())
|
||||
return var;
|
||||
if (inputdata.value.String()[0] == '!')
|
||||
{
|
||||
variant_t var = variant_t();
|
||||
var.SetEntity(gEntList.FindEntityProcedural(inputdata.value.String(), inputdata.pCaller, inputdata.pActivator, inputdata.pCaller));
|
||||
if (var.Entity())
|
||||
return var;
|
||||
}
|
||||
}
|
||||
|
||||
return Variant_Parse(inputdata.value.String());
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#include "filesystem.h"
|
||||
#include "c_playerresource.h"
|
||||
|
||||
#endif
|
||||
@ -91,7 +92,9 @@ static EHANDLE g_Metadata[NUM_RPCS];
|
||||
class CMapbaseMetadata : public CBaseEntity
|
||||
{
|
||||
public:
|
||||
#ifndef CLIENT_DLL
|
||||
DECLARE_DATADESC();
|
||||
#endif
|
||||
DECLARE_NETWORKCLASS();
|
||||
DECLARE_CLASS( CMapbaseMetadata, CBaseEntity );
|
||||
|
||||
@ -204,6 +207,7 @@ BEGIN_NETWORK_TABLE_NOBASE(CMapbaseMetadata, DT_MapbaseMetadata)
|
||||
|
||||
END_NETWORK_TABLE()
|
||||
|
||||
#ifndef CLIENT_DLL
|
||||
BEGIN_DATADESC( CMapbaseMetadata )
|
||||
|
||||
// Inputs
|
||||
@ -211,26 +215,31 @@ BEGIN_DATADESC( CMapbaseMetadata )
|
||||
DEFINE_INPUT( m_iszRPCDetails, FIELD_STRING, "SetRPCDetails" ),
|
||||
|
||||
END_DATADESC()
|
||||
#endif
|
||||
|
||||
#ifdef MAPBASE_RPC
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Mapbase's special integration with rich presence clients, most notably Discord.
|
||||
//
|
||||
// This only has Discord as of writing, but similar/derived implementaton could expand to
|
||||
// other clients in the future, maybe even Steam.
|
||||
// This only has Discord and crude groundwork for Steam as of writing,
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------
|
||||
// !!! FOR MODS !!!
|
||||
//
|
||||
// Create your own Discord "application" if you want to change what info/images show up, etc.
|
||||
// You can find the convar that controls this in cdll_client_int.cpp.
|
||||
// You can change the app ID in "scripts/mapbase_rpc.txt". It's located in the shared content VPK and the mod templates.
|
||||
// You could override that file in your mod to change it to your own app ID.
|
||||
//
|
||||
// This code automatically shows the mod's title in the details, but it's easy to change if you want things to be chapter-specific, etc.
|
||||
// This code automatically shows the mod's title in the details, but it's easy to change this code if you want things to be chapter-specific, etc.
|
||||
//
|
||||
//-----------------------------------------
|
||||
|
||||
static ConVar cl_discord_appid("cl_discord_appid", "582595088719413250", FCVAR_DEVELOPMENTONLY | FCVAR_CHEAT);
|
||||
// Changing the default value of the convars below will not work.
|
||||
// Use "scripts/mapbase_rpc.txt" instead.
|
||||
static ConVar cl_discord_appid("cl_discord_appid", "582595088719413250", FCVAR_NONE);
|
||||
static ConVar cl_discord_largeimage("cl_discord_largeimage", "mb_logo_episodic", FCVAR_NONE);
|
||||
static ConVar cl_discord_largeimage_text("cl_discord_largeimage_text", "Half-Life 2", FCVAR_NONE);
|
||||
static int64_t startTimestamp = time(0);
|
||||
|
||||
//
|
||||
@ -289,6 +298,22 @@ static void HandleDiscordJoinRequest(const DiscordUser* request)
|
||||
|
||||
void MapbaseRPC_Init()
|
||||
{
|
||||
// First, load the config
|
||||
// (we need its values immediately)
|
||||
KeyValues *pKV = new KeyValues( "MapbaseRPC" );
|
||||
if (pKV->LoadFromFile( filesystem, "scripts/mapbase_rpc.txt" ))
|
||||
{
|
||||
const char *szAppID = pKV->GetString("discord_appid", cl_discord_appid.GetString());
|
||||
cl_discord_appid.SetValue(szAppID);
|
||||
|
||||
const char *szLargeImage = pKV->GetString("discord_largeimage", cl_discord_largeimage.GetString());
|
||||
cl_discord_largeimage.SetValue(szLargeImage);
|
||||
|
||||
const char *szLargeImageText = pKV->GetString("discord_largeimage_text", cl_discord_largeimage_text.GetString());
|
||||
cl_discord_largeimage_text.SetValue( szLargeImageText );
|
||||
}
|
||||
pKV->deleteThis();
|
||||
|
||||
// Steam RPC
|
||||
if (steamapicontext->SteamFriends())
|
||||
steamapicontext->SteamFriends()->ClearRichPresence();
|
||||
@ -423,19 +448,6 @@ void MapbaseRPC_UpdateSteam( int iType, const char *pMapName )
|
||||
#endif
|
||||
|
||||
#ifdef DISCORD_RPC
|
||||
// Game-Specfic Image
|
||||
// These are specific to the Mapbase Discord application, so you'll want to modify this for your own mod.
|
||||
#if HL2_EPISODIC
|
||||
#define DISCORD_GAME_IMAGE "mb_logo_episodic"
|
||||
#define DISCORD_GAME_IMAGE_TEXT "Half-Life 2 Episodic"
|
||||
#elif HL2_CLIENT_DLL
|
||||
#define DISCORD_GAME_IMAGE "mb_logo_hl2"
|
||||
#define DISCORD_GAME_IMAGE_TEXT "Half-Life 2"
|
||||
#else
|
||||
#define DISCORD_GAME_IMAGE "mb_logo_general"
|
||||
#define DISCORD_GAME_IMAGE_TEXT "Mapbase"
|
||||
#endif
|
||||
|
||||
void MapbaseRPC_GetDiscordParameters( DiscordRichPresence &discordPresence, int iType, const char *pMapName )
|
||||
{
|
||||
static char details[128];
|
||||
@ -504,10 +516,8 @@ void MapbaseRPC_GetDiscordParameters( DiscordRichPresence &discordPresence, int
|
||||
discordPresence.smallImageKey = "mb_logo_general";
|
||||
discordPresence.smallImageText = "Mapbase";
|
||||
|
||||
#ifdef DISCORD_GAME_IMAGE
|
||||
discordPresence.largeImageKey = DISCORD_GAME_IMAGE;
|
||||
discordPresence.largeImageText = DISCORD_GAME_IMAGE_TEXT;
|
||||
#endif
|
||||
discordPresence.largeImageKey = cl_discord_largeimage.GetString();
|
||||
discordPresence.largeImageText = cl_discord_largeimage_text.GetString();
|
||||
}
|
||||
|
||||
void MapbaseRPC_UpdateDiscord( int iType, const char *pMapName )
|
||||
|
@ -90,9 +90,9 @@ public:
|
||||
if ( m_bSelfCollisions )
|
||||
{
|
||||
char szToken[256];
|
||||
const char *pStr = nexttoken(szToken, pValue, ',');
|
||||
const char *pStr = nexttoken(szToken, pValue, ',', sizeof(szToken));
|
||||
int index0 = atoi(szToken);
|
||||
nexttoken( szToken, pStr, ',' );
|
||||
nexttoken( szToken, pStr, ',' , sizeof(szToken) );
|
||||
int index1 = atoi(szToken);
|
||||
|
||||
m_pSet->EnableCollisions( index0, index1 );
|
||||
|
@ -1290,14 +1290,14 @@ void CTeamRoundTimer::InputAddTeamTime( inputdata_t &input )
|
||||
int nSeconds = 0;
|
||||
|
||||
// get the team
|
||||
p = nexttoken( token, p, ' ' );
|
||||
p = nexttoken( token, p, ' ', sizeof(token) );
|
||||
if ( token )
|
||||
{
|
||||
nTeam = Q_atoi( token );
|
||||
}
|
||||
|
||||
// get the time
|
||||
p = nexttoken( token, p, ' ' );
|
||||
p = nexttoken( token, p, ' ', sizeof(token) );
|
||||
if ( token )
|
||||
{
|
||||
nSeconds = Q_atoi( token );
|
||||
|
@ -12,7 +12,7 @@
|
||||
// STATIC: "BASETEXTURENOENVMAP" "0..1"
|
||||
// STATIC: "BASETEXTURE2NOENVMAP" "0..1"
|
||||
// STATIC: "WARPLIGHTING" "0..1"
|
||||
// STATIC: "FANCY_BLENDING" "0..2"
|
||||
// STATIC: "FANCY_BLENDING" "0..1"
|
||||
// STATIC: "RELIEF_MAPPING" "0..0" [ps20b]
|
||||
// STATIC: "SEAMLESS" "0..1"
|
||||
// STATIC: "NORMAL_DECODE_MODE" "0..0" [XBOX]
|
||||
@ -22,6 +22,8 @@
|
||||
// STATIC: "DETAIL_BLEND_MODE" "0..11"
|
||||
// STATIC: "FLASHLIGHT" "0..1" [ps20b] [XBOX]
|
||||
// STATIC: "BASETEXTURETRANSFORM2" "0..1"
|
||||
// STATIC: "SWAP_VERTEX_BLEND" "0..1"
|
||||
// STATIC: "PARALLAXCORRECT" "0..1"
|
||||
|
||||
// DYNAMIC: "FASTPATHENVMAPCONTRAST" "0..1"
|
||||
// DYNAMIC: "FASTPATH" "0..1"
|
||||
@ -43,5 +45,7 @@
|
||||
// SKIP ($DETAIL_BLEND_MODE == 10 )
|
||||
// SKIP ($DETAIL_BLEND_MODE == 11 )
|
||||
|
||||
// SKIP: $PARALLAXCORRECT && !$CUBEMAP
|
||||
|
||||
#include "lightmappedgeneric_ps2_3_x.h"
|
||||
|
||||
|
@ -303,7 +303,7 @@ private:
|
||||
public:
|
||||
void SetFANCY_BLENDING( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 2 );
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nFANCY_BLENDING = i;
|
||||
#ifdef _DEBUG
|
||||
m_bFANCY_BLENDING = true;
|
||||
@ -442,6 +442,48 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = true;
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
int m_nSWAP_VERTEX_BLEND;
|
||||
#ifdef _DEBUG
|
||||
bool m_bSWAP_VERTEX_BLEND;
|
||||
#endif
|
||||
public:
|
||||
void SetSWAP_VERTEX_BLEND( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nSWAP_VERTEX_BLEND = i;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = true;
|
||||
#endif
|
||||
}
|
||||
void SetSWAP_VERTEX_BLEND( bool i )
|
||||
{
|
||||
m_nSWAP_VERTEX_BLEND = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = 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_lightmappedgeneric_ps20b_Static_Index( )
|
||||
{
|
||||
@ -529,19 +571,27 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = false;
|
||||
#endif // _DEBUG
|
||||
m_nBASETEXTURETRANSFORM2 = 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = false;
|
||||
#endif // _DEBUG
|
||||
m_nSWAP_VERTEX_BLEND = 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_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bRELIEF_MAPPING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2;
|
||||
bool bAllStaticVarsDefined = m_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bRELIEF_MAPPING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2 && m_bSWAP_VERTEX_BLEND && m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 7077888 * m_nRELIEF_MAPPING ) + ( 7077888 * m_nSEAMLESS ) + ( 14155776 * m_nNORMAL_DECODE_MODE ) + ( 14155776 * m_nNORMALMASK_DECODE_MODE ) + ( 14155776 * m_nDETAIL_BLEND_MODE ) + ( 169869312 * m_nBASETEXTURETRANSFORM2 ) + 0;
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 4718592 * m_nRELIEF_MAPPING ) + ( 4718592 * m_nSEAMLESS ) + ( 9437184 * m_nNORMAL_DECODE_MODE ) + ( 9437184 * m_nNORMALMASK_DECODE_MODE ) + ( 9437184 * m_nDETAIL_BLEND_MODE ) + ( 113246208 * m_nBASETEXTURETRANSFORM2 ) + ( 226492416 * m_nSWAP_VERTEX_BLEND ) + ( 452984832 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps20b psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_RELIEF_MAPPING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + 0
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps20b psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_RELIEF_MAPPING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + psh_forgot_to_set_static_SWAP_VERTEX_BLEND + psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_lightmappedgeneric_ps20b_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
|
@ -303,7 +303,7 @@ private:
|
||||
public:
|
||||
void SetFANCY_BLENDING( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 2 );
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nFANCY_BLENDING = i;
|
||||
#ifdef _DEBUG
|
||||
m_bFANCY_BLENDING = true;
|
||||
@ -421,6 +421,48 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = true;
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
int m_nSWAP_VERTEX_BLEND;
|
||||
#ifdef _DEBUG
|
||||
bool m_bSWAP_VERTEX_BLEND;
|
||||
#endif
|
||||
public:
|
||||
void SetSWAP_VERTEX_BLEND( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nSWAP_VERTEX_BLEND = i;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = true;
|
||||
#endif
|
||||
}
|
||||
void SetSWAP_VERTEX_BLEND( bool i )
|
||||
{
|
||||
m_nSWAP_VERTEX_BLEND = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = 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_lightmappedgeneric_ps30_Static_Index( )
|
||||
{
|
||||
@ -504,19 +546,27 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = false;
|
||||
#endif // _DEBUG
|
||||
m_nBASETEXTURETRANSFORM2 = 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = false;
|
||||
#endif // _DEBUG
|
||||
m_nSWAP_VERTEX_BLEND = 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_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2;
|
||||
bool bAllStaticVarsDefined = m_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2 && m_bSWAP_VERTEX_BLEND && m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 7077888 * m_nSEAMLESS ) + ( 14155776 * m_nNORMAL_DECODE_MODE ) + ( 14155776 * m_nNORMALMASK_DECODE_MODE ) + ( 14155776 * m_nDETAIL_BLEND_MODE ) + ( 169869312 * m_nBASETEXTURETRANSFORM2 ) + 0;
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 4718592 * m_nSEAMLESS ) + ( 9437184 * m_nNORMAL_DECODE_MODE ) + ( 9437184 * m_nNORMALMASK_DECODE_MODE ) + ( 9437184 * m_nDETAIL_BLEND_MODE ) + ( 113246208 * m_nBASETEXTURETRANSFORM2 ) + ( 226492416 * m_nSWAP_VERTEX_BLEND ) + ( 452984832 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps30 psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + 0
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps30 psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + psh_forgot_to_set_static_SWAP_VERTEX_BLEND + psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_lightmappedgeneric_ps30_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
|
@ -303,7 +303,7 @@ private:
|
||||
public:
|
||||
void SetFANCY_BLENDING( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 2 );
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nFANCY_BLENDING = i;
|
||||
#ifdef _DEBUG
|
||||
m_bFANCY_BLENDING = true;
|
||||
@ -442,6 +442,48 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = true;
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
int m_nSWAP_VERTEX_BLEND;
|
||||
#ifdef _DEBUG
|
||||
bool m_bSWAP_VERTEX_BLEND;
|
||||
#endif
|
||||
public:
|
||||
void SetSWAP_VERTEX_BLEND( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nSWAP_VERTEX_BLEND = i;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = true;
|
||||
#endif
|
||||
}
|
||||
void SetSWAP_VERTEX_BLEND( bool i )
|
||||
{
|
||||
m_nSWAP_VERTEX_BLEND = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = 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_lightmappedgeneric_ps20b_Static_Index( )
|
||||
{
|
||||
@ -529,19 +571,27 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = false;
|
||||
#endif // _DEBUG
|
||||
m_nBASETEXTURETRANSFORM2 = 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = false;
|
||||
#endif // _DEBUG
|
||||
m_nSWAP_VERTEX_BLEND = 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_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bRELIEF_MAPPING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2;
|
||||
bool bAllStaticVarsDefined = m_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bRELIEF_MAPPING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2 && m_bSWAP_VERTEX_BLEND && m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 7077888 * m_nRELIEF_MAPPING ) + ( 7077888 * m_nSEAMLESS ) + ( 14155776 * m_nNORMAL_DECODE_MODE ) + ( 14155776 * m_nNORMALMASK_DECODE_MODE ) + ( 14155776 * m_nDETAIL_BLEND_MODE ) + ( 169869312 * m_nBASETEXTURETRANSFORM2 ) + 0;
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 4718592 * m_nRELIEF_MAPPING ) + ( 4718592 * m_nSEAMLESS ) + ( 9437184 * m_nNORMAL_DECODE_MODE ) + ( 9437184 * m_nNORMALMASK_DECODE_MODE ) + ( 9437184 * m_nDETAIL_BLEND_MODE ) + ( 113246208 * m_nBASETEXTURETRANSFORM2 ) + ( 226492416 * m_nSWAP_VERTEX_BLEND ) + ( 452984832 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps20b psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_RELIEF_MAPPING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + 0
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps20b psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_RELIEF_MAPPING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + psh_forgot_to_set_static_SWAP_VERTEX_BLEND + psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_lightmappedgeneric_ps20b_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
|
@ -303,7 +303,7 @@ private:
|
||||
public:
|
||||
void SetFANCY_BLENDING( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 2 );
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nFANCY_BLENDING = i;
|
||||
#ifdef _DEBUG
|
||||
m_bFANCY_BLENDING = true;
|
||||
@ -421,6 +421,48 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = true;
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
int m_nSWAP_VERTEX_BLEND;
|
||||
#ifdef _DEBUG
|
||||
bool m_bSWAP_VERTEX_BLEND;
|
||||
#endif
|
||||
public:
|
||||
void SetSWAP_VERTEX_BLEND( int i )
|
||||
{
|
||||
Assert( i >= 0 && i <= 1 );
|
||||
m_nSWAP_VERTEX_BLEND = i;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = true;
|
||||
#endif
|
||||
}
|
||||
void SetSWAP_VERTEX_BLEND( bool i )
|
||||
{
|
||||
m_nSWAP_VERTEX_BLEND = i ? 1 : 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = 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_lightmappedgeneric_ps30_Static_Index( )
|
||||
{
|
||||
@ -504,19 +546,27 @@ public:
|
||||
m_bBASETEXTURETRANSFORM2 = false;
|
||||
#endif // _DEBUG
|
||||
m_nBASETEXTURETRANSFORM2 = 0;
|
||||
#ifdef _DEBUG
|
||||
m_bSWAP_VERTEX_BLEND = false;
|
||||
#endif // _DEBUG
|
||||
m_nSWAP_VERTEX_BLEND = 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_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2;
|
||||
bool bAllStaticVarsDefined = m_bMASKEDBLENDING && m_bBASETEXTURE2 && m_bDETAILTEXTURE && m_bBUMPMAP && m_bBUMPMAP2 && m_bCUBEMAP && m_bENVMAPMASK && m_bBASEALPHAENVMAPMASK && m_bSELFILLUM && m_bNORMALMAPALPHAENVMAPMASK && m_bDIFFUSEBUMPMAP && m_bBASETEXTURENOENVMAP && m_bBASETEXTURE2NOENVMAP && m_bWARPLIGHTING && m_bFANCY_BLENDING && m_bSEAMLESS && m_bNORMAL_DECODE_MODE && m_bNORMALMASK_DECODE_MODE && m_bDETAIL_BLEND_MODE && m_bBASETEXTURETRANSFORM2 && m_bSWAP_VERTEX_BLEND && m_bPARALLAXCORRECT;
|
||||
Assert( bAllStaticVarsDefined );
|
||||
#endif // _DEBUG
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 7077888 * m_nSEAMLESS ) + ( 14155776 * m_nNORMAL_DECODE_MODE ) + ( 14155776 * m_nNORMALMASK_DECODE_MODE ) + ( 14155776 * m_nDETAIL_BLEND_MODE ) + ( 169869312 * m_nBASETEXTURETRANSFORM2 ) + 0;
|
||||
return ( 96 * m_nMASKEDBLENDING ) + ( 192 * m_nBASETEXTURE2 ) + ( 384 * m_nDETAILTEXTURE ) + ( 768 * m_nBUMPMAP ) + ( 2304 * m_nBUMPMAP2 ) + ( 4608 * m_nCUBEMAP ) + ( 9216 * m_nENVMAPMASK ) + ( 18432 * m_nBASEALPHAENVMAPMASK ) + ( 36864 * m_nSELFILLUM ) + ( 73728 * m_nNORMALMAPALPHAENVMAPMASK ) + ( 147456 * m_nDIFFUSEBUMPMAP ) + ( 294912 * m_nBASETEXTURENOENVMAP ) + ( 589824 * m_nBASETEXTURE2NOENVMAP ) + ( 1179648 * m_nWARPLIGHTING ) + ( 2359296 * m_nFANCY_BLENDING ) + ( 4718592 * m_nSEAMLESS ) + ( 9437184 * m_nNORMAL_DECODE_MODE ) + ( 9437184 * m_nNORMALMASK_DECODE_MODE ) + ( 9437184 * m_nDETAIL_BLEND_MODE ) + ( 113246208 * m_nBASETEXTURETRANSFORM2 ) + ( 226492416 * m_nSWAP_VERTEX_BLEND ) + ( 452984832 * m_nPARALLAXCORRECT ) + 0;
|
||||
}
|
||||
};
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps30 psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + 0
|
||||
#define shaderStaticTest_sdk_lightmappedgeneric_ps30 psh_forgot_to_set_static_MASKEDBLENDING + psh_forgot_to_set_static_BASETEXTURE2 + psh_forgot_to_set_static_DETAILTEXTURE + psh_forgot_to_set_static_BUMPMAP + psh_forgot_to_set_static_BUMPMAP2 + psh_forgot_to_set_static_CUBEMAP + psh_forgot_to_set_static_ENVMAPMASK + psh_forgot_to_set_static_BASEALPHAENVMAPMASK + psh_forgot_to_set_static_SELFILLUM + psh_forgot_to_set_static_NORMALMAPALPHAENVMAPMASK + psh_forgot_to_set_static_DIFFUSEBUMPMAP + psh_forgot_to_set_static_BASETEXTURENOENVMAP + psh_forgot_to_set_static_BASETEXTURE2NOENVMAP + psh_forgot_to_set_static_WARPLIGHTING + psh_forgot_to_set_static_FANCY_BLENDING + psh_forgot_to_set_static_SEAMLESS + psh_forgot_to_set_static_NORMAL_DECODE_MODE + psh_forgot_to_set_static_NORMALMASK_DECODE_MODE + psh_forgot_to_set_static_DETAIL_BLEND_MODE + psh_forgot_to_set_static_BASETEXTURETRANSFORM2 + psh_forgot_to_set_static_SWAP_VERTEX_BLEND + psh_forgot_to_set_static_PARALLAXCORRECT + 0
|
||||
class sdk_lightmappedgeneric_ps30_Dynamic_Index
|
||||
{
|
||||
private:
|
||||
|
@ -16,7 +16,7 @@ fxctmp9_tmp\SDK_lightmappedgeneric_vs30.inc
|
||||
fxctmp9_tmp\SDK_depthwrite_ps30.inc
|
||||
fxctmp9_tmp\SDK_depthwrite_vs30.inc
|
||||
fxctmp9_tmp\SDK_eyes_ps30.inc
|
||||
fxctmp9_tmp\SDK_eyes_vs30.inc
|
||||
fxctmp9_tmp\SDK_Eyes_vs30.inc
|
||||
fxctmp9_tmp\SDK_eye_refract_ps30.inc
|
||||
fxctmp9_tmp\SDK_eye_refract_vs30.inc
|
||||
fxctmp9_tmp\SDK_eyes_flashlight_ps30.inc
|
||||
|
@ -81,6 +81,15 @@ BEGIN_VS_SHADER( SDK_LightmappedGeneric,
|
||||
SHADER_PARAM( PHONGBOOST, SHADER_PARAM_TYPE_FLOAT, "1.0", "Phong overbrightening factor (specular mask channel should be authored to account for this)" )
|
||||
SHADER_PARAM( PHONGFRESNELRANGES, SHADER_PARAM_TYPE_VEC3, "[0 0.5 1]", "Parameters for remapping fresnel output" )
|
||||
SHADER_PARAM( PHONGEXPONENT, SHADER_PARAM_TYPE_FLOAT, "5.0", "Phong exponent for local specular lights" )
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
SHADER_PARAM( ENVMAPPARALLAX, SHADER_PARAM_TYPE_BOOL, "0", "Enables parallax correction code for env_cubemaps" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB1, SHADER_PARAM_TYPE_VEC4, "[1 0 0 0]", "The first line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB2, SHADER_PARAM_TYPE_VEC4, "[0 1 0 0]", "The second line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB3, SHADER_PARAM_TYPE_VEC4, "[0 0 1 0]", "The third line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPORIGIN, SHADER_PARAM_TYPE_VEC3, "[0 0 0]", "The world space position of the env_cubemap being corrected" )
|
||||
#endif
|
||||
END_SHADER_PARAMS
|
||||
|
||||
void SetupVars( LightmappedGeneric_DX9_Vars_t& info )
|
||||
@ -148,6 +157,15 @@ END_SHADER_PARAMS
|
||||
info.m_nPhongBoost = PHONGBOOST;
|
||||
info.m_nPhongFresnelRanges = PHONGFRESNELRANGES;
|
||||
info.m_nPhongExponent = PHONGEXPONENT;
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
info.m_nEnvmapParallax = ENVMAPPARALLAX;
|
||||
info.m_nEnvmapParallaxObb1 = ENVMAPPARALLAXOBB1;
|
||||
info.m_nEnvmapParallaxObb2 = ENVMAPPARALLAXOBB2;
|
||||
info.m_nEnvmapParallaxObb3 = ENVMAPPARALLAXOBB3;
|
||||
info.m_nEnvmapOrigin = ENVMAPORIGIN;
|
||||
#endif
|
||||
}
|
||||
|
||||
SHADER_FALLBACK
|
||||
|
@ -771,6 +771,10 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
||||
(info.m_nBlendModulateTexture != -1) &&
|
||||
(params[info.m_nBlendModulateTexture]->IsTexture() );
|
||||
bool hasNormalMapAlphaEnvmapMask = IS_FLAG_SET( MATERIAL_VAR_NORMALMAPALPHAENVMAPMASK );
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
bool hasParallaxCorrection = params[info.m_nEnvmapParallax]->GetIntValue() > 0;
|
||||
#endif
|
||||
|
||||
if ( hasFlashlight && !IsX360() )
|
||||
{
|
||||
@ -1114,17 +1118,7 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURENOENVMAP, params[info.m_nBaseTextureNoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURE2NOENVMAP, params[info.m_nBaseTexture2NoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( WARPLIGHTING, hasLightWarpTexture );
|
||||
#ifdef MAPBASE
|
||||
// There's a bug in Hammer that causes $basetexture and $basetexture2 to be swapped.
|
||||
// Downfall had a hack to swap them back in the editor, but I noticed $blendmodulatetexture showed up in the editor with the new shader.
|
||||
// Unfortunately, it became inverted in the editor, so I had to clear $blendmodulatetexture in the editor too, but
|
||||
// I became interested in the idea of seeing it there, as it would greatly assist with editing those kinds of textures.
|
||||
// So interested, in fact, that I added a setting to FANCY_BLENDING that swaps $blendmodulatetexture, intended to be used with the Downfall hack.
|
||||
// It only tests whether it's in the editor right now, but you could turn it into an actual shader parameter if you want.
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( FANCY_BLENDING, bHasBlendModulateTexture ? (pShader->UsingEditor( params ) ? 2 : 1) : 0 );
|
||||
#else
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( FANCY_BLENDING, bHasBlendModulateTexture );
|
||||
#endif
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( MASKEDBLENDING, bMaskedBlending);
|
||||
//SET_STATIC_PIXEL_SHADER_COMBO( RELIEF_MAPPING, bReliefMapping );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( SEAMLESS, bSeamlessMapping );
|
||||
@ -1138,6 +1132,18 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
||||
#endif
|
||||
#ifdef MAPBASE
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURETRANSFORM2, hasBaseTextureTransform2 );
|
||||
// Hammer apparently has a bug that causes the vertex blend to get swapped.
|
||||
// Hammer uses a special internal shader to nullify this, but it doesn't work with custom shaders.
|
||||
// Downfall got around this by swapping around the base textures in the DLL code when drawn by the editor.
|
||||
// Doing it here in the shader itself allows us to retain other properties, like FANCY_BLENDING.
|
||||
// TODO: Could we do this here in the DLL and swap the alpha before it's passed to the shader?
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( SWAP_VERTEX_BLEND, hasBaseTexture2 && pShader->UsingEditor(params) );
|
||||
#endif
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps enabled for 2_0b and onwards
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( PARALLAXCORRECT, hasParallaxCorrection );
|
||||
#else
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( PARALLAXCORRECT, false );
|
||||
#endif
|
||||
SET_STATIC_PIXEL_SHADER( sdk_lightmappedgeneric_ps30 );
|
||||
}
|
||||
@ -1158,12 +1164,7 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURENOENVMAP, params[info.m_nBaseTextureNoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURE2NOENVMAP, params[info.m_nBaseTexture2NoEnvmap]->GetIntValue() );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( WARPLIGHTING, hasLightWarpTexture );
|
||||
#ifdef MAPBASE
|
||||
// See the comment in the 3.0 shader block for more info on this.
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( FANCY_BLENDING, bHasBlendModulateTexture ? (pShader->UsingEditor( params ) ? 2 : 1) : 0 );
|
||||
#else
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( FANCY_BLENDING, bHasBlendModulateTexture );
|
||||
#endif
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( MASKEDBLENDING, bMaskedBlending);
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( RELIEF_MAPPING, bReliefMapping );
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( SEAMLESS, bSeamlessMapping );
|
||||
@ -1177,6 +1178,14 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
||||
#endif
|
||||
#ifdef MAPBASE
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( BASETEXTURETRANSFORM2, hasBaseTextureTransform2 );
|
||||
// See the comment in the 3.0 shader block for more info on this.
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( SWAP_VERTEX_BLEND, hasBaseTexture2 && pShader->UsingEditor(params) );
|
||||
#endif
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps enabled for 2_0b and onwards
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( PARALLAXCORRECT, hasParallaxCorrection );
|
||||
#else
|
||||
SET_STATIC_PIXEL_SHADER_COMBO( PARALLAXCORRECT, false );
|
||||
#endif
|
||||
SET_STATIC_PIXEL_SHADER( sdk_lightmappedgeneric_ps20b );
|
||||
}
|
||||
@ -1492,6 +1501,30 @@ void DrawLightmappedGeneric_DX9_Internal(CBaseVSShader *pShader, IMaterialVar**
|
||||
pContextData->m_SemiStaticCmdsOut.BindTexture( pShader, SHADER_SAMPLER3, info.m_nBlendModulateTexture, -1 );
|
||||
}
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
if (hasParallaxCorrection)
|
||||
{
|
||||
pContextData->m_SemiStaticCmdsOut.SetPixelShaderConstant( 21, params[info.m_nEnvmapOrigin]->GetVecValue() );
|
||||
|
||||
float* vecs[3];
|
||||
vecs[0] = const_cast<float*>(params[info.m_nEnvmapParallaxObb1]->GetVecValue());
|
||||
vecs[1] = const_cast<float*>(params[info.m_nEnvmapParallaxObb2]->GetVecValue());
|
||||
vecs[2] = const_cast<float*>(params[info.m_nEnvmapParallaxObb3]->GetVecValue());
|
||||
float matrix[4][4];
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
matrix[i][j] = vecs[i][j];
|
||||
}
|
||||
}
|
||||
matrix[3][0] = matrix[3][1] = matrix[3][2] = 0;
|
||||
matrix[3][3] = 1;
|
||||
pContextData->m_SemiStaticCmdsOut.SetPixelShaderConstant( 22, &matrix[0][0], 4 );
|
||||
}
|
||||
#endif
|
||||
|
||||
pContextData->m_SemiStaticCmdsOut.End();
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,10 @@
|
||||
#include <string.h>
|
||||
#include "BaseVSShader.h"
|
||||
|
||||
#ifdef MAPBASE
|
||||
// This requires custom compilers, but anyone ahead of us on that should be able to use this anyway
|
||||
#define PARALLAX_CORRECTED_CUBEMAPS 1
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Forward declarations
|
||||
@ -94,6 +98,15 @@ struct LightmappedGeneric_DX9_Vars_t
|
||||
int m_nPhongBoost;
|
||||
int m_nPhongFresnelRanges;
|
||||
int m_nPhongExponent;
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
int m_nEnvmapParallax;
|
||||
int m_nEnvmapParallaxObb1;
|
||||
int m_nEnvmapParallaxObb2;
|
||||
int m_nEnvmapParallaxObb3;
|
||||
int m_nEnvmapOrigin;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
|
@ -33,6 +33,8 @@
|
||||
// SKIP: $BASETEXTURETRANSFORM2 && !$BASETEXTURE2
|
||||
// SKIP: $BASETEXTURETRANSFORM2 && $SEAMLESS
|
||||
|
||||
// SKIP: $SWAP_VERTEX_BLEND && !$BASETEXTURE2
|
||||
|
||||
// debug crap:
|
||||
// NOSKIP: $DETAILTEXTURE
|
||||
// NOSKIP: $CUBEMAP
|
||||
@ -110,6 +112,12 @@ const float3 g_FlashlightPos : register( c14 );
|
||||
const float4x4 g_FlashlightWorldToTexture : register( c15 ); // through c18
|
||||
const float4 g_ShadowTweaks : register( c19 );
|
||||
|
||||
#if PARALLAXCORRECT
|
||||
// Parallax cubemaps
|
||||
const float3 cubemapPos : register(c21);
|
||||
const float4x4 obbMatrix : register(c22); //through c25
|
||||
#endif
|
||||
|
||||
|
||||
sampler BaseTextureSampler : register( s0 );
|
||||
sampler LightmapSampler : register( s1 );
|
||||
@ -340,7 +348,17 @@ HALF4 main( PS_INPUT i ) : COLOR
|
||||
#if MASKEDBLENDING
|
||||
float blendfactor=0.5;
|
||||
#else
|
||||
|
||||
#if SWAP_VERTEX_BLEND
|
||||
// Blixibon - Hammer apparently has a bug that causes the vertex blend to get swapped.
|
||||
// Hammer uses a special internal shader to nullify this, but it doesn't work with custom shaders.
|
||||
// Downfall got around this by swapping around the base textures in the DLL code when drawn by the editor.
|
||||
// Doing it here in the shader itself allows us to retain other properties, like FANCY_BLENDING.
|
||||
float blendfactor=1.0f-i.vertexBlendX_fogFactorW.r;
|
||||
#else
|
||||
float blendfactor=i.vertexBlendX_fogFactorW.r;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
if( bBaseTexture2 )
|
||||
@ -351,18 +369,8 @@ HALF4 main( PS_INPUT i ) : COLOR
|
||||
float minb=modt.g-modt.r;
|
||||
float maxb=modt.g+modt.r;
|
||||
#else
|
||||
|
||||
# if FANCY_BLENDING == 2
|
||||
// Blixibon - Accompanies the Downfall hack that swaps textures in the editor,
|
||||
// allows $blendmodulatetexture to be seen in Hammer
|
||||
float modtg = 1.0f-modt.g;
|
||||
float minb=max(0,modtg-modt.r);
|
||||
float maxb=min(1,modtg+modt.r);
|
||||
# else
|
||||
float minb=max(0,modt.g-modt.r);
|
||||
float maxb=min(1,modt.g+modt.r);
|
||||
# endif
|
||||
|
||||
#endif
|
||||
blendfactor=smoothstep(minb,maxb,blendfactor);
|
||||
#endif
|
||||
@ -450,7 +458,7 @@ HALF4 main( PS_INPUT i ) : COLOR
|
||||
albedo *= baseColor;
|
||||
if( !bBaseAlphaEnvmapMask && !bSelfIllum )
|
||||
{
|
||||
alpha *= baseColor.a;
|
||||
alpha *= blendedAlpha; // Blixibon - Replaced baseColor.a with blendedAlpha
|
||||
}
|
||||
|
||||
if( bDetailTexture )
|
||||
@ -563,7 +571,7 @@ HALF4 main( PS_INPUT i ) : COLOR
|
||||
if( bSelfIllum )
|
||||
{
|
||||
float3 selfIllumComponent = g_SelfIllumTint.xyz * albedo.xyz;
|
||||
diffuseComponent = lerp( diffuseComponent, selfIllumComponent, baseColor.a );
|
||||
diffuseComponent = lerp( diffuseComponent, selfIllumComponent, blendedAlpha ); // Blixibon - Replaced baseColor.a with blendedAlpha
|
||||
}
|
||||
|
||||
HALF3 specularLighting = HALF3( 0.0f, 0.0f, 0.0f );
|
||||
@ -579,6 +587,23 @@ HALF4 main( PS_INPUT i ) : COLOR
|
||||
fresnel = pow( fresnel, 5.0 );
|
||||
fresnel = fresnel * g_OneMinusFresnelReflection + g_FresnelReflection;
|
||||
|
||||
#if PARALLAXCORRECT
|
||||
//Parallax correction (2_0b and beyond)
|
||||
//Adapted from http://seblagarde.wordpress.com/2012/09/29/image-based-lighting-approaches-and-parallax-corrected-cubemap/
|
||||
float3 worldPos = i.worldPos_projPosZ.xyz;
|
||||
float3 positionLS = mul(float4(worldPos, 1), obbMatrix);
|
||||
float3 rayLS = mul(reflectVect, (float3x3) obbMatrix);
|
||||
|
||||
float3 firstPlaneIntersect = (float3(1.0f, 1.0f, 1.0f) - positionLS) / rayLS;
|
||||
float3 secondPlaneIntersect = (-positionLS) / rayLS;
|
||||
float3 furthestPlane = max(firstPlaneIntersect, secondPlaneIntersect);
|
||||
float distance = min(furthestPlane.x, min(furthestPlane.y, furthestPlane.z));
|
||||
|
||||
// Use distance in WS directly to recover intersection
|
||||
float3 intersectPositionWS = worldPos + reflectVect * distance;
|
||||
reflectVect = intersectPositionWS - cubemapPos;
|
||||
#endif
|
||||
|
||||
specularLighting = ENV_MAP_SCALE * texCUBE( EnvmapSampler, reflectVect );
|
||||
specularLighting *= specularFactor;
|
||||
|
||||
|
@ -56,7 +56,7 @@ SDK_WorldVertexTransition_ps2x.fxc
|
||||
SDK_WorldVertexTransition_vs20.fxc
|
||||
SDK_refract_ps2x.fxc
|
||||
SDK_Refract_vs20.fxc
|
||||
SDK_Water_ps2x.fxc
|
||||
SDK_water_ps2x.fxc
|
||||
SDK_Water_vs20.fxc
|
||||
SDK_WaterCheap_ps2x.fxc
|
||||
SDK_WaterCheap_vs20.fxc
|
||||
|
@ -29,7 +29,7 @@ SDK_depthwrite_ps2x.fxc
|
||||
SDK_depthwrite_vs20.fxc
|
||||
|
||||
SDK_eyes_ps2x.fxc
|
||||
SDK_eyes_vs20.fxc
|
||||
SDK_Eyes_vs20.fxc
|
||||
SDK_eye_refract_ps2x.fxc
|
||||
SDK_eye_refract_vs20.fxc
|
||||
SDK_eyes_flashlight_ps2x.fxc
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
static LightmappedGeneric_DX9_Vars_t s_info;
|
||||
|
||||
static LightmappedGeneric_DX9_Vars_t s_info_editor;
|
||||
//static LightmappedGeneric_DX9_Vars_t s_info_editor;
|
||||
|
||||
|
||||
DEFINE_FALLBACK_SHADER( SDK_WorldVertexTransition, SDK_WorldVertexTransition_DX9 )
|
||||
@ -72,6 +72,15 @@ BEGIN_VS_SHADER( SDK_WorldVertexTransition_DX9, "Help for SDK_WorldVertexTransit
|
||||
SHADER_PARAM( PHONGBOOST, SHADER_PARAM_TYPE_FLOAT, "1.0", "Phong overbrightening factor (specular mask channel should be authored to account for this)" )
|
||||
SHADER_PARAM( PHONGFRESNELRANGES, SHADER_PARAM_TYPE_VEC3, "[0 0.5 1]", "Parameters for remapping fresnel output" )
|
||||
SHADER_PARAM( PHONGEXPONENT, SHADER_PARAM_TYPE_FLOAT, "5.0", "Phong exponent for local specular lights" )
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
SHADER_PARAM( ENVMAPPARALLAX, SHADER_PARAM_TYPE_BOOL, "0", "Enables parallax correction code for env_cubemaps" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB1, SHADER_PARAM_TYPE_VEC4, "[1 0 0 0]", "The first line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB2, SHADER_PARAM_TYPE_VEC4, "[0 1 0 0]", "The second line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPPARALLAXOBB3, SHADER_PARAM_TYPE_VEC4, "[0 0 1 0]", "The third line of the parallax correction OBB matrix" )
|
||||
SHADER_PARAM( ENVMAPORIGIN, SHADER_PARAM_TYPE_VEC3, "[0 0 0]", "The world space position of the env_cubemap being corrected" )
|
||||
#endif
|
||||
END_SHADER_PARAMS
|
||||
|
||||
void SetupVars( LightmappedGeneric_DX9_Vars_t& info )
|
||||
@ -128,6 +137,15 @@ BEGIN_VS_SHADER( SDK_WorldVertexTransition_DX9, "Help for SDK_WorldVertexTransit
|
||||
info.m_nPhongBoost = PHONGBOOST;
|
||||
info.m_nPhongFresnelRanges = PHONGFRESNELRANGES;
|
||||
info.m_nPhongExponent = PHONGEXPONENT;
|
||||
|
||||
#ifdef PARALLAX_CORRECTED_CUBEMAPS
|
||||
// Parallax cubemaps
|
||||
info.m_nEnvmapParallax = ENVMAPPARALLAX;
|
||||
info.m_nEnvmapParallaxObb1 = ENVMAPPARALLAXOBB1;
|
||||
info.m_nEnvmapParallaxObb2 = ENVMAPPARALLAXOBB2;
|
||||
info.m_nEnvmapParallaxObb3 = ENVMAPPARALLAXOBB3;
|
||||
info.m_nEnvmapOrigin = ENVMAPORIGIN;
|
||||
#endif
|
||||
}
|
||||
|
||||
SHADER_FALLBACK
|
||||
@ -142,8 +160,8 @@ BEGIN_VS_SHADER( SDK_WorldVertexTransition_DX9, "Help for SDK_WorldVertexTransit
|
||||
{
|
||||
SetupVars( s_info );
|
||||
InitParamsLightmappedGeneric_DX9( this, params, pMaterialName, s_info );
|
||||
SetupVars( s_info_editor );
|
||||
SwapLayers( s_info_editor );
|
||||
//SetupVars( s_info_editor );
|
||||
//SwapLayers( s_info_editor );
|
||||
}
|
||||
|
||||
SHADER_INIT
|
||||
@ -154,30 +172,27 @@ BEGIN_VS_SHADER( SDK_WorldVertexTransition_DX9, "Help for SDK_WorldVertexTransit
|
||||
|
||||
SHADER_DRAW
|
||||
{
|
||||
if ( UsingEditor( params ) )
|
||||
DrawLightmappedGeneric_DX9( this, params, pShaderAPI, pShaderShadow, s_info_editor, pContextDataPtr );
|
||||
else
|
||||
//if ( UsingEditor( params ) )
|
||||
// DrawLightmappedGeneric_DX9( this, params, pShaderAPI, pShaderShadow, s_info_editor, pContextDataPtr );
|
||||
//else
|
||||
DrawLightmappedGeneric_DX9( this, params, pShaderAPI, pShaderShadow, s_info, pContextDataPtr );
|
||||
}
|
||||
|
||||
private:
|
||||
// This hack is from Half-Life 2: Downfall in order to support WorldVertexTransition in Hammer.
|
||||
// We get around this through a different hack in the shader code itself now.
|
||||
// Original comment:
|
||||
// "Hack to make hammer display WVT in non-inverted way.
|
||||
// It worked ok in standard WVT because of special editor-only shader.
|
||||
// Why Valve just didn't inverted vertex alpha directly in hammer code? oO"
|
||||
static FORCEINLINE void SwapLayers( LightmappedGeneric_DX9_Vars_t &info )
|
||||
{
|
||||
V_swap( info.m_nBaseTexture, info.m_nBaseTexture2 );
|
||||
V_swap( info.m_nBaseTextureFrame, info.m_nBaseTexture2Frame );
|
||||
V_swap( info.m_nBaseTextureNoEnvmap, info.m_nBaseTexture2NoEnvmap );
|
||||
V_swap( info.m_nBumpmap, info.m_nBumpmap2 );
|
||||
V_swap( info.m_nBumpFrame, info.m_nBumpFrame2 );
|
||||
V_swap( info.m_nBumpTransform, info.m_nBumpTransform2 );
|
||||
|
||||
// I added this part myself, but it's no longer needed now that I've extended the hack into the actual shader code.
|
||||
//info.m_nBlendModulateTexture = 0;
|
||||
//info.m_nBlendMaskTransform = 0;
|
||||
}
|
||||
//static FORCEINLINE void SwapLayers( LightmappedGeneric_DX9_Vars_t &info )
|
||||
//{
|
||||
// V_swap( info.m_nBaseTexture, info.m_nBaseTexture2 );
|
||||
// V_swap( info.m_nBaseTextureFrame, info.m_nBaseTexture2Frame );
|
||||
// V_swap( info.m_nBaseTextureNoEnvmap, info.m_nBaseTexture2NoEnvmap );
|
||||
// V_swap( info.m_nBumpmap, info.m_nBumpmap2 );
|
||||
// V_swap( info.m_nBumpFrame, info.m_nBumpFrame2 );
|
||||
// V_swap( info.m_nBumpTransform, info.m_nBumpTransform2 );
|
||||
//}
|
||||
END_SHADER
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user