mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-23 20:09:45 +03:00
Merged dev changes 9/28/2019
- Experimental RPC stuff for the future - Fixed players running over allies with vehicles (kind of) - Modified redirect filter infrastructure to support when there's no target filter (meaning it will just make sure the entity exists) - Fixed SDK_EyeRefract - Fixed env_beam SetStart/EndEntity - New "OnStateChange" output on NPCs - scripted_face removed (use generic facing VCDs instead) - Fixed RPC - View ID nodraw keyvalue + reflective glass view ID fix - CopyAnimationDataFrom expansion (more variables copied) - Fixed pre-Mapbase env_projectedtextures not updating after loading a save - Fixed(?) player companion grenade throwing being interrupted - Added convars for secondary and NPC shotgun pellet amounts - NPC fade distance/scale transfers to its ragdoll - Made node graph rebuild occur sooner after map load - Added option to disable "node graph out of date" message - Fixed ent_fire delay (decimals discarded before) - "SetFilter" on func_clip_vphysics - Fixed func_tank zero barrel (untested) - Fixed npc_turret_ground parenting fix - Added toggle-able weapon_crossbow experimental hit location code - Fixed ally grenades being considered Combine grenades - Added SDK_MonitorScreen and SDK_UnlitTwoTexture - Updated README - Added !activator/!caller support to logic_collision_pair - Fixed ortho not working in script_intro - Added Nbc66's closed captioning language fix - Applied fade fix to server ragdolls - Added combine_mine friend/foe filters - Fixed env_starfield pausing - Reworked PickupWeapon/Item inputs - Fixed context response system $ usage - Fixed env_break_shooter velocity/speed - Made func_breakable "Spawn on break" support other entities - Fixed OnThrowGrenade > point_entity_replace blip - Added mapname to logic_externaldata - Added "Random Template" to point_template - Added "Use LOS" to trigger_look - Added flags based on L4D(2) to trigger_playermovement - Added npc_combine_s "Alternate Capable" keyvalue that enables both grenades and alt-fire at the same time regardless of elite status - Fixed npc_combine_s DropGrenade input - Miscellaneous code and comment changes
This commit is contained in:
@@ -399,6 +399,81 @@ bool CPointTemplate::CreateInstance( const Vector &vecOrigin, const QAngle &vecA
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef MAPBASE
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Spawn one of the entities I contain
|
||||
// Input : &vecOrigin -
|
||||
// &vecAngles -
|
||||
// pEntities -
|
||||
// Output : Returns true on success, false on failure.
|
||||
//-----------------------------------------------------------------------------
|
||||
bool CPointTemplate::CreateSpecificInstance( int iTemplate, const Vector &vecOrigin, const QAngle &vecAngles, CBaseEntity **pOutEntity )
|
||||
{
|
||||
// Go through all our templated map data and spawn all the entities in it
|
||||
int iTemplates = m_hTemplates.Count();
|
||||
if ( !iTemplates )
|
||||
{
|
||||
Msg("CreateInstance called on a point_template that has no templates: %s\n", STRING(GetEntityName()) );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Tell the template system we're about to start a new template
|
||||
Templates_StartUniqueInstance();
|
||||
|
||||
CBaseEntity *pEntity = NULL;
|
||||
char *pMapData;
|
||||
int iTemplateIndex = m_hTemplates[iTemplate].iTemplateIndex;
|
||||
|
||||
// Some templates have Entity I/O connecting the entities within the template.
|
||||
// Unique versions of these templates need to be created whenever they're instanced.
|
||||
if ( AllowNameFixup() && Templates_IndexRequiresEntityIOFixup( iTemplateIndex ) )
|
||||
{
|
||||
// This template requires instancing.
|
||||
// Create a new mapdata block and ask the template system to fill it in with
|
||||
// a unique version (with fixed Entity I/O connections).
|
||||
pMapData = Templates_GetEntityIOFixedMapData( iTemplateIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the unmodified mapdata
|
||||
pMapData = (char*)STRING( Templates_FindByIndex( iTemplateIndex ) );
|
||||
}
|
||||
|
||||
// Create the entity from the mapdata
|
||||
MapEntity_ParseEntity( pEntity, pMapData, NULL );
|
||||
if ( pEntity == NULL )
|
||||
{
|
||||
Msg("Failed to initialize templated entity with mapdata: %s\n", pMapData );
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get a matrix that'll convert from world to the new local space
|
||||
VMatrix matNewTemplateToWorld, matStoredLocalToWorld;
|
||||
matNewTemplateToWorld.SetupMatrixOrgAngles( vecOrigin, vecAngles );
|
||||
MatrixMultiply( matNewTemplateToWorld, m_hTemplates[iTemplate].matEntityToTemplate, matStoredLocalToWorld );
|
||||
|
||||
// Get the world origin & angles from the stored local coordinates
|
||||
Vector vecNewOrigin;
|
||||
QAngle vecNewAngles;
|
||||
vecNewOrigin = matStoredLocalToWorld.GetTranslation();
|
||||
MatrixToAngles( matStoredLocalToWorld, vecNewAngles );
|
||||
|
||||
// Set its origin & angles
|
||||
pEntity->SetAbsOrigin( vecNewOrigin );
|
||||
pEntity->SetAbsAngles( vecNewAngles );
|
||||
|
||||
// Spawn it
|
||||
DispatchSpawn( pEntity );
|
||||
|
||||
if (pOutEntity)
|
||||
{
|
||||
*pOutEntity = pEntity;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
// Input : &inputdata -
|
||||
@@ -429,55 +504,10 @@ void CPointTemplate::InputForceSpawn( inputdata_t &inputdata )
|
||||
//-----------------------------------------------------------------------------
|
||||
void CPointTemplate::InputForceSpawnRandomTemplate( inputdata_t &inputdata )
|
||||
{
|
||||
// Spawn our template
|
||||
CBaseEntity *pEntity = NULL;
|
||||
char *pMapData;
|
||||
|
||||
// Index for our m_hTemplates
|
||||
int iIndex = RandomInt(0, GetNumTemplates() - 1);
|
||||
|
||||
// Index for the template itself in the global template list
|
||||
int iTemplateIndex = m_hTemplates[iIndex].iTemplateIndex;
|
||||
|
||||
// Some templates have Entity I/O connecting the entities within the template.
|
||||
// Unique versions of these templates need to be created whenever they're instanced.
|
||||
if ( AllowNameFixup() && Templates_IndexRequiresEntityIOFixup( iTemplateIndex ) )
|
||||
{
|
||||
// This template requires instancing.
|
||||
// Create a new mapdata block and ask the template system to fill it in with
|
||||
// a unique version (with fixed Entity I/O connections).
|
||||
pMapData = Templates_GetEntityIOFixedMapData( iTemplateIndex );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use the unmodified mapdata
|
||||
pMapData = (char*)STRING( Templates_FindByIndex( iTemplateIndex ) );
|
||||
}
|
||||
|
||||
// Create the entity from the mapdata
|
||||
MapEntity_ParseEntity( pEntity, pMapData, NULL );
|
||||
if ( pEntity == NULL )
|
||||
{
|
||||
Msg("Failed to initialize templated entity with mapdata: %s\n", pMapData );
|
||||
if ( !CreateSpecificInstance( RandomInt(0, GetNumTemplates() - 1), GetAbsOrigin(), GetAbsAngles(), &pEntity ) )
|
||||
return;
|
||||
}
|
||||
|
||||
// Get a matrix that'll convert from world to the new local space
|
||||
VMatrix matNewTemplateToWorld, matStoredLocalToWorld;
|
||||
matNewTemplateToWorld.SetupMatrixOrgAngles( GetAbsOrigin(), GetAbsAngles() );
|
||||
MatrixMultiply( matNewTemplateToWorld, m_hTemplates[iIndex].matEntityToTemplate, matStoredLocalToWorld );
|
||||
|
||||
// Get the world origin & angles from the stored local coordinates
|
||||
Vector vecNewOrigin;
|
||||
QAngle vecNewAngles;
|
||||
vecNewOrigin = matStoredLocalToWorld.GetTranslation();
|
||||
MatrixToAngles( matStoredLocalToWorld, vecNewAngles );
|
||||
|
||||
// Set its origin & angles
|
||||
pEntity->SetAbsOrigin( vecNewOrigin );
|
||||
pEntity->SetAbsAngles( vecNewAngles );
|
||||
|
||||
// Spawn it
|
||||
DispatchSpawn(pEntity);
|
||||
|
||||
// Fire our output
|
||||
m_pOutputOnSpawned.FireOutput( this, this );
|
||||
|
||||
Reference in New Issue
Block a user