ZizzoTheInfinite: Okay, so I finally got a bug up my proverbial to sit down and try to fix some of the problems in the rogue-like keyset mode. Since my non-roguelike-mode experience is minimal to none, though, I figured I'd better float my proposed solutions for peer review before writing a botched patch that screws everyone else up.

For a first pass, I'm going to work on the two problems I run into most often:


Some store commands are on letters that are keymapped to something else in roguelike mode. The obvious solution of simply disabling keymaps in stores is undesirable, since some inventory-management commands are still available within stores, and we still want, for instance, the '^D'→'k' keymap for the "destroy item" command to work. The store main loop (do_cmd_store() in src/store.c) calls request_command() from src/util.c to accept commands; it is called with a special "shopping mode" flag set, but said flag appears to do exactly nothing.

I can think of three possible fixes:


Commands entered from the inventory or equipment list appear to ignore all keymaps. This appears to be the result of the way the command-entry code for do_cmd_inven() and do_cmd_equip() in src/cmd3.c is implemented:

        /* Get a command */
        prt(out_val, 0, 0);

        /* Get a new command */
        command_new = inkey();

        /* Restore the screen */
        Term_load();
        character_icky = FALSE;


        /* Process "Escape" */
        if (command_new == ESCAPE)
        {
                /* Reset stuff */
                command_new = 0;
        }

        /* Process normal keys */
        else
        {
                /* Hack -- Use "display" mode */
                command_see = TRUE;
        }

AFAICT, this is done this way to allow for special handling of the ESCAPE key to exit the inven/equip list. command_new is an "auto-command" mechanism; for instance, when you step onto a store entry square, the '_' enter-building command is automatically fed to request_command() via this mechanism. The problem is that this auto-command mechanism bypasses all keymaps.

For this case, I don't see why we couldn't simply use request_command(), which already catches and returns the ESCAPE character in a reasonable fashion. If it's imperative to restore the screen immediately after typing the first key (cf. the Term_load() call in the above code), we can add a new flag/mode to request_command() that implements that.


So. I'll probably begin coding this up tomorrow, unless I hear objections before then. And feel free to suggest any other issues or problems with roguelike mode that need fixing.

ZizzoTheInfinite: Well, whaddaya know—it's tomorrow… ;) I did eventually figure out, BTW, why do_cmd_{inven,equip}() don't call request_command() directly: because then they'd have to process the commands themselves, which would be far too annoying. Instead, I just added an extra flag to temporarily re-enable keymaps for this case.

I've worked up a first-pass patch that appears to fix both the problems above. I encourage users of both command sets to try this patch and alert me to any problems it may cause.

JulesBean: I haven't looked at Zizzo's patch yet, but I will. I just want to jot down another issue:

Some of the new ToME commands have poorly documented roguelike equivalents, or no roguelike equivalent at all. For example, the ability screen (which you have to access using '\N', since '\' is the 'access underlying command' escape). This is made more painful by the fact that searching the built-in docs is broken, and the commands section is now very big indeed.

MayLith: Once I get into bringing over/reinventing the Documentation/Commands section (or whatever it's going to be called; I forget off the top of my head) it would probably be useful to have the roguelike equivalents on each page, plus (if need be) a coding section as well. I think I commented on that somewhere... I'll have to look.

JohnFouhy: Another issue: inscriptions seem to use the non-roguelike keyset. For example, if you have a rod that you want to be able to access with "a1", you need to inscribe the rod with "@z1", because the original keyset uses z for rods.

GeneralDiscussion/Thoughts on fixing roguelike mode (last edited 2006-11-29 05:36:19 by 222-155-214-107)