From 2f66ba012630b58494a1013df35438e855e189ff Mon Sep 17 00:00:00 2001 From: Alug Date: Wed, 29 Jan 2025 19:05:42 +0100 Subject: [PATCH] inline V_LocalTransFlag its very smol --- src/v_video.c | 14 ++++---------- src/v_video.h | 9 +++++++-- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/v_video.c b/src/v_video.c index f549c9f85..d42043b7b 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -589,28 +589,22 @@ static UINT8 hudplusalpha[11] = { 10, 8, 6, 4, 2, 0, 0, 0, 0, 0, 0}; static UINT8 hudminusalpha[11] = { 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5}; UINT8 hudtrans = 0; -// this is pretty dumb, but has to be done like this, otherwise the fps counter just disappears sometimes for no reason lol -INT32 V_LocalTransFlag(void) -{ - return ((10-cv_translucenthud.value)*V_10TRANS); -} - static const UINT8 *v_colormap = NULL; static const UINT8 *v_translevel = NULL; -static inline UINT8 standardpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) +FUNCINLINE static ATTRINLINE UINT8 standardpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) { (void)dest; return source[ofs>>FRACBITS]; } -static inline UINT8 mappedpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) +FUNCINLINE static ATTRINLINE UINT8 mappedpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) { (void)dest; return *(v_colormap + source[ofs>>FRACBITS]); } -static inline UINT8 translucentpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) +FUNCINLINE static ATTRINLINE UINT8 translucentpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) { return *(v_translevel + ((source[ofs>>FRACBITS]<<8)&0xff00) + (*dest&0xff)); } -static inline UINT8 transmappedpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) +FUNCINLINE static ATTRINLINE UINT8 transmappedpdraw(const UINT8 *dest, const UINT8 *source, fixed_t ofs) { return *(v_translevel + (((*(v_colormap + source[ofs>>FRACBITS]))<<8)&0xff00) + (*dest&0xff)); } diff --git a/src/v_video.h b/src/v_video.h index 36aa9f908..1a9497de1 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -17,6 +17,7 @@ #include "doomdef.h" #include "doomtype.h" #include "r_defs.h" +#include "r_main.h" // // VIDEO @@ -64,8 +65,6 @@ extern RGBA_t *pLocalPalette; extern UINT8 hudtrans; -extern INT32 V_LocalTransFlag(void); - void V_CubeApply(UINT8 *red, UINT8 *green, UINT8 *blue); // Retrieve the ARGB value from a palette color index @@ -256,6 +255,12 @@ char V_GetSkincolorChar(INT32 color); INT32 V_SkinColorToHighlightcolor(skincolors_t color); +// this is pretty dumb, but has to be done like this, otherwise the fps counter just disappears sometimes for no reason lol +FUNCINLINE static ATTRINLINE INT32 V_LocalTransFlag(void) +{ + return ((10-cv_translucenthud.value)*V_10TRANS); +} + typedef struct player_s player_t; void V_DoPostProcessor(INT32 view, INT32 param);