Skip to content

Fix: Blank Affliction Icons - Reset coverflow icons to the base atlas in SetupScrollList - #8

Open
JesseWV wants to merge 1 commit into
TLD-Mods:masterfrom
JesseWV:bug-custom-sprite-atlas
Open

Fix: Blank Affliction Icons - Reset coverflow icons to the base atlas in SetupScrollList#8
JesseWV wants to merge 1 commit into
TLD-Mods:masterfrom
JesseWV:bug-custom-sprite-atlas

Conversation

@JesseWV

@JesseWV JesseWV commented Sep 6, 2026

Copy link
Copy Markdown

Vanilla affliction icons render blank in Panel_Affliction's carousel, the first aid remedy screen, once a customSprite affliction has been shown. This affects any mod that sets customSprite: true.

Cause

The carousel pools its scroll objects, so a slot keeps whatever atlas it was last given. SetupScrollList moves a slot onto an affliction's private one-sprite CustomAtlas but never moves it back, and when vanilla reuses that slot AfflictionCoverflow.SetAffliction sets only the sprite name. ico_injury_sprainedAnkle then gets looked up in an atlas holding one custom image and draws nothing.

before-after

The other three custom-sprite paths already reset to a base atlas before deciding whether to override it (SetCauseAndEffect, DoShowBuffNotification, SpawnDamageEvent), which is why only this one is affected.

Fix

Reset each coverflow slot to the base atlas as it is filled, then move only m_CustomSprite entries off it. AfflictionCoverflow has no sibling sprite to read the base atlas from the way AfflictionButton has m_FillSpriteAfflictionBar, so it comes from ScrollList.m_PrefabObject, the pool's template, which is never handed out to a slot. It falls back to any live slot not already on a custom atlas, and if neither resolves the reset is skipped, so behavior is unchanged rather than worse.

Scope is Panel_Affliction.SetupScrollList alone. AfflictionCoverflow is referenced by no other type in the game, so the change cannot reach any other panel, and the rest of the UI was unaffected.

Two files, 61 added lines, nothing removed or reordered. This also covers a custom affliction with customSprite: false, which takes the same vanilla lookup path and fails the same way.

Tested

TLD 2.55, MelonLoader 0.7.2, published v1.4.1 versus this branch. Also checked: no custom afflictions, two custom atlases at once, customSprite: false, shrinking list. Builds clean.

A vanilla affliction icon renders blank in the afflictions carousel once a
custom sprite affliction has been displayed.

Panel_Affliction's scroll list pools its objects, so a slot keeps whatever
atlas it was last assigned. SetupScrollList moves a slot onto the single
sprite CustomAtlas when the entry has m_CustomSprite set, but nothing ever
moves it back. When the list is rebuilt and vanilla takes that slot,
AfflictionCoverflow.SetAffliction assigns only a sprite name, so the vanilla
name is looked up in an atlas that contains one custom sprite and resolves to
nothing.

Disassembling GameAssembly.dll for 2.55 confirms the mechanism:
AfflictionCoverflow.SetAffliction and SetEmptySlot each tail-jump to
UISprite.set_spriteName and make no other call, and neither appears among the
24 direct callers of UISprite.set_atlas in the entire binary.

The same gap hits a custom affliction that does not use a custom sprite,
since it takes the vanilla lookup path too.

SetCauseAndEffect already resets AfflictionButton to a known atlas before
deciding whether to override it, which is why the first aid page is
unaffected. This applies the same order to the coverflow: put every slot back
on the base atlas as it is filled, then move only custom sprite entries off
it again.

AfflictionCoverflow has no sibling sprite to read the base atlas from, the
way AfflictionButton has m_FillSpriteAfflictionBar, so it is taken from the
scroll list's own pool template, which is never handed out to a slot and so
still holds the atlas the prefab shipped with. If that is unavailable it
falls back to any live slot not already on a custom atlas, and if neither
resolves the behavior is what it is today rather than something worse.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant