fabiangreffrath / crispy-doom

Crispy Doom is a limit-removing enhanced-resolution Doom source port based on Chocolate Doom.
https://fabiangreffrath.github.io/crispy-homepage
GNU General Public License v2.0
808 stars 132 forks source link

Heretic and Hexen: check for valid, existing characters in font drawing functions #1201

Closed JNechaevsky closed 7 months ago

JNechaevsky commented 7 months ago

This should fix possible crashes in cases like:

JNechaevsky commented 7 months ago

@fabiangreffrath, how about this approach? There is definitely some potential for readability improvement, like using macros instead of bare ACSII indexes (const int's probably won't be happy about [\\]^_'{|}~ charaters) and comments improvement. But in general, is it acceptable and should I proceed?

JNechaevsky commented 7 months ago

Just a moment, just a moment, there is still Hexen to take care.

JNechaevsky commented 7 months ago

Allright, it's all done! Hexen is using MN_DrTextA() for automap strings drawing, that is now safe for CaSe SeNsItivItY. Intermission and finale texts are using toupper() correction and all such texts are in lowercase right in Hexen.wad (CLUS1-3MSG and WIN1-3MSG lumps). In-game ACS prints are obliviously MN_DrTextA() and MN_DrTextAYellow()'s.

Thank you very much for recommendations, it's much cleaner and readable now than my prototype I wrote in the morning, almost right after getting from bed. 😀

Ah yes, and of course, initial issue fixed and time is now appearing as it should for lowercase am/pm:

![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/cd08a3ab-f623-4937-980a-eb61c641a746)