Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item action menu doesn't fit on the screen #78316

Open
Vulp0d opened this issue Dec 3, 2024 · 15 comments
Open

Item action menu doesn't fit on the screen #78316

Vulp0d opened this issue Dec 3, 2024 · 15 comments
Labels
<Bug> This needs to be fixed ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds Items / Item Actions / Item Qualities Items and how they work and interact (S2 - Confirmed) Bug that's been confirmed to exist

Comments

@Vulp0d
Copy link

Vulp0d commented Dec 3, 2024

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 Vulp0d added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Dec 3, 2024
@ZhilkinSerg
Copy link
Contributor

Please provide as savegame

@Vulp0d
Copy link
Author

Vulp0d commented Dec 4, 2024

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 Vulp0d closed this as completed Dec 4, 2024
@ZhilkinSerg
Copy link
Contributor

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

@Vulp0d
Copy link
Author

Vulp0d commented Dec 4, 2024

SlightyModded-trimmed.tar.gz

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

@Vulp0d Vulp0d reopened this Dec 4, 2024
@ZhilkinSerg ZhilkinSerg added <Bug> This needs to be fixed (S2 - Confirmed) Bug that's been confirmed to exist Items / Item Actions / Item Qualities Items and how they work and interact ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Dec 4, 2024
@moxian
Copy link
Contributor

moxian commented Dec 5, 2024

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.

@Procyonae
Copy link
Contributor

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

@db48x
Copy link
Contributor

db48x commented Jan 1, 2025

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.

@AlKoGoLiSimus
Copy link

Any way to fix that?

@db48x
Copy link
Contributor

db48x commented Feb 8, 2025

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.

@AlKoGoLiSimus
Copy link

Guess i will just leave it for now.

@moxian
Copy link
Contributor

moxian commented Feb 9, 2025

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

@ZhilkinSerg ZhilkinSerg marked this as a duplicate of #79604 Feb 9, 2025
@db48x
Copy link
Contributor

db48x commented Feb 9, 2025

@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”?

@moxian
Copy link
Contributor

moxian commented Feb 10, 2025

Explained in my fork: moxian#23 (review)

@AlKoGoLiSimus
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Bug> This needs to be fixed ImGui Anything related to the new ImGui UI for SDL/tiles or ImTui for curses builds Items / Item Actions / Item Qualities Items and how they work and interact (S2 - Confirmed) Bug that's been confirmed to exist
Projects
None yet
Development

No branches or pull requests

6 participants