parent
0acf4d98eb
commit
e4fc6cb27d
3 changed files with 68 additions and 2 deletions
|
@ -1383,6 +1383,17 @@ enum EGON_FIREMODE { FIRE_NARROW, FIRE_WIDE};
|
|||
|
||||
BEAM *pBeam;
|
||||
BEAM *pBeam2;
|
||||
TEMPENTITY* pFlare; // Vit_amiN: egon's beam flare
|
||||
|
||||
void EV_EgonFlareCallback(struct tempent_s* ent, float frametime, float currenttime)
|
||||
{
|
||||
float delta = currenttime - ent->tentOffset.z; // time past since the last scale
|
||||
if (delta >= ent->tentOffset.y)
|
||||
{
|
||||
ent->entity.curstate.scale += ent->tentOffset.x * delta;
|
||||
ent->tentOffset.z = currenttime;
|
||||
}
|
||||
}
|
||||
|
||||
void EV_EgonFire( event_args_t *args )
|
||||
{
|
||||
|
@ -1421,7 +1432,7 @@ void EV_EgonFire( event_args_t *args )
|
|||
if ( EV_IsLocal( idx ) )
|
||||
gEngfuncs.pEventAPI->EV_WeaponAnimation ( g_fireAnims1[ gEngfuncs.pfnRandomLong( 0, 3 ) ], 1 );
|
||||
|
||||
if ( iStartup == 1 && EV_IsLocal( idx ) && !pBeam && !pBeam2 && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
|
||||
if ( iStartup == 1 && EV_IsLocal( idx ) && !pBeam && !pBeam2 && !pFlare && cl_lw->value ) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
|
||||
{
|
||||
vec3_t vecSrc, vecEnd, origin, angles, forward, right, up;
|
||||
pmtrace_t tr;
|
||||
|
@ -1471,8 +1482,18 @@ void EV_EgonFire( event_args_t *args )
|
|||
pBeam->flags |= ( FBEAM_SINENOISE );
|
||||
|
||||
pBeam2 = gEngfuncs.pEfxAPI->R_BeamEntPoint ( idx | 0x1000, tr.endpos, iBeamModelIndex, 99999, 5.0, 0.08, 0.7, 25, 0, 0, r, g, b );
|
||||
|
||||
// Vit_amiN: egon beam flare
|
||||
pFlare = gEngfuncs.pEfxAPI->R_TempSprite(tr.endpos, vec3_origin, 1.0,
|
||||
gEngfuncs.pEventAPI->EV_FindModelIndex(EGON_FLARE_SPRITE),
|
||||
kRenderGlow, kRenderFxNoDissipation, 1.0, 99999, FTENT_SPRCYCLE | FTENT_PERSIST);
|
||||
}
|
||||
}
|
||||
|
||||
if (pFlare) // Vit_amiN: store the last mode for EV_EgonStop()
|
||||
{
|
||||
pFlare->tentOffset.x = (iFireMode == FIRE_WIDE) ? 1.0f : 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void EV_EgonStop( event_args_t *args )
|
||||
|
@ -1502,6 +1523,26 @@ void EV_EgonStop( event_args_t *args )
|
|||
pBeam2->die = 0.0;
|
||||
pBeam2 = NULL;
|
||||
}
|
||||
|
||||
if (pFlare) // Vit_amiN: egon beam flare
|
||||
{
|
||||
pFlare->die = gEngfuncs.GetClientTime();
|
||||
|
||||
if (gEngfuncs.GetMaxClients() == 1 || !(pFlare->flags & FTENT_NOMODEL))
|
||||
{
|
||||
if (pFlare->tentOffset.x != 0.0f) // true for iFireMode == FIRE_WIDE
|
||||
{
|
||||
pFlare->callback = &EV_EgonFlareCallback;
|
||||
pFlare->fadeSpeed = 2.0; // fade out will take 0.5 sec
|
||||
pFlare->tentOffset.x = 10.0; // scaling speed per second
|
||||
pFlare->tentOffset.y = 0.1; // min time between two scales
|
||||
pFlare->tentOffset.z = pFlare->die; // the last callback run time
|
||||
pFlare->flags = FTENT_FADEOUT | FTENT_CLIENTCUSTOM;
|
||||
}
|
||||
}
|
||||
|
||||
pFlare = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
//======================
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
extern TEMPENTITY* pFlare; // Vit_amiN: egon's energy flare
|
||||
void HUD_GetLastOrg( float *org );
|
||||
|
||||
void UpdateBeams ( void )
|
||||
|
@ -74,6 +75,28 @@ void UpdateBeams ( void )
|
|||
pBeam2->target = tr.endpos;
|
||||
pBeam2->die = gEngfuncs.GetClientTime() + 0.1; // We keep it alive just a little bit forward in the future, just in case.
|
||||
}
|
||||
|
||||
if (pFlare) // Vit_amiN: beam flare
|
||||
{
|
||||
pFlare->entity.origin = tr.endpos;
|
||||
pFlare->die = gEngfuncs.GetClientTime() + 0.1f; // We keep it alive just a little bit forward in the future, just in case.
|
||||
|
||||
if (gEngfuncs.GetMaxClients() != 1) // Singleplayer always draws the egon's energy beam flare
|
||||
{
|
||||
pFlare->flags |= FTENT_NOMODEL;
|
||||
|
||||
if (!(tr.allsolid || tr.ent <= 0 || tr.fraction == 1.0f)) // Beam hit some non-world entity
|
||||
{
|
||||
physent_t* pEntity = gEngfuncs.pEventAPI->EV_GetPhysent(tr.ent);
|
||||
|
||||
// Not the world, let's assume that we hit something organic ( dog, cat, uncle joe, etc )
|
||||
if (pEntity && !(pEntity->solid == SOLID_BSP || pEntity->movetype == MOVETYPE_PUSHSTEP))
|
||||
{
|
||||
pFlare->flags &= ~FTENT_NOMODEL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -85,6 +108,6 @@ Add game specific, client-side objects here
|
|||
*/
|
||||
void Game_AddObjects( void )
|
||||
{
|
||||
if ( pBeam && pBeam2 )
|
||||
if ( pBeam || pBeam2 || pFlare)
|
||||
UpdateBeams();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ extern IParticleMan *g_pParticleMan;
|
|||
#if !defined( _TFC )
|
||||
extern BEAM *pBeam;
|
||||
extern BEAM *pBeam2;
|
||||
extern TEMPENTITY* pFlare; // Vit_amiN
|
||||
#endif
|
||||
|
||||
#if defined( _TFC )
|
||||
|
@ -92,6 +93,7 @@ void CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
|
|||
#if !defined( _TFC )
|
||||
//Probably not a good place to put this.
|
||||
pBeam = pBeam2 = NULL;
|
||||
pFlare = NULL; // Vit_amiN: clear egon's beam flare
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue