From 2a4bb8e631ea60a3247c817328155a876f3c911a Mon Sep 17 00:00:00 2001 From: fisted Date: Fri, 7 Jan 2011 23:26:28 +0100 Subject: [PATCH] fixed /emote reset --- src/game/server/ddracecommands.cpp | 14 +++++++------- src/game/server/entities/character.cpp | 11 ++++++++++- src/game/server/entities/character.h | 3 +++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/game/server/ddracecommands.cpp b/src/game/server/ddracecommands.cpp index b389e0394..e81cc3ddd 100644 --- a/src/game/server/ddracecommands.cpp +++ b/src/game/server/ddracecommands.cpp @@ -892,17 +892,17 @@ void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData, int if (pChr) { if (!str_comp(pResult->GetString(0), "angry")) - pChr->m_EmoteType = EMOTE_ANGRY; + pChr->m_DefEmote = EMOTE_ANGRY; else if (!str_comp(pResult->GetString(0), "blink")) - pChr->m_EmoteType = EMOTE_BLINK; + pChr->m_DefEmote = EMOTE_BLINK; else if (!str_comp(pResult->GetString(0), "close")) - pChr->m_EmoteType = EMOTE_BLINK; + pChr->m_DefEmote = EMOTE_BLINK; else if (!str_comp(pResult->GetString(0), "happy")) - pChr->m_EmoteType = EMOTE_HAPPY; + pChr->m_DefEmote = EMOTE_HAPPY; else if (!str_comp(pResult->GetString(0), "pain")) - pChr->m_EmoteType = EMOTE_PAIN; + pChr->m_DefEmote = EMOTE_PAIN; else if (!str_comp(pResult->GetString(0), "surprise")) - pChr->m_EmoteType = EMOTE_SURPRISE; + pChr->m_DefEmote = EMOTE_SURPRISE; else { pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Unkown emote... Say /emote"); @@ -912,7 +912,7 @@ void CGameContext::ConEyeEmote(IConsole::IResult *pResult, void *pUserData, int if (pResult->NumArguments() > 1) Duration = pResult->GetInteger(1); - pChr->m_EmoteStop = pSelf->Server()->Tick() + Duration * pSelf->Server()->TickSpeed(); + pChr->m_DefEmoteReset = pSelf->Server()->Tick() + Duration * pSelf->Server()->TickSpeed(); } } } diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 7c20f49b9..b78c57057 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -99,6 +99,8 @@ bool CCharacter::Spawn(CPlayer *pPlayer, vec2 Pos) Controller->m_Teams.SendTeamsState(GetPlayer()->GetCID()); } + m_DefEmote = EMOTE_NORMAL; + m_DefEmoteReset = -1; return true; } @@ -766,6 +768,13 @@ void CCharacter::Tick() m_Core.Tick(true); m_Core.m_Id = GetPlayer()->GetCID(); + if (m_DefEmoteReset >= 0 && m_DefEmoteReset <= Server()->Tick()) + { + m_DefEmoteReset = -1; + m_EmoteType = m_DefEmote = EMOTE_NORMAL; + m_EmoteStop = -1; + } + m_DoSplash = false; if (g_Config.m_SvEndlessDrag) m_Core.m_HookTick = 0; @@ -1552,7 +1561,7 @@ void CCharacter::Snap(int SnappingClient) // set emote if (m_EmoteStop < Server()->Tick()) { - m_EmoteType = EMOTE_NORMAL; + m_EmoteType = m_DefEmote; m_EmoteStop = -1; } diff --git a/src/game/server/entities/character.h b/src/game/server/entities/character.h index a7dd67e36..c1dc67d49 100644 --- a/src/game/server/entities/character.h +++ b/src/game/server/entities/character.h @@ -145,6 +145,9 @@ public: int m_EmoteType; int m_EmoteStop; + int m_DefEmote; //used to override the default emote through /emote + int m_DefEmoteReset; //tick when it gets reset + // last tick that the player took any action ie some input int m_LastAction;