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
807 stars 132 forks source link

Various menu control improvements #1199

Closed JNechaevsky closed 7 months ago

JNechaevsky commented 7 months ago

Small collection of various menu control improvements.

Following actions can be confirmed by Enter key:

Heretic and Hexen:

Extra:

JNechaevsky commented 7 months ago

Thanks for accepting! 🤗

On a next step I would like to suggest indication of savegame file date ("modified" date, technically) in Save/Load menu. It's shamelessly inspired by Woof, but approach is different, I have a working code for Doom, Heretic and Hexen already.

Please note, that it will require just a small extension of existing DrawSaveLoadBottomLine function, but what's more interesting - constructing date in "%Y-%m-%d %X" doesn't seems to require shutting up pragmas, at least GCC on MSYS and Linux are happy. Probably worth to checkout Woof's code as well.

Results are pretty obivious, but will require adaptation of coloring style to Crispy + small vertical menu shifting:

![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/75674f0e-cb97-43e6-9976-e0750c4bf62c) ![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/94d176ce-1eb1-4cd4-a941-386a0e6db34a) ![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/bf997b5c-6146-4fa0-8918-2086051d1e6a)

However, before proceed I need to get your approval to remove extra line background, this one: image

If one more extra line background will be used for file date, it probably will not look good, and not using any extra lines will allow to don't draw anything over status bar (pixel perfection!).

fabiangreffrath commented 7 months ago

Thanks for accepting! 🤗

Thanks for working on this!

but what's more interesting - constructing date in "%Y-%m-%d %X" doesn't seems to require shutting up pragmas, at least GCC on MSYS and Linux are happy. Probably worth to checkout Woof's code as well.

Sure, but "%Y-%m-%d" is not the native date format in my locale. We shut up the warning, because in some locales the date format is only two- digit, and then the date string is century ambiguous.

However, before proceed I need to get your approval to remove extra line background

Yes, of course, please proceed.

JNechaevsky commented 7 months ago

Sure, but "%Y-%m-%d" is not the native date format in my locale. We shut up the warning, because in some locales the date format is only two- digit, and then the date string is century ambiguous.

Aaaah, so idea is to set not just time, but also a date to user's locale, got it. My native format is DD.MM.YYYY, but somehow I got used to YYYY-MM-DD international ISO format. Sure, worth to follow Woof approach then.

JNechaevsky commented 7 months ago

First results. There is small problem with original 4:3 ratio I would like to solve - file date should not be drawing over status bar KIS stats, otherwise it will not be very nice, but this way menu is slightly higher than it should be.

![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/6a465b1d-a263-47f6-8783-19e34baa3a47) ![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/8d0a5fa2-b788-438e-9fe8-c307335e8dea) ![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/3f2ed390-68ce-47e5-b8b0-3b18fc2a549d)

Another idea is to make status bar KIS stats translucent while active Save/Load menu. This will also keep chat line visible:

![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/9f4bfbeb-6157-453b-8a5c-97980ea67d2d) ![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/556ac722-761a-490f-b043-9eb63813396d)

Which way should I proceed?

JNechaevsky commented 7 months ago

Third idea is try to fit everything in one line, like on this mockup

![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/bca9005a-7d8e-4673-b8e6-7cab635d7d4b)

This is tricky, but won't require vertical menu shifting at all, and we'll have to remove PGUP/PGDN strings, otherwise it won't fit nicely. But we can implement scrolling by arrow keys as well, they aren't used while string editing.

P.S. Hmm, MM/DD/YYYY is not my locale format, despite of I'm using following string to construct date and time: strftime(filedate, sizeof(filedate), "%x %X", localtime(&filestat.st_mtime));

fabiangreffrath commented 7 months ago

You'll have to call setlocale(LC_TIME, "") somewhere early in the init code (and thus unleash a plethora of bugs on Windows). https://github.com/fabiangreffrath/woof/blob/877836530867a100f91834c05c362b48b7dc7c30/src/i_main.c#L56

JNechaevsky commented 7 months ago

Worked perfectly, GCC under MSYS doesn't have any complains 😊

```diff +++ crispy-doom/src/i_main.c Sun Apr 21 19:00:55 2024 @@ -18,14 +18,15 @@ #include "config.h" #include "crispy.h" #include #include #include +#include #include "SDL.h" #include "doomtype.h" #include "i_system.h" #include "m_argv.h" #include "m_misc.h" @@ -47,14 +48,17 @@ myargv = malloc(argc * sizeof(char *)); assert(myargv != NULL); for (int i = 0; i < argc; i++) { myargv[i] = M_StringDuplicate(argv[i]); } + + // [crispy] Print date and time in the Load/Save Game menus in the current locale + setlocale(LC_TIME, ""); //! // Print the program version and exit. // if (M_ParmExists("-version") || M_ParmExists("--version")) { puts(PACKAGE_STRING); exit(0); ``` ![image](https://github.com/fabiangreffrath/crispy-doom/assets/21193394/5a80036d-d414-4684-b392-da19d8658359)

Please choose preferred alignment:

fabiangreffrath commented 7 months ago

To be honest, I wouldn't bother with translucency and just draw things over things. We only have so much space on screen, and the menu already covers various part of the game scene. 🤷