BossHP: Add wrapper into OnGameFrame.
Simply to prevent error spam, since errors halt function. Meaning boolean wouldn't reset.
This commit is contained in:
parent
7428d9c68b
commit
1d7a6973a1
@ -902,85 +902,93 @@ public void OnGameFrame()
|
|||||||
if(!g_aBoss)
|
if(!g_aBoss)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
static bool s_bRunningBossFrame = false;
|
||||||
static bool s_bLastHudPrinted = false;
|
static bool s_bLastHudPrinted = false;
|
||||||
g_sHUDText[0] = 0;
|
g_sHUDText[0] = 0;
|
||||||
|
|
||||||
for(int i = 0; i < g_aBoss.Length; i++)
|
if (!s_bRunningBossFrame)
|
||||||
{
|
{
|
||||||
CBoss Boss = g_aBoss.Get(i);
|
s_bRunningBossFrame = true;
|
||||||
|
|
||||||
if(Boss.fKillAt && Boss.fKillAt < GetGameTime())
|
for(int i = 0; i < g_aBoss.Length; i++)
|
||||||
{ // Delete Boss
|
|
||||||
LogDebugMessage("Deleting boss %d (KillAt)", i);
|
|
||||||
|
|
||||||
Call_StartForward(g_hFwd_OnBossKilled);
|
|
||||||
Call_PushCell(Boss);
|
|
||||||
Call_PushCell(Boss.dConfig);
|
|
||||||
Call_PushCell(1);
|
|
||||||
Call_Finish();
|
|
||||||
|
|
||||||
delete Boss;
|
|
||||||
g_aBoss.Erase(i);
|
|
||||||
i--;
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!Boss.bActive)
|
|
||||||
{
|
{
|
||||||
if(Boss.fWaitUntil)
|
CBoss Boss = g_aBoss.Get(i);
|
||||||
{
|
|
||||||
if(Boss.fWaitUntil > GetGameTime())
|
if(Boss.fKillAt && Boss.fKillAt < GetGameTime())
|
||||||
continue;
|
{ // Delete Boss
|
||||||
Boss.fWaitUntil = 0.0;
|
LogDebugMessage("Deleting boss %d (KillAt)", i);
|
||||||
}
|
|
||||||
|
Call_StartForward(g_hFwd_OnBossKilled);
|
||||||
|
Call_PushCell(Boss);
|
||||||
|
Call_PushCell(Boss.dConfig);
|
||||||
|
Call_PushCell(1);
|
||||||
|
Call_Finish();
|
||||||
|
|
||||||
|
delete Boss;
|
||||||
|
g_aBoss.Erase(i);
|
||||||
|
i--;
|
||||||
|
|
||||||
if(!BossInit(Boss))
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
if(!BossProcess(Boss))
|
|
||||||
{ // Delete Boss
|
|
||||||
LogDebugMessage("Deleting boss %d (dead)", i);
|
|
||||||
|
|
||||||
Call_StartForward(g_hFwd_OnBossKilled);
|
|
||||||
Call_PushCell(Boss);
|
|
||||||
Call_PushCell(Boss.dConfig);
|
|
||||||
Call_PushCell(2);
|
|
||||||
Call_Finish();
|
|
||||||
|
|
||||||
delete Boss;
|
|
||||||
g_aBoss.Erase(i);
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!IsVoteInProgress())
|
|
||||||
{
|
|
||||||
if(g_sHUDText[0])
|
|
||||||
{
|
|
||||||
for(int client = 1; client <= MaxClients; client++)
|
|
||||||
{
|
|
||||||
if(IsClientInGame(client))
|
|
||||||
{
|
|
||||||
PrintHintText(client, g_sHUDText);
|
|
||||||
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
s_bLastHudPrinted = true;
|
|
||||||
}
|
if(!Boss.bActive)
|
||||||
else if(s_bLastHudPrinted)
|
|
||||||
{
|
|
||||||
for(int client = 1; client <= MaxClients; client++)
|
|
||||||
{
|
{
|
||||||
if(IsClientInGame(client))
|
if(Boss.fWaitUntil)
|
||||||
{
|
{
|
||||||
PrintHintText(client, "");
|
if(Boss.fWaitUntil > GetGameTime())
|
||||||
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
continue;
|
||||||
|
Boss.fWaitUntil = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!BossInit(Boss))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!BossProcess(Boss))
|
||||||
|
{ // Delete Boss
|
||||||
|
LogDebugMessage("Deleting boss %d (dead)", i);
|
||||||
|
|
||||||
|
Call_StartForward(g_hFwd_OnBossKilled);
|
||||||
|
Call_PushCell(Boss);
|
||||||
|
Call_PushCell(Boss.dConfig);
|
||||||
|
Call_PushCell(2);
|
||||||
|
Call_Finish();
|
||||||
|
|
||||||
|
delete Boss;
|
||||||
|
g_aBoss.Erase(i);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
s_bLastHudPrinted = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!IsVoteInProgress())
|
||||||
|
{
|
||||||
|
if(g_sHUDText[0])
|
||||||
|
{
|
||||||
|
for(int client = 1; client <= MaxClients; client++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(client))
|
||||||
|
{
|
||||||
|
PrintHintText(client, g_sHUDText);
|
||||||
|
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s_bLastHudPrinted = true;
|
||||||
|
}
|
||||||
|
else if(s_bLastHudPrinted)
|
||||||
|
{
|
||||||
|
for(int client = 1; client <= MaxClients; client++)
|
||||||
|
{
|
||||||
|
if(IsClientInGame(client))
|
||||||
|
{
|
||||||
|
PrintHintText(client, "");
|
||||||
|
StopSound(client, SNDCHAN_STATIC, "UI/hint.wav");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s_bLastHudPrinted = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
s_bRunningBossFrame = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user