Skip to content

Commit

Permalink
Try to fix some Shephard effect crashes/bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedSnark committed Mar 30, 2024
1 parent 2791d2a commit cf0651f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
2 changes: 1 addition & 1 deletion GSChaos/CChaos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ void CChaos::OnFrame(double time)

bPaused = CLWrapper::GetPausedState();

if (bPaused || !m_bInGame)
if (bPaused || !m_bInGame || sv->state != ss_active)
{
if (!m_bPaused)
{
Expand Down
24 changes: 5 additions & 19 deletions GSChaos/CFeatureExtremeGrieferShephard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void CFeatureExtremeGrieferShephard::OnFrame(double time)

void CFeatureExtremeGrieferShephard::Spawn()
{
if (m_pShephard)
if (m_pShephard && !stricmp(STRING(m_pShephard->v.classname), "chaos_exgriefer"))
{
g_engfuncs->pfnRemoveEntity(m_pShephard);
if (m_pShephard->pvPrivateData != NULL)
Expand Down Expand Up @@ -173,23 +173,9 @@ void CFeatureExtremeGrieferShephard::Restore()
if (!m_bSpawned)
return;

edict_t* e;
for (int i = 1; i < sv->num_edicts; i++)
{
e = ORIG_EDICT_NUM(i);
if (!e)
continue;

if (!stricmp(STRING(e->v.classname), "chaos_exgriefer"))
{
g_engfuncs->pfnRemoveEntity(e);
if (e->pvPrivateData != NULL)
{
FREE_PRIVATE(e);
}
}
}
if (!m_pShephard || stricmp(STRING(m_pShephard->v.classname), "chaos_exgriefer"))
Spawn();

Spawn();
m_pShephard->v.origin = m_shephardLatestOrigin;
if (!stricmp(STRING(m_pShephard->v.classname), "chaos_exgriefer"))
m_pShephard->v.origin = m_shephardLatestOrigin;
}
2 changes: 1 addition & 1 deletion GSChaos/CFeatureGrieferShephard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void CFeatureGrieferShephard::OnFrame(double time)

void CFeatureGrieferShephard::Spawn()
{
if (m_pShephard)
if (m_pShephard && strstr(STRING(m_pShephard->v.classname), "generic"))
{
g_engfuncs->pfnRemoveEntity(m_pShephard);
if (m_pShephard->pvPrivateData != NULL)
Expand Down

0 comments on commit cf0651f

Please sign in to comment.