[HL25] Backport Gluon gun's flare sprite fix

This commit reverts e4fc6cb27d

Something worth mentioning: the flare sprite seems to be broken in
multiplayer both with the mentioned reverted commit and HL25's fix.
This commit is contained in:
Joël Troch 2024-08-28 13:57:02 +02:00
parent 8c5d4abd96
commit ec569d4bf3
4 changed files with 5 additions and 69 deletions

View file

@ -1301,17 +1301,6 @@ int g_fireAnims2[] = {EGON_ALTFIRECYCLE};
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)
{
@ -1349,7 +1338,7 @@ void EV_EgonFire(event_args_t* args)
if (EV_IsLocal(idx))
gEngfuncs.pEventAPI->EV_WeaponAnimation(g_fireAnims1[gEngfuncs.pfnRandomLong(0, 3)], 0);
if (iStartup && EV_IsLocal(idx) && !pBeam && !pBeam2 && !pFlare && 0 != cl_lw->value) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
if (iStartup && EV_IsLocal(idx) && !pBeam && !pBeam2 && 0 != cl_lw->value) //Adrian: Added the cl_lw check for those lital people that hate weapon prediction.
{
Vector vecSrc, vecEnd, angles, forward, right, up;
pmtrace_t tr;
@ -1399,18 +1388,8 @@ 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)
@ -1444,26 +1423,6 @@ void EV_EgonStop(event_args_t* args)
pBeam2 = NULL;
}
if (pFlare) // Vit_amiN: egon beam flare
{
pFlare->die = gEngfuncs.GetClientTime();
if (gEngfuncs.GetMaxClients() == 1 || (pFlare->flags & FTENT_NOMODEL) == 0)
{
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;
}
// HACK: only reset animation if the Egon is still equipped.
if (g_CurrentWeaponId == WEAPON_EGON)
{

View file

@ -28,7 +28,6 @@
extern BEAM* pBeam;
extern BEAM* pBeam2;
extern TEMPENTITY* pFlare; // Vit_amiN: egon's energy flare
void HUD_GetLastOrg(float* org);
void UpdateBeams()
@ -75,28 +74,6 @@ void UpdateBeams()
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 (!(0 != 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;
}
}
}
}
}
/*
@ -108,6 +85,6 @@ Add game specific, client-side objects here
*/
void Game_AddObjects()
{
if (pBeam || pBeam2 || pFlare)
if (pBeam || pBeam2)
UpdateBeams();
}

View file

@ -26,7 +26,6 @@ extern IParticleMan* g_pParticleMan;
extern BEAM* pBeam;
extern BEAM* pBeam2;
extern TEMPENTITY* pFlare; // Vit_amiN
/// USER-DEFINED SERVER MESSAGE HANDLERS
@ -83,7 +82,6 @@ void CHud::MsgFunc_InitHUD(const char* pszName, int iSize, void* pbuf)
//Probably not a good place to put this.
pBeam = pBeam2 = NULL;
pFlare = NULL; // Vit_amiN: clear egon's beam flare
}

View file

@ -407,7 +407,9 @@ void CEgon::CreateEffect()
m_pSprite->pev->scale = 1.0;
m_pSprite->SetTransparency(kRenderGlow, 255, 255, 255, 255, kRenderFxNoDissipation);
m_pSprite->pev->spawnflags |= SF_SPRITE_TEMPORARY;
m_pSprite->pev->flags |= FL_SKIPLOCALHOST;
// Josh: This sprite is not predicted on the client, so was missing
// for many years after it got broken in an update.
// m_pSprite->pev->flags |= FL_SKIPLOCALHOST;
m_pSprite->pev->owner = m_pPlayer->edict();
if (m_fireMode == FIRE_WIDE)