Fix v.drawPingNum flickering in any fps higher than 35 #74

Merged
Indev450 merged 3 commits from lua-fix-drawpingnum into Saturn 2023-10-02 15:32:00 +02:00
3 changed files with 43 additions and 2 deletions

No files matched your search

+11 -1
View File
@@ -640,6 +640,8 @@ static int libd_drawPingNum(lua_State *L)
{
INT32 x, y, flags, num;
const UINT8 *colormap = NULL;
huddrawlist_h list;
HUDONLY
x = luaL_checkinteger(L, 1);
y = luaL_checkinteger(L, 2);
@@ -649,7 +651,15 @@ static int libd_drawPingNum(lua_State *L)
if (!lua_isnoneornil(L, 5))
colormap = *((UINT8 **)luaL_checkudata(L, 5, META_COLORMAP));
V_DrawPingNum(x, y, flags, num, colormap);
lua_getfield(L, LUA_REGISTRYINDEX, "HUD_DRAW_LIST");
list = (huddrawlist_h) lua_touserdata(L, -1);
lua_pop(L, 1);
if (LUA_HUD_IsDrawListValid(list))
LUA_HUD_AddDrawPingNum(list, x, y, num, flags, colormap);
else
V_DrawPingNum(x, y, flags, num, colormap);
return 0;
}
+24 -1
View File
@@ -22,6 +22,7 @@ enum drawitem_e {
DI_DrawScaled,
DI_DrawNum,
DI_DrawPaddedNum,
DI_DrawPingNum,
DI_DrawFill,
DI_DrawString,
DI_DrawKartString,
@@ -45,7 +46,7 @@ typedef struct drawitem_s {
INT32 flags;
UINT16 basecolor;
UINT16 outlinecolor;
UINT8 *colormap;
const UINT8 *colormap;
UINT8 *basecolormap;
UINT8 *outlinecolormap;
fixed_t sx;
@@ -251,6 +252,25 @@ void LUA_HUD_AddDrawPaddedNum(
item->flags = flags;
}
void LUA_HUD_AddDrawPingNum(
huddrawlist_h list,
INT32 x,
INT32 y,
INT32 num,
INT32 flags,
const UINT8 *colormap
)
{
size_t i = AllocateDrawItem(list);
drawitem_t *item = &list->items[i];
item->type = DI_DrawPingNum;
item->x = x;
item->y = y;
item->num = num;
item->flags = flags;
item->colormap = colormap;
}
void LUA_HUD_AddDrawFill(
huddrawlist_h list,
INT32 x,
@@ -363,6 +383,9 @@ void LUA_HUD_DrawList(huddrawlist_h list)
case DI_DrawPaddedNum:
V_DrawPaddedTallNum(item->x, item->y, item->flags, item->num, item->digits);
break;
case DI_DrawPingNum:
V_DrawPingNum(item->x, item->y, item->flags, item->num, item->colormap);
break;
case DI_DrawFill:
V_DrawFill(item->x, item->y, item->w, item->h, item->c);
break;
+8
View File
@@ -66,6 +66,14 @@ void LUA_HUD_AddDrawPaddedNum(
INT32 digits,
INT32 flags
);
void LUA_HUD_AddDrawPingNum(
huddrawlist_h list,
INT32 x,
INT32 y,
INT32 num,
INT32 flags,
const UINT8 *colormap
);
void LUA_HUD_AddDrawFill(
huddrawlist_h list,
INT32 x,