Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Item action menu doesn't fit on the screen

Open Vulp0d opened this issue 1 year ago • 1 comments

Describe the bug

Item action menu (Default key %) doesn't fit on the screen at all.

Attach save file

N/A

Steps to reproduce

  1. Create a new world and character.
  2. Open item action menu (%).
  3. Notice the bug.

Expected behavior

Item action menu fitting on the screen like others menus.

Screenshots

bug

Versions and configuration

  • OS: Linux
    • OS Version: LSB Version: n/a; Distributor ID: EndeavourOS; Description: EndeavourOS Linux; Release: rolling; Codename: rolling;
  • Game Version: cdda-experimental-2024-12-03-0525 eba9c9f [64-bit]
  • Graphics Version: Tiles
  • Game Language: English [en]
  • Mods loaded: [ Dark Days Ahead [dda], Disable NPC Needs [no_npc_food], Portal Storms Ignore NPCs [personal_portal_storms], Slowdown Fungal Growth [no_fungal_growth], Mind Over Matter [mindovermatter], Bombastic Perks [bombastic_perks], Martial Mastery [perk_melee_system], Translate Complex Dialogue [translate_dialogue], SpeedyDex [speedydex], Stats Through Kills [stats_through_kills], Tamable Wildlife [Tamable_Wildlife] ]

Additional context

N/A

Vulp0d avatar Dec 03 '24 08:12 Vulp0d

Please provide as savegame

ZhilkinSerg avatar Dec 03 '24 13:12 ZhilkinSerg

Unfortunately, the save file is way too big to send, even after several attempts to compress it as much as I could. However, I noticed this issue happens only in this specific save now and doesn't happen in any other new save anymore, so I think it was just save-specific issue since this save file was created a long time ago on some experimental and was updated and played on many other new versions many times.

Vulp0d avatar Dec 04 '24 21:12 Vulp0d

It could be because of specific items in player inventory (or nearby) - that's why we need save. There is debug option to create small save (Info - Generate minimized save archive):

image

ZhilkinSerg avatar Dec 04 '24 21:12 ZhilkinSerg

SlightyModded-trimmed.tar.gz

Thank you for taking your time to check it. And sorry for premature closure of the issue.

Vulp0d avatar Dec 04 '24 22:12 Vulp0d

Integrated Welder action has an exceedingly long description of

Repair Steel, Budget Steel, Case Hardened Carbon Steel, High Carbon Steel, Cast iron, Low Carbon Steel, Medium Carbon Steel, Plastic, Silver, Aluminum, Bronze, Thessalonian Bronze, Copper, Gold, Lead, Platinum, Low Carbon Steel Chain, Medium Carbon Steel Chain, High Carbon Steel Chain, Case Hardened Carbon Steel Chain, Superalloy, Tin, and Zinc

which blows the expected max line length to high heavens and makes uilist::calc_data() break in more ways than one.

This is doubly annoying as we are not even showing those descriptions anywhere. They would have been displayed at the bottom of the screen if we didn't put [?] keybindings there instead

20241205-015822-cataclysm-tiles


P.s.: screenshot from the hackishly modified binary of how it's supposed to look (ignore the <...> part) 20241205-020150-cataclysm-tiles

Looking closer, it seems that the integrated welder is the only item in that character inventory with any description in the first place. Interesting.

moxian avatar Dec 05 '24 09:12 moxian

Given that the general aim is for ? for keybindings to be usable everywhere appropriate it does seem like an odd thing to take up that line

Procyonae avatar Dec 13 '24 16:12 Procyonae

That description specifically comes from repair_item_actor::get_description(). It looks like that’s the only one that overrides the get_description method; all the other subclasses of iuse_actor apparently leave it alone.

db48x avatar Jan 01 '25 06:01 db48x

Any way to fix that?

AlKoGoLiSimus avatar Feb 08 '25 22:02 AlKoGoLiSimus

Sure, lots of ways. The easiest would be to remove the repair_item_actor::get_description() method. Alternatively, change game::item_action_menu() to wrap the description text at some fairly reasonable number of characters when it creates the menu. There are several other places in the game where a menu item is wrapped to 60 characters. It would make perfect sense to do the same here; search for wrap60 to find them.

The hardest way would be to make the uilist automatically and intelligently wrap long text (which can appear in several places besides just the description) so that it never makes a window larger than the screen. The primary advantage of this is that it is able to wrap by pixels giving a nicer result when the user is using a variable–width font. That’s a harder task and I doubt we’ll ever fully make it happen in all possible cases. It might not be too hard to do when the caller specifies a window size using the desired_bounds property but the general case, when the window is unconstrained, is much trickier.

db48x avatar Feb 08 '25 23:02 db48x

Guess i will just leave it for now.

AlKoGoLiSimus avatar Feb 08 '25 23:02 AlKoGoLiSimus

The hardest way would be to make the uilist automatically and intelligently wrap long text

I mentioned in one of the duplicate issues, I have a half-working attempt at rewriting uilist with appropriate wrapping in https://github.com/moxian/Cataclysm-DDA/tree/uilist-rewrite-wip but it's not quite working, and needs to figure out the imgui padding better to be PR'able

moxian avatar Feb 09 '25 00:02 moxian

@moxian, I looked at your branch very briefly yesterday. I haven’t quite gotten as far as running it yet, but I am very interested. Would you mind expanding on some of your comments? Specifically, the TODOs and the “bad api”?

db48x avatar Feb 09 '25 23:02 db48x

Explained in my fork: https://github.com/moxian/Cataclysm-DDA/pull/23#pullrequestreview-2604529144

moxian avatar Feb 10 '25 01:02 moxian

Sure, lots of ways. The easiest would be to remove the repair_item_actor::get_description() method. Alternatively, change game::item_action_menu() to wrap the description text at some fairly reasonable number of characters when it creates the menu. There are several other places in the game where a menu item is wrapped to 60 characters. It would make perfect sense to do the same here; search for wrap60 to find them.

The hardest way would be to make the uilist automatically and intelligently wrap long text (which can appear in several places besides just the description) so that it never makes a window larger than the screen. The primary advantage of this is that it is able to wrap by pixels giving a nicer result when the user is using a variable–width font. That’s a harder task and I doubt we’ll ever fully make it happen in all possible cases. It might not be too hard to do when the caller specifies a window size using the desired_bounds property but the general case, when the window is unconstrained, is much trickier.

Where I can find json which have these line?

AlKoGoLiSimus avatar Feb 14 '25 16:02 AlKoGoLiSimus

I guess "the easy method" is just to wipe out that line from game files and all be fine. I'm asking about it just because i'm full zero in that stuff, and just want to play the game and have only small windows in my free time.

AlKoGoLiSimus avatar Feb 14 '25 16:02 AlKoGoLiSimus

This issue has been mentioned on Cataclysm: Dark Days Ahead. There might be relevant details there:

https://discourse.cataclysmdda.org/t/text-wrapping-in-action-menu-bionic-multitool/29611/2

kevingranade avatar Feb 17 '25 19:02 kevingranade

It came to my attention that people believe I'm presently working on the fix. I want to make it clear that I'm not. I tried it before, it didn't quite work, and I abandoned the idea for now. I may come revisit it later, but there's absolutely no promise or timeline or anything of that sort.

If anyone is willing to take a stab at this (either as a "full" fix, or as a hacky workaround just to make the game playable for people running into this) - feel free to, don't be afraid of conflicting with my work.

moxian avatar Feb 17 '25 21:02 moxian