Ticket #437 (new feature)

Opened 1 year ago

Last modified 1 year ago

Inscriptions shouldn't ignore roguelike keyset option

Reported by: roustk@alumni.caltech.edu Assigned to:
Milestone: Future Keywords:
Cc:

Description

To number rods, you always have to inscribe them with @z1, even though the roguelike keyset uses 'a' for rods. Similarly, arrows need to be @f1 when shooting uses 't'.

It would be keen if inscriptions could be interpreted per the roguelike setting.

The relevant code (in 3.0.9) appears to be get_tag() in object1.c, which tests the first character after '@' against p_ptr->command_cmd.

Kevin

Attachments

Change History

02/02/08 12:06:30 changed by roustk@alumni.caltech.edu

This is harder to do than might be obvious, because roguelike is really a keymap.

One possibility is to change at about line 2733 of object1.c (3.0.9):

                        /* Check the special tags */
                        if ((s[1] == p_ptr->command_cmd) && (s[2] == tag))
                        {

Instead, check whether we are in roguelike mode and then run s[1] through the keymap interpreter like:

                        /* Check roguelike mode */
                        if (rogue_like_commands)
                        {
                          /* Force user to use roguelike tags (rods are 'a' not 'z') */
                          /* Pass the tag through the keymap interpreter */
                          cptr act;
                          act = keymap_act[KEYMAP_MODE_ROGUE][(byte)(s[1])];
                          if(act) s[1] = act[0];
                        }

                        /* Check the special tags */
                        if ((s[1] == p_ptr->command_cmd) && (s[2] == tag))
                        {

We also would need to handle '!' and '^' inscriptions, which are elsewhere in the code.

A problem with this, however, is that commands like destroy (^d) may break the gui. What would happen if I put a control-d (ascii 04) in an inscription instead of "!k"? Would input, display, parsing, save, load, dump, or several other things break?

Kevin

02/02/08 12:27:36 changed by roustk@alumni.caltech.edu

Different suggestion: there is currently an escape '\' to override the keymap interpreter and take the next keypress raw. Maybe create something similar in inscriptions.

For example, if '`' (backquote) were chosen as the make-it-roguelike escape, one could inscribe a rod as either @z1 or @`a1 and have it work as expected (use by pressing a1 in roguelike or z1 in standard).

This would complicate the code slightly, but not much more than my previous proposal. After the /* Check the special tags */ section at about 2733 in object1.c (3.0.9) add:

                        /* Check roguelike mode */
                        if (s[1] == '`')
                        {
                          /* Use roguelike mode (rods are 'a' not 'z') */
                          /* Pass the inscription through the keymap interpreter */
                          cptr act;
                          act = keymap_act[KEYMAP_MODE_ROGUE][(byte)(s[2])];
                          if(act)
                          {
                            if ((act[0] == p_ptr->command_cmd) && (s[3] == tag))
                            {
                                /* Save the actual inventory ID */
                                *cp = i;

                                /* Success */
                                return (TRUE);
                            }
                          }
                        }

Similar changes are required at the '!' and '^' cases buried throughout the code. Maybe things need to be (or have been) redone to centralize inscription parsing. Once I get my new machine I'll try to get svn up and running so I can grep the current code (as I'd also like to get "!*!*" working again).

Kevin


Add/Change #437 (Inscriptions shouldn't ignore roguelike keyset option)