Skip to content

Commit

Permalink
Mapbase v3.1
Browse files Browse the repository at this point in the history
- Fixed filter_damage_mod blocking all damage which doesn't match the secondary filter regardless of secondary filter mode
- Fixed impulse 101 and other give-related commands leaving behind weapons with occupied slots
- Fixed a crash with scripted_sound's PlaySoundOnEntity when the entity doesn't exist
- Added OnSoundFinished output to ambient_generic
- Added the ability to use custom models/nuggets with item_grubnugget
- Fixed a crash with citizen medics healing nonexistent targets
- Added "SetDistLook" and "SetDistTooFar" inputs for NPCs, allowing manual adjustment of NPC sight distance
- Added keyvalue and input to env_microphone for utilizing a different audio channel
- Added "SetPitchScale" input to env_microphone
- Fixed info_player_view_proxy not using angles
- Fixed dirt variant elite model not being recognized as elite
- Made headcrab hints properly register the start of use (for hint outputs)
- Made RPG use a more realistic firing rate for NPCs which aren't constrained by slow RPG animations, like soldiers
- Added spawnflag for func_breakable_surf to correctly play the break sound
- Added keyvalue for using cheaper warn sound code for combine_mines
- Added "OnSpawnNPC" output for npc_combinedropship when it spawns a soldier, rollermine, or strider
- Added signal gesture activities
- Fixed stunstick not using metrocop knockout/stun code correctly
- Fixed a possible crash involving a NPC's weapon being removed during alt-fire
- Fixed(?) flashlight shadow filters
- Added support for multiple look entities in trigger_look
- Added npc_metropolice alt-firing
- Fixed npc_metropolice using pistol burst firing on weapon_357
- Fixed npc_metropolice not deploying manhacks/throwing grenades in standoffs
- Fixed npc_metropolice not recognizing some crouch activities correctly
- Changed weapon_357 so it runs a tracer each shot from NPCs
- Added SDK_ShatteredGlass, a Mapbase version of ShatteredGlass
- Added "SetSpeedModifier" to NPCs, based on 1upD's shadow walker code
- Made game_convar_mod much more reliable
- Fixed non-mirrored npc_turret_lab refusing to die
- Made npc_turret_lab use SMG1 ammo instead of AR2 ammo
- Fixed block LOS brushes sometimes not working with players (and possibly similar issues)
- Raised maximum renderable entities from 4096 to 16384, based on ficool2's limit research
- Added SDK_ShatteredGlass, a Mapbase version of ShatteredGlass. Can display parallax corrected cubemaps from its unbroken form
- Fixed VBSP breaking func_breakable_surf, etc. when using parallax corrected cubemaps
- Raised maximum VBSP entities from 8192 to 65536, based on ficool2's limit research
- Raised maximum VBSP worldlights from 8192 to 65536, based on ficool2's limit research
- Raised maximum VBSP overlays from 512 to 8192, based on ficool2's limit research
- Other misc. fixes
  • Loading branch information
Blixibon committed May 2, 2020
1 parent c5f3fa0 commit af85131
Show file tree
Hide file tree
Showing 51 changed files with 1,442 additions and 69 deletions.
2 changes: 1 addition & 1 deletion README
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +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)
The parallax corrected cubemap code 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.
Expand Down
2 changes: 2 additions & 0 deletions sp/src/game/client/clientleafsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1433,10 +1433,12 @@ inline void AddRenderableToRenderList( CClientRenderablesList &renderList, IClie
pEntry->m_RenderHandle = renderHandle;
curCount++;
}
#ifndef MAPBASE // According to ficool2, this message can cause significant lag
else
{
engine->Con_NPrintf( 10, "Warning: overflowed CClientRenderablesList group %d", group );
}
#endif
}


Expand Down
4 changes: 4 additions & 0 deletions sp/src/game/client/clientleafsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ class CClientRenderablesList : public CRefCounted<>
public:
enum
{
#ifdef MAPBASE
MAX_GROUP_ENTITIES = 16834 // According to ficool2, this limit is bogus/not enforced by the engine and can be "safely" raised.
#else
MAX_GROUP_ENTITIES = 4096
#endif
};

struct CEntry
Expand Down
3 changes: 1 addition & 2 deletions sp/src/game/client/clientshadowmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,8 +1468,7 @@ void CClientShadowMgr::InitDepthTextureShadows()
m_DummyColorTexture.InitRenderTargetSurface( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), IMAGE_FORMAT_BGR565, true );
#else
#if defined(MAPBASE) //&& !defined(ASW_PROJECTED_TEXTURES)
// SAUL: we want to create a render target of specific size, so use RT_SIZE_NO_CHANGE
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_NO_CHANGE, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
#else
m_DummyColorTexture.InitRenderTarget( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
#endif
Expand Down
5 changes: 3 additions & 2 deletions sp/src/game/client/hl2/c_script_intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ const QAngle &C_PlayerViewProxy::EyeAngles( void )
float fldummy;
pPlayer->CalcView( vecOrigin, angAngles, fldummy, fldummy, fldummy );

return angAngles;
return GetAbsAngles() + (angAngles - pPlayer->GetAbsAngles());

//return m_hPlayer.Get()->EyeAngles();
}
Expand All @@ -460,6 +460,7 @@ void C_PlayerViewProxy::GetEyePosition( Vector &vecOrigin, QAngle &angAngles )
pPlayer->CalcView( vecOrigin, angAngles, fldummy, fldummy, fldummy );

vecOrigin = GetAbsOrigin() + (vecOrigin - pPlayer->GetAbsOrigin());
angAngles = GetAbsAngles() + (angAngles - pPlayer->GetAbsAngles());
}
else
{
Expand All @@ -474,7 +475,7 @@ const QAngle &C_PlayerViewProxy::LocalEyeAngles( void )
{
C_BasePlayer *pPlayer = GetPlayer();
if (pPlayer)
return pPlayer->LocalEyeAngles();
return GetAbsAngles() + (pPlayer->LocalEyeAngles() - pPlayer->GetAbsAngles());
else
return BaseClass::LocalEyeAngles();
}
Expand Down
8 changes: 8 additions & 0 deletions sp/src/game/server/ai_activity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2188,6 +2188,14 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
#ifdef SHARED_COMBINE_ACTIVITIES
ADD_ACTIVITY_TO_SR( ACT_COMBINE_THROW_GRENADE );
ADD_ACTIVITY_TO_SR( ACT_COMBINE_AR2_ALTFIRE );

ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_ADVANCE );
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_FORWARD );
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_GROUP );
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_HALT );
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_LEFT );
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_RIGHT );
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_TAKECOVER );
#endif

#ifdef COMPANION_HOLSTER_WORKAROUND
Expand Down
82 changes: 82 additions & 0 deletions sp/src/game/server/ai_basenpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1876,6 +1876,46 @@ void CAI_BaseNPC::InputSetThinkNPC( inputdata_t &inputdata )
SetThink ( &CAI_BaseNPC::CallNPCThink );
SetNextThink(gpGlobals->curtime + inputdata.value.Float());
}

//------------------------------------------------------------------------------
// Purpose: Sets our look distance
//------------------------------------------------------------------------------
void CAI_BaseNPC::InputSetDistLook( inputdata_t &inputdata )
{
if ( inputdata.value.Float() != 0.0f )
{
SetDistLook( inputdata.value.Float() );
}
else
{
SetDistLook( 2048.0 );

if ( HasSpawnFlags( SF_NPC_LONG_RANGE ) )
{
SetDistLook( 6000.0 );
}
}
}

//------------------------------------------------------------------------------
// Purpose: Sets our distance too far
//------------------------------------------------------------------------------
void CAI_BaseNPC::InputSetDistTooFar( inputdata_t &inputdata )
{
if ( inputdata.value.Float() != 0.0f )
{
m_flDistTooFar = inputdata.value.Float();
}
else
{
m_flDistTooFar = 1024.0;

if ( HasSpawnFlags( SF_NPC_LONG_RANGE ) )
{
m_flDistTooFar = 1e9f;
}
}
}
#endif

//---------------------------------------------------------
Expand Down Expand Up @@ -11599,6 +11639,8 @@ BEGIN_DATADESC( CAI_BaseNPC )

#ifdef MAPBASE
DEFINE_KEYFIELD( m_FriendlyFireOverride, FIELD_INTEGER, "FriendlyFireOverride" ),

DEFINE_KEYFIELD( m_flSpeedModifier, FIELD_FLOAT, "BaseSpeedModifier" ),
#endif

// Satisfy classcheck
Expand Down Expand Up @@ -11700,6 +11742,11 @@ BEGIN_DATADESC( CAI_BaseNPC )

DEFINE_INPUTFUNC( FIELD_FLOAT, "SetThinkNPC", InputSetThinkNPC ),

DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDistLook", InputSetDistLook ),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDistTooFar", InputSetDistTooFar ),

DEFINE_INPUTFUNC( FIELD_FLOAT, "SetSpeedModifier", InputSetSpeedModifier ),

DEFINE_OUTPUT( m_OnStateChange, "OnStateChange" ),
#endif

Expand Down Expand Up @@ -12356,6 +12403,7 @@ CAI_BaseNPC::CAI_BaseNPC(void)

#ifdef MAPBASE
m_iDynamicInteractionsAllowed = TRS_NONE;
m_flSpeedModifier = 1.0f;
#endif
}

Expand Down Expand Up @@ -13967,6 +14015,34 @@ void CAI_BaseNPC::InputSetSpeedModifierSpeed( inputdata_t &inputdata )
m_iSpeedModSpeed = inputdata.value.Int();
}

#ifdef MAPBASE
//-----------------------------------------------------------------------------
// Purpose: Get movement speed, multipled by modifier
//-----------------------------------------------------------------------------
float CAI_BaseNPC::GetSequenceGroundSpeed( CStudioHdr *pStudioHdr, int iSequence )
{
float t = SequenceDuration( pStudioHdr, iSequence );

if (t > 0)
{
return (GetSequenceMoveDist( pStudioHdr, iSequence ) * m_flSpeedModifier / t);
}
else
{
return 0;
}
}

//-----------------------------------------------------------------------------
// Purpose: Hammer input to change the speed of the NPC (based on 1upD's npc_shadow_walker code)
// Not to be confused with the inputs above
//-----------------------------------------------------------------------------
void CAI_BaseNPC::InputSetSpeedModifier( inputdata_t &inputdata )
{
this->m_flSpeedModifier = inputdata.value.Float();
}
#endif

//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -15534,6 +15610,12 @@ bool CAI_BaseNPC::IsCrouchedActivity( Activity activity )
case ACT_RANGE_AIM_AR2_LOW:
case ACT_RANGE_AIM_SMG1_LOW:
case ACT_RANGE_AIM_PISTOL_LOW:

case ACT_RANGE_ATTACK1_LOW:
case ACT_RANGE_ATTACK_AR2_LOW:
case ACT_RANGE_ATTACK_SMG1_LOW:
case ACT_RANGE_ATTACK_PISTOL_LOW:
case ACT_RANGE_ATTACK2_LOW:
#endif
return true;
}
Expand Down
13 changes: 13 additions & 0 deletions sp/src/game/server/ai_basenpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,10 @@ class CAI_BaseNPC : public CBaseCombatCharacter,
const CAI_Senses * GetSenses() const { return m_pSenses; }

void SetDistLook( float flDistLook );
#ifdef MAPBASE
void InputSetDistLook( inputdata_t &inputdata );
void InputSetDistTooFar( inputdata_t &inputdata );
#endif

virtual bool QueryHearSound( CSound *pSound );
virtual bool QuerySeeEntity( CBaseEntity *pEntity, bool bOnlyHateOrFearIfNPC = false );
Expand Down Expand Up @@ -2276,6 +2280,15 @@ class CAI_BaseNPC : public CBaseCombatCharacter,
void InputSetSpeedModifierRadius( inputdata_t &inputdata );
void InputSetSpeedModifierSpeed( inputdata_t &inputdata );

#ifdef MAPBASE
// Hammer input to change the speed of the NPC (based on 1upD's npc_shadow_walker code)
// Not to be confused with the inputs above
virtual float GetSequenceGroundSpeed( CStudioHdr *pStudioHdr, int iSequence );
inline float GetSequenceGroundSpeed( int iSequence ) { return GetSequenceGroundSpeed( GetModelPtr(), iSequence ); }
void InputSetSpeedModifier( inputdata_t &inputdata );
float m_flSpeedModifier;
#endif

virtual bool ShouldProbeCollideAgainstEntity( CBaseEntity *pEntity );

bool m_bPlayerAvoidState;
Expand Down
23 changes: 22 additions & 1 deletion sp/src/game/server/basecombatcharacter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@ ConVar ai_force_serverside_ragdoll( "ai_force_serverside_ragdoll", "0" );

ConVar nb_last_area_update_tolerance( "nb_last_area_update_tolerance", "4.0", FCVAR_CHEAT, "Distance a character needs to travel in order to invalidate cached area" ); // 4.0 tested as sweet spot (for wanderers, at least). More resulted in little benefit, less quickly diminished benefit [7/31/2008 tom]

#ifdef MAPBASE
// ShouldUseVisibilityCache() is used as an actual function now
ConVar ai_use_visibility_cache( "ai_use_visibility_cache", "1" );
#else
#ifndef _RETAIL
ConVar ai_use_visibility_cache( "ai_use_visibility_cache", "1" );
#define ShouldUseVisibilityCache() ai_use_visibility_cache.GetBool()
#else
#define ShouldUseVisibilityCache() true
#endif
#endif

BEGIN_DATADESC( CBaseCombatCharacter )

Expand Down Expand Up @@ -366,11 +371,16 @@ bool CBaseCombatCharacter::FVisible( CBaseEntity *pEntity, int traceMask, CBaseE
{
VPROF( "CBaseCombatCharacter::FVisible" );

#ifdef MAPBASE
if ( traceMask != MASK_BLOCKLOS || !ShouldUseVisibilityCache( pEntity ) || pEntity == this || !ai_use_visibility_cache.GetBool()
)
#else
if ( traceMask != MASK_BLOCKLOS || !ShouldUseVisibilityCache() || pEntity == this
#if defined(HL2_DLL)
|| Classify() == CLASS_BULLSEYE || pEntity->Classify() == CLASS_BULLSEYE
#endif
)
#endif
{
return BaseClass::FVisible( pEntity, traceMask, ppBlocker );
}
Expand Down Expand Up @@ -476,6 +486,17 @@ void CBaseCombatCharacter::ResetVisibilityCache( CBaseCombatCharacter *pBCC )
}
}

#ifdef MAPBASE
bool CBaseCombatCharacter::ShouldUseVisibilityCache( CBaseEntity *pEntity )
{
#ifdef HL2_DLL
return Classify() != CLASS_BULLSEYE && pEntity->Classify() != CLASS_BULLSEYE;
#else
return true;
#endif
}
#endif

#ifdef PORTAL
bool CBaseCombatCharacter::FVisibleThroughPortal( const CProp_Portal *pPortal, CBaseEntity *pEntity, int traceMask, CBaseEntity **ppBlocker )
{
Expand Down Expand Up @@ -4070,7 +4091,7 @@ void CBaseCombatCharacter::InputPickupWeaponInstant( inputdata_t &inputdata )
}
else
{
Warning("%s received PickupWeaponInstant with invalid entity %s\n", inputdata.value.Entity() ? "null" : inputdata.value.Entity()->GetDebugName());
Warning("%s received PickupWeaponInstant with invalid entity %s\n", GetDebugName(), inputdata.value.Entity() ? "null" : inputdata.value.Entity()->GetDebugName());
}
}

Expand Down
4 changes: 4 additions & 0 deletions sp/src/game/server/basecombatcharacter.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ class CBaseCombatCharacter : public CBaseFlex
virtual bool FVisible( const Vector &vecTarget, int traceMask = MASK_BLOCKLOS, CBaseEntity **ppBlocker = NULL ) { return BaseClass::FVisible( vecTarget, traceMask, ppBlocker ); }
static void ResetVisibilityCache( CBaseCombatCharacter *pBCC = NULL );

#ifdef MAPBASE
virtual bool ShouldUseVisibilityCache( CBaseEntity *pEntity );
#endif

#ifdef PORTAL
virtual bool FVisibleThroughPortal( const CProp_Portal *pPortal, CBaseEntity *pEntity, int traceMask = MASK_BLOCKLOS, CBaseEntity **ppBlocker = NULL );
#endif
Expand Down
25 changes: 25 additions & 0 deletions sp/src/game/server/envmicrophone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ BEGIN_DATADESC( CEnvMicrophone )
DEFINE_KEYFIELD(m_iszLandmarkName, FIELD_STRING, "landmark"),
DEFINE_FIELD(m_hLandmark, FIELD_EHANDLE),
DEFINE_KEYFIELD(m_flPitchScale, FIELD_FLOAT, "PitchScale"),
DEFINE_KEYFIELD(m_nChannel, FIELD_INTEGER, "channel"),
#endif
// DEFINE_FIELD(m_bAvoidFeedback, FIELD_BOOLEAN), // DONT SAVE
DEFINE_KEYFIELD(m_iSpeakerDSPPreset, FIELD_INTEGER, "speaker_dsp_preset" ),
Expand All @@ -59,6 +60,8 @@ BEGIN_DATADESC( CEnvMicrophone )
DEFINE_INPUTFUNC(FIELD_STRING, "SetSpeakerName", InputSetSpeakerName),
#ifdef MAPBASE
DEFINE_INPUTFUNC(FIELD_INTEGER, "SetDSPPreset", InputSetDSPPreset),
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetPitchScale", InputSetPitchScale ),
DEFINE_INPUTFUNC( FIELD_INTEGER, "SetChannel", InputSetChannel ),
#endif

DEFINE_OUTPUT(m_SoundLevel, "SoundLevel"),
Expand Down Expand Up @@ -259,6 +262,24 @@ void CEnvMicrophone::InputSetDSPPreset( inputdata_t &inputdata )
m_iSpeakerDSPPreset = inputdata.value.Int();
ActivateSpeaker();
}

//-----------------------------------------------------------------------------
// Purpose:
// Input : &inputdata -
//-----------------------------------------------------------------------------
void CEnvMicrophone::InputSetPitchScale( inputdata_t &inputdata )
{
m_flPitchScale = inputdata.value.Float();
}

//-----------------------------------------------------------------------------
// Purpose:
// Input : &inputdata -
//-----------------------------------------------------------------------------
void CEnvMicrophone::InputSetChannel( inputdata_t &inputdata )
{
m_nChannel = inputdata.value.Int();
}
#endif

//-----------------------------------------------------------------------------
Expand Down Expand Up @@ -522,7 +543,11 @@ MicrophoneResult_t CEnvMicrophone::SoundPlayed( int entindex, const char *soundn
CPASAttenuationFilter filter( m_hSpeaker );

EmitSound_t ep;
#ifdef MAPBASE
ep.m_nChannel = m_nChannel;
#else
ep.m_nChannel = CHAN_STATIC;
#endif
ep.m_pSoundName = soundname;
ep.m_flVolume = flVolume;
ep.m_SoundLevel = soundlevel;
Expand Down
3 changes: 3 additions & 0 deletions sp/src/game/server/envmicrophone.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class CEnvMicrophone : public CPointEntity
void InputSetSpeakerName( inputdata_t &inputdata );
#ifdef MAPBASE
void InputSetDSPPreset( inputdata_t &inputdata );
void InputSetPitchScale( inputdata_t &inputdata );
void InputSetChannel( inputdata_t &inputdata );
#endif

DECLARE_DATADESC();
Expand Down Expand Up @@ -86,6 +88,7 @@ class CEnvMicrophone : public CPointEntity
string_t m_iszLandmarkName;
EHANDLE m_hLandmark;
float m_flPitchScale = 1.0f;
int m_nChannel = CHAN_STATIC;
#endif

COutputFloat m_SoundLevel; // Fired when the sampled volume level changes.
Expand Down
8 changes: 8 additions & 0 deletions sp/src/game/server/filters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1899,6 +1899,14 @@ class CFilterDamageMod : public CBaseFilterRedirect
return true;
}

bool PassesDamageFilterImpl( CBaseEntity *pCaller, const CTakeDamageInfo &info )
{
if (GetTargetFilter() && m_iSecondaryFilterMode == REDIRECT_MUST_PASS_TO_DAMAGE_CALLER)
return RedirectToDamageFilter( pCaller, info );

return true;
}

bool DamageMod( CBaseEntity *pCaller, CTakeDamageInfo &info )
{
if (GetTargetFilter())
Expand Down
Loading

0 comments on commit af85131

Please sign in to comment.