Dust this crap off a bit

This commit is contained in:
GenericHeroGuy committed 2024-05-23 16:47:29 +02:00
1 parent 3f6575e41f
commit 9cd1233c32
2 files changed
+18 -11

No files matched your search

+5 -5
View File
@@ -42,11 +42,11 @@ enum hud {
extern boolean hud_running;
extern boolean hud_interpolate;
extern UINT8 hud_interptag;
extern UINT32 hud_interpcounter;
extern boolean hud_interpstring;
extern boolean hud_interplatch;
extern boolean hud_interpolate; // interpolation enabled
extern UINT8 hud_interptag; // current tag
extern UINT32 hud_interpcounter; // number of HUD hooks ran
extern boolean hud_interpstring; // string mode
extern boolean hud_interplatch; // string mode was toggled
boolean LUA_HudEnabled(enum hud option);
+13 -6
View File
@@ -318,6 +318,7 @@ static void CalcFillCoords(drawitem_t *item)
#define INTERP_LATCH 1
#define INTERP_STRING 2
#define INTERP_FLAGS 3 // all bits combined
static UINT64 GetItemId(void)
{
@@ -325,7 +326,7 @@ static UINT64 GetItemId(void)
return 0;
// leave bits 0 and 1 free for the string mode
UINT64 id = ((UINT64)gL->savedpc << 32) | (hud_interpcounter << 10) | (hud_interptag << 2);
UINT64 id = ((uintptr_t)gL->savedpc << 32) | (hud_interpcounter << 10) | (hud_interptag << 2);
if (hud_interplatch)
{
@@ -580,7 +581,8 @@ void LUA_HUD_DrawList(huddrawlist_h list)
drawitem_t *olditem = NULL;
const char *itemstr = &list->strbuf[item->stroffset];
if (item->id) {
if (item->id)
{
// find the old one too
// this is kinda cursed... we need to check every item
// but stop when the first-checked item is reached again
@@ -595,16 +597,19 @@ void LUA_HUD_DrawList(huddrawlist_h list)
break;
}
drawitem_t *old = &list->olditems[j++];
if ((old->id & ~3) == (item->id & ~3))
if ((old->id & ~INTERP_FLAGS) == (item->id & ~INTERP_FLAGS)) // don't include flags in search
{
// gotcha!
olditem = old;
if (item->id & INTERP_LATCH) {
if (item->id & INTERP_LATCH)
{
lerpx = FixedMul(frac, item->x - olditem->x);
lerpy = FixedMul(frac, item->y - olditem->y);
latchitem = item;
oldlatchitem = olditem;
} else if (!(item->id & INTERP_STRING)) {
}
else if (!(item->id & INTERP_STRING))
{
lerpx = FixedMul(frac, item->x - olditem->x);
lerpy = FixedMul(frac, item->y - olditem->y);
latchitem = NULL;
@@ -614,7 +619,9 @@ void LUA_HUD_DrawList(huddrawlist_h list)
if (j == stop)
break;
}
} else {
}
else
{
lerpx = lerpy = 0;
latchitem = NULL;
}