Skip to content

Commit df7ab55

Browse files
committed
Mapbase v3.1
- 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
1 parent 80b7d99 commit df7ab55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1442
-69
lines changed

README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The original code for phong reflections on LightmappedGeneric-derived shaders ar
77
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)
88
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)
99
The vortigaunt LOS fix is from Half-Life 2: Community Edition (dky.tehkingd.u in particular). (https://gitlab.com/RaraCerberus/HL2CE)
10-
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)
10+
The parallax corrected cubemap code was originally created by Brian Charles. (https://developer.valvesoftware.com/wiki/Parallax_Corrected_Cubemaps)
1111
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/).
1212

1313
All of the work mentioned above was open source when it was borrowed.

sp/src/game/client/clientleafsystem.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,10 +1433,12 @@ inline void AddRenderableToRenderList( CClientRenderablesList &renderList, IClie
14331433
pEntry->m_RenderHandle = renderHandle;
14341434
curCount++;
14351435
}
1436+
#ifndef MAPBASE // According to ficool2, this message can cause significant lag
14361437
else
14371438
{
14381439
engine->Con_NPrintf( 10, "Warning: overflowed CClientRenderablesList group %d", group );
14391440
}
1441+
#endif
14401442
}
14411443

14421444

sp/src/game/client/clientleafsystem.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ class CClientRenderablesList : public CRefCounted<>
5252
public:
5353
enum
5454
{
55+
#ifdef MAPBASE
56+
MAX_GROUP_ENTITIES = 16834 // According to ficool2, this limit is bogus/not enforced by the engine and can be "safely" raised.
57+
#else
5558
MAX_GROUP_ENTITIES = 4096
59+
#endif
5660
};
5761

5862
struct CEntry

sp/src/game/client/clientshadowmgr.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,8 +1468,7 @@ void CClientShadowMgr::InitDepthTextureShadows()
14681468
m_DummyColorTexture.InitRenderTargetSurface( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), IMAGE_FORMAT_BGR565, true );
14691469
#else
14701470
#if defined(MAPBASE) //&& !defined(ASW_PROJECTED_TEXTURES)
1471-
// SAUL: we want to create a render target of specific size, so use RT_SIZE_NO_CHANGE
1472-
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_NO_CHANGE, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
1471+
m_DummyColorTexture.InitRenderTarget( m_nDepthTextureResolution, m_nDepthTextureResolution, RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
14731472
#else
14741473
m_DummyColorTexture.InitRenderTarget( r_flashlightdepthres.GetInt(), r_flashlightdepthres.GetInt(), RT_SIZE_OFFSCREEN, nullFormat, MATERIAL_RT_DEPTH_NONE, false, "_rt_ShadowDummy" );
14751474
#endif

sp/src/game/client/hl2/c_script_intro.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ const QAngle &C_PlayerViewProxy::EyeAngles( void )
440440
float fldummy;
441441
pPlayer->CalcView( vecOrigin, angAngles, fldummy, fldummy, fldummy );
442442

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

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

462462
vecOrigin = GetAbsOrigin() + (vecOrigin - pPlayer->GetAbsOrigin());
463+
angAngles = GetAbsAngles() + (angAngles - pPlayer->GetAbsAngles());
463464
}
464465
else
465466
{
@@ -474,7 +475,7 @@ const QAngle &C_PlayerViewProxy::LocalEyeAngles( void )
474475
{
475476
C_BasePlayer *pPlayer = GetPlayer();
476477
if (pPlayer)
477-
return pPlayer->LocalEyeAngles();
478+
return GetAbsAngles() + (pPlayer->LocalEyeAngles() - pPlayer->GetAbsAngles());
478479
else
479480
return BaseClass::LocalEyeAngles();
480481
}

sp/src/game/server/ai_activity.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2188,6 +2188,14 @@ void CAI_BaseNPC::InitDefaultActivitySR(void)
21882188
#ifdef SHARED_COMBINE_ACTIVITIES
21892189
ADD_ACTIVITY_TO_SR( ACT_COMBINE_THROW_GRENADE );
21902190
ADD_ACTIVITY_TO_SR( ACT_COMBINE_AR2_ALTFIRE );
2191+
2192+
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_ADVANCE );
2193+
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_FORWARD );
2194+
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_GROUP );
2195+
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_HALT );
2196+
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_LEFT );
2197+
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_RIGHT );
2198+
ADD_ACTIVITY_TO_SR( ACT_GESTURE_SIGNAL_TAKECOVER );
21912199
#endif
21922200

21932201
#ifdef COMPANION_HOLSTER_WORKAROUND

sp/src/game/server/ai_basenpc.cpp

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1876,6 +1876,46 @@ void CAI_BaseNPC::InputSetThinkNPC( inputdata_t &inputdata )
18761876
SetThink ( &CAI_BaseNPC::CallNPCThink );
18771877
SetNextThink(gpGlobals->curtime + inputdata.value.Float());
18781878
}
1879+
1880+
//------------------------------------------------------------------------------
1881+
// Purpose: Sets our look distance
1882+
//------------------------------------------------------------------------------
1883+
void CAI_BaseNPC::InputSetDistLook( inputdata_t &inputdata )
1884+
{
1885+
if ( inputdata.value.Float() != 0.0f )
1886+
{
1887+
SetDistLook( inputdata.value.Float() );
1888+
}
1889+
else
1890+
{
1891+
SetDistLook( 2048.0 );
1892+
1893+
if ( HasSpawnFlags( SF_NPC_LONG_RANGE ) )
1894+
{
1895+
SetDistLook( 6000.0 );
1896+
}
1897+
}
1898+
}
1899+
1900+
//------------------------------------------------------------------------------
1901+
// Purpose: Sets our distance too far
1902+
//------------------------------------------------------------------------------
1903+
void CAI_BaseNPC::InputSetDistTooFar( inputdata_t &inputdata )
1904+
{
1905+
if ( inputdata.value.Float() != 0.0f )
1906+
{
1907+
m_flDistTooFar = inputdata.value.Float();
1908+
}
1909+
else
1910+
{
1911+
m_flDistTooFar = 1024.0;
1912+
1913+
if ( HasSpawnFlags( SF_NPC_LONG_RANGE ) )
1914+
{
1915+
m_flDistTooFar = 1e9f;
1916+
}
1917+
}
1918+
}
18791919
#endif
18801920

18811921
//---------------------------------------------------------
@@ -11599,6 +11639,8 @@ BEGIN_DATADESC( CAI_BaseNPC )
1159911639

1160011640
#ifdef MAPBASE
1160111641
DEFINE_KEYFIELD( m_FriendlyFireOverride, FIELD_INTEGER, "FriendlyFireOverride" ),
11642+
11643+
DEFINE_KEYFIELD( m_flSpeedModifier, FIELD_FLOAT, "BaseSpeedModifier" ),
1160211644
#endif
1160311645

1160411646
// Satisfy classcheck
@@ -11700,6 +11742,11 @@ BEGIN_DATADESC( CAI_BaseNPC )
1170011742

1170111743
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetThinkNPC", InputSetThinkNPC ),
1170211744

11745+
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDistLook", InputSetDistLook ),
11746+
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetDistTooFar", InputSetDistTooFar ),
11747+
11748+
DEFINE_INPUTFUNC( FIELD_FLOAT, "SetSpeedModifier", InputSetSpeedModifier ),
11749+
1170311750
DEFINE_OUTPUT( m_OnStateChange, "OnStateChange" ),
1170411751
#endif
1170511752

@@ -12356,6 +12403,7 @@ CAI_BaseNPC::CAI_BaseNPC(void)
1235612403

1235712404
#ifdef MAPBASE
1235812405
m_iDynamicInteractionsAllowed = TRS_NONE;
12406+
m_flSpeedModifier = 1.0f;
1235912407
#endif
1236012408
}
1236112409

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

14018+
#ifdef MAPBASE
14019+
//-----------------------------------------------------------------------------
14020+
// Purpose: Get movement speed, multipled by modifier
14021+
//-----------------------------------------------------------------------------
14022+
float CAI_BaseNPC::GetSequenceGroundSpeed( CStudioHdr *pStudioHdr, int iSequence )
14023+
{
14024+
float t = SequenceDuration( pStudioHdr, iSequence );
14025+
14026+
if (t > 0)
14027+
{
14028+
return (GetSequenceMoveDist( pStudioHdr, iSequence ) * m_flSpeedModifier / t);
14029+
}
14030+
else
14031+
{
14032+
return 0;
14033+
}
14034+
}
14035+
14036+
//-----------------------------------------------------------------------------
14037+
// Purpose: Hammer input to change the speed of the NPC (based on 1upD's npc_shadow_walker code)
14038+
// Not to be confused with the inputs above
14039+
//-----------------------------------------------------------------------------
14040+
void CAI_BaseNPC::InputSetSpeedModifier( inputdata_t &inputdata )
14041+
{
14042+
this->m_flSpeedModifier = inputdata.value.Float();
14043+
}
14044+
#endif
14045+
1397014046
//-----------------------------------------------------------------------------
1397114047
// Purpose:
1397214048
//-----------------------------------------------------------------------------
@@ -15534,6 +15610,12 @@ bool CAI_BaseNPC::IsCrouchedActivity( Activity activity )
1553415610
case ACT_RANGE_AIM_AR2_LOW:
1553515611
case ACT_RANGE_AIM_SMG1_LOW:
1553615612
case ACT_RANGE_AIM_PISTOL_LOW:
15613+
15614+
case ACT_RANGE_ATTACK1_LOW:
15615+
case ACT_RANGE_ATTACK_AR2_LOW:
15616+
case ACT_RANGE_ATTACK_SMG1_LOW:
15617+
case ACT_RANGE_ATTACK_PISTOL_LOW:
15618+
case ACT_RANGE_ATTACK2_LOW:
1553715619
#endif
1553815620
return true;
1553915621
}

sp/src/game/server/ai_basenpc.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,10 @@ class CAI_BaseNPC : public CBaseCombatCharacter,
10411041
const CAI_Senses * GetSenses() const { return m_pSenses; }
10421042

10431043
void SetDistLook( float flDistLook );
1044+
#ifdef MAPBASE
1045+
void InputSetDistLook( inputdata_t &inputdata );
1046+
void InputSetDistTooFar( inputdata_t &inputdata );
1047+
#endif
10441048

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

2283+
#ifdef MAPBASE
2284+
// Hammer input to change the speed of the NPC (based on 1upD's npc_shadow_walker code)
2285+
// Not to be confused with the inputs above
2286+
virtual float GetSequenceGroundSpeed( CStudioHdr *pStudioHdr, int iSequence );
2287+
inline float GetSequenceGroundSpeed( int iSequence ) { return GetSequenceGroundSpeed( GetModelPtr(), iSequence ); }
2288+
void InputSetSpeedModifier( inputdata_t &inputdata );
2289+
float m_flSpeedModifier;
2290+
#endif
2291+
22792292
virtual bool ShouldProbeCollideAgainstEntity( CBaseEntity *pEntity );
22802293

22812294
bool m_bPlayerAvoidState;

sp/src/game/server/basecombatcharacter.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,17 @@ ConVar ai_force_serverside_ragdoll( "ai_force_serverside_ragdoll", "0" );
7373

7474
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]
7575

76+
#ifdef MAPBASE
77+
// ShouldUseVisibilityCache() is used as an actual function now
78+
ConVar ai_use_visibility_cache( "ai_use_visibility_cache", "1" );
79+
#else
7680
#ifndef _RETAIL
7781
ConVar ai_use_visibility_cache( "ai_use_visibility_cache", "1" );
7882
#define ShouldUseVisibilityCache() ai_use_visibility_cache.GetBool()
7983
#else
8084
#define ShouldUseVisibilityCache() true
8185
#endif
86+
#endif
8287

8388
BEGIN_DATADESC( CBaseCombatCharacter )
8489

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

374+
#ifdef MAPBASE
375+
if ( traceMask != MASK_BLOCKLOS || !ShouldUseVisibilityCache( pEntity ) || pEntity == this || !ai_use_visibility_cache.GetBool()
376+
)
377+
#else
369378
if ( traceMask != MASK_BLOCKLOS || !ShouldUseVisibilityCache() || pEntity == this
370379
#if defined(HL2_DLL)
371380
|| Classify() == CLASS_BULLSEYE || pEntity->Classify() == CLASS_BULLSEYE
372381
#endif
373382
)
383+
#endif
374384
{
375385
return BaseClass::FVisible( pEntity, traceMask, ppBlocker );
376386
}
@@ -476,6 +486,17 @@ void CBaseCombatCharacter::ResetVisibilityCache( CBaseCombatCharacter *pBCC )
476486
}
477487
}
478488

489+
#ifdef MAPBASE
490+
bool CBaseCombatCharacter::ShouldUseVisibilityCache( CBaseEntity *pEntity )
491+
{
492+
#ifdef HL2_DLL
493+
return Classify() != CLASS_BULLSEYE && pEntity->Classify() != CLASS_BULLSEYE;
494+
#else
495+
return true;
496+
#endif
497+
}
498+
#endif
499+
479500
#ifdef PORTAL
480501
bool CBaseCombatCharacter::FVisibleThroughPortal( const CProp_Portal *pPortal, CBaseEntity *pEntity, int traceMask, CBaseEntity **ppBlocker )
481502
{
@@ -4070,7 +4091,7 @@ void CBaseCombatCharacter::InputPickupWeaponInstant( inputdata_t &inputdata )
40704091
}
40714092
else
40724093
{
4073-
Warning("%s received PickupWeaponInstant with invalid entity %s\n", inputdata.value.Entity() ? "null" : inputdata.value.Entity()->GetDebugName());
4094+
Warning("%s received PickupWeaponInstant with invalid entity %s\n", GetDebugName(), inputdata.value.Entity() ? "null" : inputdata.value.Entity()->GetDebugName());
40744095
}
40754096
}
40764097

sp/src/game/server/basecombatcharacter.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,10 @@ class CBaseCombatCharacter : public CBaseFlex
136136
virtual bool FVisible( const Vector &vecTarget, int traceMask = MASK_BLOCKLOS, CBaseEntity **ppBlocker = NULL ) { return BaseClass::FVisible( vecTarget, traceMask, ppBlocker ); }
137137
static void ResetVisibilityCache( CBaseCombatCharacter *pBCC = NULL );
138138

139+
#ifdef MAPBASE
140+
virtual bool ShouldUseVisibilityCache( CBaseEntity *pEntity );
141+
#endif
142+
139143
#ifdef PORTAL
140144
virtual bool FVisibleThroughPortal( const CProp_Portal *pPortal, CBaseEntity *pEntity, int traceMask = MASK_BLOCKLOS, CBaseEntity **ppBlocker = NULL );
141145
#endif

0 commit comments

Comments
 (0)