Skip to content

Commit

Permalink
properly fixed disappearing line effects if effect starts behind camera
Browse files Browse the repository at this point in the history
  • Loading branch information
entdark committed Aug 10, 2020
1 parent 25ade6c commit 4dcef10
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
1 change: 0 additions & 1 deletion codemp/cgame/cg_ents.c
Original file line number Diff line number Diff line change
Expand Up @@ -1799,7 +1799,6 @@ Ghoul2 Insert End
beamID = cgs.effects.tripmineLaserFX;

VectorCopy(cent->currentState.pos.trDelta, beamDirection);
CG_StartBehindCamera(beamOrg, NULL, cg.refdef.vieworg, cg.refdef.viewaxis, beamDirection);

if ((cg.playerPredicted && cg.snap->ps.fd.forcePowersActive & (1 << FP_SEE))
|| (!cg.playerPredicted && cg.playerCent && (cg.playerCent->currentState.forcePowersActive & (1 << FP_SEE)))) {
Expand Down
8 changes: 2 additions & 6 deletions codemp/cgame/cg_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -2631,10 +2631,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
CG_RailSpiral(&cgs.clientinfo[cent->currentState.eventParm], start, end);
else if ( (cg_newFX.integer & NEWFX_RUPTOR) )
CG_RailTrail(&cgs.clientinfo[cent->currentState.eventParm], start, end);
else {
CG_StartBehindCamera(start, end, cg.refdef.vieworg, cg.refdef.viewaxis, NULL);
else
FX_DisruptorMainShot(start, end);
}
}
break;

Expand Down Expand Up @@ -2664,10 +2662,8 @@ void CG_EntityEvent( centity_t *cent, vec3_t position ) {
CG_RailSpiral(&cgs.clientinfo[cent->currentState.eventParm], start, end);
else if ( (cg_newFX.integer & NEWFX_RUPTOR) )
CG_RailTrail(&cgs.clientinfo[cent->currentState.eventParm], start, end);
else {
CG_StartBehindCamera(start, end, cg.refdef.vieworg, cg.refdef.viewaxis, NULL);
else
FX_DisruptorAltShot(start, end, cent->currentState.shouldtarget);
}
}
break;

Expand Down
24 changes: 24 additions & 0 deletions codemp/client/FxPrimitives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,30 @@ CLine::CLine(void)
mRefEnt.reType = RT_LINE;
}

//----------------------------
bool CLine::Cull( void )
{
vec3_t dir;

VectorSubtract( mOrigin1, theFxHelper.refdef->vieworg, dir );

//Check if it's in front of the viewer
if ( (DotProduct( theFxHelper.refdef->viewaxis[0], dir )) >= 0 )
{
return false; //don't cull
}

VectorSubtract( mOrigin2, theFxHelper.refdef->vieworg, dir );

//Check if it's in front of the viewer
if ( (DotProduct( theFxHelper.refdef->viewaxis[0], dir )) >= 0 )
{
return false;
}

return true; //all points behind viewer
}

//----------------------------
void CLine::Draw(void)
{
Expand Down
2 changes: 1 addition & 1 deletion codemp/client/FxPrimitives.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ class CLine : public CParticle
virtual ~CLine() {}

virtual void Die() {}

virtual bool Update();
virtual bool Cull(void);

inline void SetOrigin2( vec3_t org2 ) { VectorCopy( org2, mOrigin2 ); }
};
Expand Down

0 comments on commit 4dcef10

Please sign in to comment.