MrAlaux / Nugget-Doom

Nugget Doom is a fork of Woof! with additional features.
GNU General Public License v2.0
60 stars 3 forks source link

Fix caching of certain NUGHUD patches #53

Closed MrAlaux closed 1 year ago

MrAlaux commented 1 year ago

NUGHUD allows to draw any (?) patch available in the loaded WADs.

Some of these patches are, of course, graphics used by other parts of the game, and some of them are given the PU_STATIC tag when cached, and the code doesn't expect them to be purged upon e.g. ending a level. However, up until now, all patches cached by NUGHUD were given the PU_CACHE tag, so they were purged rather often (including exiting of a level).

This can be problem, for example, with the Status Bar graphics; these are normally cached only upon initializing the Status Bar, which only happens when (re)starting the screen. If NUGHUD were to use any of those graphics, though, it'd attempt to cache them again, giving them the PU_CACHE tag and therefore purging them upon exiting a level. NUGHUD may then cache those graphics again, but the Status Bar code won't, and the pointers it uses aren't updated, so a crash occurs.

This potential fix addresses that by making the NUGHUD code cache patches with the PU_STATIC tag. They might be cached by other code later and given the PU_CACHE tag, but NUGHUD can seemingly handle that.

MrAlaux commented 1 year ago

@Dezaimasu could you download either of these automated builds and attempt to trigger the crash?

Dezaimasu commented 1 year ago

Looks like it fixed the issue. No crashes, and the HUD looks normal every time I open the automap, green HUD with glitchy sprites on it was the only consistent problem. I tried multiple maps, different settings, and every time it runs perfectly fine, while previous 2.0.0. version still crashes. Thanks.

MrAlaux commented 1 year ago

Thank you for the report and for testing!