OnlineCop / kq-fork

Fork of KQ r910. Just for fun.
GNU General Public License v2.0
15 stars 9 forks source link

Overhaul eqpmenu for localized text #154

Closed OnlineCop closed 1 year ago

OnlineCop commented 1 year ago

This makes several changes to the KEquipMenu plumbing that may not be readily visible until long text is viewed.

Fixes several issues in #152, although only for the Equip menus.

There are three interactive sections of the Equip menu:

  1. Choosing whether to Equip/Remove or auto-Equip/Clear
  2. Choosing the equipment slot (weapon, shield, etc.) to equip to, or remove from
  3. Choosing from the available equipment in the party's bag to equip.

The old logic had 3-4 nested while() loops; this was reduced to a single loop and adds an input handler to transition between 1, 2 and 3 above.

I did find it annoying to press-and-release up/down to go between long lists of equipment, so I added a check for the keyboard-repeat case so the player can just hold down their arrow keys for a more natural navigation feel.

The major amount of plumbing, though, was to display ExtraLongText in the hero's name, those 4 "Equip" ,"Remove", "Optimize" and "Clear" options in section 1, the gettext _("...") localized menu text, and equipment slots with an ellipsis (sorry @z9484 if this ignores your feature/add_ellipsis work! I had started this a few weeks ago and didn't want to push up until it was closer to being finished).

The main difference between z9484's codepoint and this one, is that I decided to use \t (tab) instead, so it's easier to add into Lua scripts in case a user doesn't have that Unicode character on their system (for whatever reason, Visual Studio adds as a totally different UTF-16 point than vscode, vim, etc. and so it wasn't mapping properly).