Fix coronas duplicate-drawing sometimes

This commit is contained in:
nashmuhandes 2025-05-03 07:01:11 +08:00
commit db8bdab669
2 changed files with 10 additions and 1 deletions

View file

@ -664,6 +664,15 @@ public:
Insert (SortedFind (item, std::forward<Func>(lt), false), item);
}
void SortedInsertUnique(const T &item)
{
int foundIndex = SortedFind (item, false);
if (foundIndex >= Count || Array[foundIndex] != item)
{
Insert (foundIndex, item);
}
}
void ShrinkToFit ()
{
if (Most > Count)

View file

@ -876,7 +876,7 @@ void HWSprite::Process(HWDrawInfo *di, FRenderState& state, AActor* thing, secto
if (thing->IsKindOf(NAME_Corona))
{
Coronas.Push(thing);
Coronas.SortedInsertUnique(thing);
return;
}