From dc40befa884546afce0f4f92f6aabc95d46427bb Mon Sep 17 00:00:00 2001 From: Indev Date: Thu, 27 Nov 2025 18:48:32 +0300 Subject: [PATCH] Use I_GetTime for animated emotes, so anim argument in M_DrawEmote is not needed --- src/console.c | 4 ++-- src/hu_stuff.c | 13 +++++-------- src/m_emotes.cpp | 5 +++-- src/m_emotes.h | 7 +++---- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/console.c b/src/console.c index e9f4c80ff..d3c2623f4 100644 --- a/src/console.c +++ b/src/console.c @@ -1461,7 +1461,7 @@ static void CON_DrawHudlines(void) if ((emote = M_VerifyEmote((const char *)p, &emotelen))) { - M_DrawScaledEmote(x<= chat_topy) && (y+dy < (chat_bottomy))) { - HU_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + M_DrawEmote(x+dx+2, y+dy, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT); dx += EMOTEWIDTH - charwidth; } j += emotelen; @@ -1874,7 +1871,7 @@ static void HU_DrawChat(void) if ((emote = M_VerifyEmote(w_chat_buf+i, &emotelen))) { - HU_DrawEmote(chatx + c + 2, y-1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT|t); + M_DrawEmote(chatx + c + 2, y-1, emote, V_SNAPTOBOTTOM|V_SNAPTOLEFT|t); c += EMOTEWIDTH - charwidth; i += emotelen-1; drawwidth = EMOTEWIDTH; @@ -1963,7 +1960,7 @@ static void HU_DrawChat(void) hlflag = V_YELLOWMAP; V_DrawSmallString(chatx + boxw + 4 + EMOTEWIDTH, suggesty - (7*skip), hlflag|V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_ALLOWLOWERCASE, va(":%s:", suggest->name)); - HU_DrawEmote(chatx + boxw + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); + M_DrawEmote(chatx + boxw + 2, suggesty - skip*7, suggest, V_SNAPTOBOTTOM|V_SNAPTOLEFT); ++skip; } @@ -2105,7 +2102,7 @@ static void HU_DrawChat_Old(void) if ((emote = M_VerifyEmote(w_chat_buf+i, &emotelen))) { - HU_DrawScaledEmote((HU_INPUTX + c)<= HU_FONTSTART) //Hurdler: isn't it better like that? diff --git a/src/m_emotes.cpp b/src/m_emotes.cpp index f6ad2db3a..e45dcff58 100644 --- a/src/m_emotes.cpp +++ b/src/m_emotes.cpp @@ -15,6 +15,7 @@ #include #include "m_emotes.h" +#include "i_time.h" // I_GetTime extern "C" { #include "w_wad.h" @@ -248,12 +249,12 @@ emote_t *M_VerifyEmote(const char *name, int *emotelen) return match; } -void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, tic_t anim, INT32 flags) +void M_DrawScaledEmote(fixed_t x, fixed_t y, fixed_t scale, emote_t *emote, INT32 flags) { if (emote->numframes == 0) return; - const char *lumpname = emote->frames[(anim/emote->timeperframe) % emote->numframes]; + const char *lumpname = emote->frames[(I_GetTime()/emote->timeperframe) % emote->numframes]; patch_t *emotepatch = (patch_t*)W_CachePatchName(lumpname, PU_CACHE); const int CHARHEIGHT = 6; diff --git a/src/m_emotes.h b/src/m_emotes.h index efe3d69a2..594e219f8 100644 --- a/src/m_emotes.h +++ b/src/m_emotes.h @@ -49,10 +49,9 @@ emote_t *M_FindEmote(const char *name, int len, int skips); // needs to be skipped to get past emote name emote_t *M_VerifyEmote(const char *name, int *emotelen); -// Draw the emote, anim should be some kind of timer ticking every game tic -// for animated emotes -#define M_DrawEmote(x, y, emote, anim, flags) M_DrawScaledEmote((x)<