made the dropped flag sign blink faster the last 5 seconds to indicate that it's about to return. Closes #631

This commit is contained in:
oy 2011-07-05 23:15:24 +02:00
parent ab1f7d6f95
commit ac9c3b8f7f
3 changed files with 20 additions and 1 deletions

View file

@ -108,7 +108,9 @@ void CHud::RenderScoreHud()
if(GameFlags&GAMEFLAG_FLAGS)
{
if(FlagCarrier[t] == FLAG_ATSTAND || (FlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick()/10)&1)))
int BlinkTimer = (m_pClient->m_FlagDropTick[t] != 0 &&
(Client()->GameTick()-m_pClient->m_FlagDropTick[t])/Client()->GameTickSpeed() >= 25) ? 10 : 20;
if(FlagCarrier[t] == FLAG_ATSTAND || (FlagCarrier[t] == FLAG_TAKEN && ((Client()->GameTick()/BlinkTimer)&1)))
{
// draw flag
Graphics()->BlendNormal();

View file

@ -341,6 +341,8 @@ void CGameClient::OnReset()
m_All.m_paComponents[i]->OnReset();
m_DemoSpecID = SPEC_FREEVIEW;
m_FlagDropTick[TEAM_RED] = 0;
m_FlagDropTick[TEAM_BLUE] = 0;
}
@ -783,6 +785,20 @@ void CGameClient::OnNewSnapshot()
{
m_Snap.m_pGameDataObj = (const CNetObj_GameData *)pData;
m_Snap.m_GameDataSnapID = Item.m_ID;
if(m_Snap.m_pGameDataObj->m_FlagCarrierRed == FLAG_TAKEN)
{
if(m_FlagDropTick[TEAM_RED] == 0)
m_FlagDropTick[TEAM_RED] = Client()->GameTick();
}
else if(m_FlagDropTick[TEAM_RED] != 0)
m_FlagDropTick[TEAM_RED] = 0;
if(m_Snap.m_pGameDataObj->m_FlagCarrierBlue == FLAG_TAKEN)
{
if(m_FlagDropTick[TEAM_BLUE] == 0)
m_FlagDropTick[TEAM_BLUE] = Client()->GameTick();
}
else if(m_FlagDropTick[TEAM_BLUE] != 0)
m_FlagDropTick[TEAM_BLUE] = 0;
}
else if(Item.m_Type == NETOBJTYPE_FLAG)
m_Snap.m_paFlags[Item.m_ID%2] = (const CNetObj_Flag *)pData;

View file

@ -89,6 +89,7 @@ public:
bool m_SuppressEvents;
bool m_NewTick;
bool m_NewPredictedTick;
int m_FlagDropTick[2];
// TODO: move this
CTuningParams m_Tuning;