Skip to content

Commit 59aced3

Browse files
authored
Merge pull request #993 from Kitsune44/weapons
Features: Weapons and Aliens: Revised explosion and blood decals.
2 parents fcf3b66 + 66589f2 commit 59aced3

File tree

8 files changed

+59
-43
lines changed

8 files changed

+59
-43
lines changed

src/game/server/swarm/asw_barrel_explosive.cpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,15 +136,19 @@ void CASW_Barrel_Explosive::ExplodeNow( const CTakeDamageInfo &info )
136136

137137
void CASW_Barrel_Explosive::DoExplosion()
138138
{
139-
// scorch the ground
140-
trace_t tr;
141-
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -80 ), MASK_SHOT,
142-
this, COLLISION_GROUP_NONE, &tr);
143-
144-
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
139+
// scorch decals
140+
Vector vecForward = GetAbsVelocity();
141+
float flTraceDist = 80.0f;
142+
if ( vecForward.LengthSqr() < 0.001f )
143+
vecForward = Vector( 0, 0, -1 );
144+
VectorNormalize( vecForward );
145+
trace_t tr;
146+
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + flTraceDist * vecForward, MASK_SHOT_HULL | CONTENTS_TRANSLUCENT, this, COLLISION_GROUP_NONE, &tr );
147+
148+
if ( ( tr.m_pEnt != GetWorldEntity() ) || ( tr.hitbox != 0 ) )
145149
{
146150
// non-world needs smaller decals
147-
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
151+
if ( tr.m_pEnt )
148152
{
149153
UTIL_DecalTrace( &tr, "SmallScorch" );
150154
}

src/game/server/swarm/asw_firewall_piece.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ void CASW_Firewall_Piece::Spawn( void )
8686
//pFire->SetAbsVelocity( vec3_origin );
8787

8888
trace_t tr;
89-
UTIL_TraceHull( GetAbsOrigin() + Vector( 0.0f,0.0f, 5.0f), GetAbsOrigin() + Vector( 0.0f, 0.0f, -100.0f ),
90-
Vector( -30.0f, -30.0f, 0.0f ), Vector( 30.0f, 30.0f, 30.0f ), MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &tr );
89+
UTIL_TraceHull( GetAbsOrigin() + Vector( 0.0f,0.0f, 32.0f), GetAbsOrigin() + Vector( 0.0f, 0.0f, -1000.0f ),
90+
Vector( -30.0f, -30.0f, 0.0f ), Vector( 30.0f, 30.0f, 30.0f ), MASK_SHOT_HULL | CONTENTS_PLAYERCLIP | CONTENTS_MONSTERCLIP | CONTENTS_TRANSLUCENT, this, ASW_COLLISION_GROUP_IGNORE_NPCS, &tr );
9191

9292
int nFlags = ( SF_FIRE_START_ON | SF_FIRE_SMOKELESS );
9393

@@ -100,6 +100,11 @@ void CASW_Firewall_Piece::Spawn( void )
100100
if ( pFire )
101101
{
102102
pFire->m_bPlacedByMarine = m_bPlacedByMarine;
103+
104+
// scorch decals
105+
trace_t tr2;
106+
UTIL_TraceLine( tr.endpos + Vector( 0.0f, 0.0f, 32.0f ), tr.endpos + Vector( 0.0f, 0.0f, -60.0f ), MASK_SHOT_HULL | CONTENTS_TRANSLUCENT, this, ASW_COLLISION_GROUP_IGNORE_NPCS, &tr2 );
107+
UTIL_DecalTrace( &tr2, "Scorch" );
103108
}
104109
}
105110

@@ -170,7 +175,7 @@ CASW_Firewall_Piece* CASW_Firewall_Piece::CreateAnotherPiece(bool bRight)
170175
ang.y-=90;
171176
AngleVectors(ang, &offset);
172177
offset *= ASW_FIREWALL_SPACING;
173-
Vector start = GetAbsOrigin() + Vector(0,0,20);
178+
Vector start = GetAbsOrigin() + Vector(0,0,32);
174179
Vector dest = start + offset;
175180
//todo: trace from abs to dest
176181
trace_t tr;
@@ -193,7 +198,7 @@ CASW_Firewall_Piece* CASW_Firewall_Piece::CreateAnotherPiece(bool bRight)
193198
//if (GetOwnerEntity())
194199
//Msg("Creating another firewall piece with owner %s\n", GetOwnerEntity()->GetClassname());
195200
//UTIL_SetOrigin( pFirewall, GetAbsOrigin() + offset );
196-
pFirewall->SetAbsOrigin( dest - Vector(0,0,20) );
201+
pFirewall->SetAbsOrigin( dest - Vector(0,0,32) );
197202
pFirewall->SetDuration(m_fFireDuration);
198203
pFirewall->m_hCreatorWeapon = m_hCreatorWeapon;
199204
pFirewall->m_bPlacedByMarine = m_bPlacedByMarine;

src/game/server/swarm/asw_grenade_cluster.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -258,21 +258,25 @@ CASW_Grenade_Cluster* CASW_Grenade_Cluster::Cluster_Grenade_Create( float flDama
258258

259259
void CASW_Grenade_Cluster::DoExplosion()
260260
{
261-
// scorch the ground
262-
trace_t tr;
263-
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -80 ), MASK_SHOT,
264-
this, COLLISION_GROUP_NONE, &tr);
265-
266-
if (m_bMaster)
261+
// scorch decals
262+
//if (m_bMaster)
267263
{
268-
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
264+
Vector vecForward = GetAbsVelocity();
265+
float flTraceDist = 60.0f;
266+
if ( vecForward.LengthSqr() < 0.001f )
267+
vecForward = Vector( 0, 0, -1 );
268+
VectorNormalize( vecForward );
269+
trace_t tr;
270+
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + flTraceDist * vecForward, MASK_SHOT_HULL | CONTENTS_TRANSLUCENT, this, COLLISION_GROUP_NONE, &tr );
271+
272+
if ( ( tr.m_pEnt != GetWorldEntity() ) || ( tr.hitbox != 0 ) )
269273
{
270274
// non-world needs smaller decals
271-
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
272-
{
273-
UTIL_DecalTrace( &tr, "SmallScorch" );
275+
if ( tr.m_pEnt )
276+
{
277+
UTIL_DecalTrace( &tr, "SmallScorch" );
278+
}
274279
}
275-
}
276280
else
277281
{
278282
UTIL_DecalTrace( &tr, "Scorch" );

src/game/server/swarm/asw_grenade_vindicator.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -257,19 +257,21 @@ void CASW_Grenade_Vindicator::Detonate()
257257
m_flDamage );
258258
*/
259259

260-
Vector vecForward = GetAbsVelocity();
261-
VectorNormalize(vecForward);
262-
trace_t tr;
263-
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + 60*vecForward, MASK_SHOT,
264-
this, COLLISION_GROUP_NONE, &tr);
265-
266-
260+
// scorch decals
267261
if (m_bMaster)
268262
{
269-
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
263+
Vector vecForward = GetAbsVelocity();
264+
float flTraceDist = 60.0f;
265+
if ( vecForward.LengthSqr() < 0.001f )
266+
vecForward = Vector( 0, 0, -1 );
267+
VectorNormalize( vecForward );
268+
trace_t tr;
269+
UTIL_TraceLine( GetAbsOrigin(), GetAbsOrigin() + flTraceDist * vecForward, MASK_SHOT_HULL | CONTENTS_TRANSLUCENT, this, COLLISION_GROUP_NONE, &tr );
270+
271+
if ( ( tr.m_pEnt != GetWorldEntity() ) || ( tr.hitbox != 0 ) )
270272
{
271273
// non-world needs smaller decals
272-
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
274+
if ( tr.m_pEnt )
273275
{
274276
UTIL_DecalTrace( &tr, "SmallScorch" );
275277
}
@@ -278,7 +280,7 @@ void CASW_Grenade_Vindicator::Detonate()
278280
{
279281
UTIL_DecalTrace( &tr, "Scorch" );
280282
}
281-
283+
UTIL_DecalTrace( &tr, "Scorch" );
282284
UTIL_ASW_ScreenShake( GetAbsOrigin(), 10.0, 150.0, 1.0, 750, SHAKE_START );
283285
}
284286

src/game/server/swarm/asw_laser_mine.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,18 +233,14 @@ void CASW_Laser_Mine::SpawnFlipThink()
233233

234234
void CASW_Laser_Mine::Explode( bool bRemove )
235235
{
236-
// scorch the ground
237-
trace_t tr;
238-
UTIL_TraceLine ( GetAbsOrigin(), GetAbsOrigin() + Vector( 0, 0, -80 ), MASK_SHOT,
239-
this, COLLISION_GROUP_NONE, &tr);
236+
// scorch decal
237+
trace_t tr;
238+
UTIL_TraceLine( GetAbsOrigin() + m_vecSurfaceNormal * 32.0f, GetAbsOrigin() - m_vecSurfaceNormal * 80.0f, MASK_SHOT_HULL | CONTENTS_TRANSLUCENT, this, COLLISION_GROUP_NONE, &tr );
240239

241-
if ((tr.m_pEnt != GetWorldEntity()) || (tr.hitbox != 0))
240+
if ( ( tr.m_pEnt != GetWorldEntity() ) || ( tr.hitbox != 0 ) )
242241
{
243-
// non-world needs smaller decals
244-
if( tr.m_pEnt && !tr.m_pEnt->IsNPC() )
245-
{
242+
if ( tr.m_pEnt )
246243
UTIL_DecalTrace( &tr, "SmallScorch" );
247-
}
248244
}
249245
else
250246
{
@@ -284,7 +280,9 @@ CASW_Laser_Mine* CASW_Laser_Mine::ASW_Laser_Mine_Create( const Vector &position,
284280
{
285281
CASW_Laser_Mine *pMine = (CASW_Laser_Mine*)CreateEntityByName( "asw_laser_mine" );
286282
pMine->SetLaserAngle( angLaserAim );
287-
283+
284+
AngleVectors( angles, nullptr, nullptr, &pMine->m_vecSurfaceNormal );
285+
288286
matrix3x4_t wallMatrix;
289287
AngleMatrix( angles, wallMatrix );
290288

src/game/server/swarm/asw_laser_mine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class CASW_Laser_Mine : public CBaseCombatCharacter, public IEntityListener, pub
5050
bool m_bIsSpawnLanded;
5151
float m_flSpawnFlipStartTime;
5252
float m_flSpawnFlipEndTime;
53+
Vector m_vecSurfaceNormal;
5354
Vector m_vecSpawnFlipStartPos;
5455
Vector m_vecSpawnFlipEndPos;
5556
QAngle m_angSpawnFlipEndAngle;

src/game/shared/swarm/asw_alien_shared.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ void CASW_Alien::DoBloodDecal( float flDamage, const Vector &vecPos, const Vecto
158158
vecTraceDir.z += random->RandomFloat( -flNoise, flNoise );
159159

160160
// Don't bleed on grates.
161-
UTIL_TraceLine( vecPos, vecPos + vecTraceDir * -flTraceDist, MASK_SOLID_BRUSHONLY & ~CONTENTS_GRATE, this, COLLISION_GROUP_NONE, &Bloodtr);
161+
UTIL_TraceLine( vecPos, vecPos + vecTraceDir * -flTraceDist, MASK_SHOT_HULL | CONTENTS_TRANSLUCENT, this, COLLISION_GROUP_NONE, &Bloodtr);
162162

163163
if ( Bloodtr.fraction != 1.0 )
164164
{

src/game/shared/swarm/asw_weapon_laser_mines.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ void CASW_Weapon_Laser_Mines::DelayedAttack( void )
198198
RotationDelta( angFacing, angLaser, &angLaserOffset );
199199

200200
CASW_Laser_Mine *pMine = CASW_Laser_Mine::ASW_Laser_Mine_Create( tr.endpos, angFacing, angLaserOffset, pMarine, pParent, true, this );
201+
pMine->m_vecSurfaceNormal = tr.plane.normal;
202+
201203
IGameEvent * event = gameeventmanager->CreateEvent( "laser_mine_placed" );
202204
if ( event )
203205
{

0 commit comments

Comments
 (0)