Fix: Blank Affliction Icons - Reset coverflow icons to the base atlas in SetupScrollList - #8
Open
JesseWV wants to merge 1 commit into
Open
Fix: Blank Affliction Icons - Reset coverflow icons to the base atlas in SetupScrollList#8JesseWV wants to merge 1 commit into
JesseWV wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Vanilla affliction icons render blank in
Panel_Affliction's carousel, the first aid remedy screen, once acustomSpriteaffliction has been shown. This affects any mod that setscustomSprite: true.Cause
The carousel pools its scroll objects, so a slot keeps whatever atlas it was last given.
SetupScrollListmoves a slot onto an affliction's private one-spriteCustomAtlasbut never moves it back, and when vanilla reuses that slotAfflictionCoverflow.SetAfflictionsets only the sprite name.ico_injury_sprainedAnklethen gets looked up in an atlas holding one custom image and draws nothing.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_CustomSpriteentries off it.AfflictionCoverflowhas no sibling sprite to read the base atlas from the wayAfflictionButtonhasm_FillSpriteAfflictionBar, so it comes fromScrollList.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.SetupScrollListalone.AfflictionCoverflowis 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.