Commit Graph

666 Commits

Author SHA1 Message Date
nhmall
88f6df2d8b some tabs to spaces
cd src
    grep -P -n '\t' *.c | grep -v "1:"
    cd ../include
    grep -P -n '\t' *.h | grep -v "1:"
    cd ..

side note: win/Qt/*.cpp are full of tabs
2022-10-26 14:21:23 -04:00
PatR
fc0f05398e getpos() reformatting
Some miscellaneous reformatting done while looking over getpos() usage
rather than reformatting of getpos() itself.
2022-10-20 10:33:38 -07:00
PatR
de12cbe47f rename #wizcheckmdifficulty to #wizmondiff
Shorten the name of the recently added debug command that validates
monster difficulty values.  'wizcheckmdifficulty' was 19 characters
long, the next longest is 14 ('wiztelekinesis').  The extra width
messed up the Qt interface's extended command selection dialog when
wizard mode commands are included.  It sizes the button for every
command to fit the longest name; the increase in size from 14 to 19
made the button grid become too big for the screen.

Add monsters' base difficulty level to the #wizmondiff output.

Add #wizmondiff and #wizdispmacros to 'wizhelp'.
2022-10-14 12:42:12 -07:00
nhmall
c4fc5cf9ce gcc warning 2022-10-07 10:36:16 -04:00
nhmall
b0029472de during devel make it easy to review mon difficulty 2022-10-07 10:26:40 -04:00
Pasi Kallinen
99e45e6daa Allow suppressing debugfuzzer warnings 2022-09-13 13:41:27 +03:00
Pasi Kallinen
e952f67f2c Add #wizcast command to cast any spell
Wizard-mode command to cast any spell without checks that would
prevent casting, and with no energy use.

Mainly to allow the fuzzer to exercise the spell code paths.
2022-09-06 22:58:28 +03:00
nhmall
817b4686ce Revert "move struct propname to a header file"
This reverts commit 402b2bf5c8.
2022-09-06 08:01:50 -04:00
nhmall
402b2bf5c8 move struct propname to a header file
In doing so, avoid repeated layout declaration in cmd.c
2022-09-06 07:22:55 -04:00
PatR
1459f44f4e \#herecmdmenu tweak
The menu for #herecmdmenu includes "look at map symbol" but if you
choose that it auto-picks the hero's location.  Looking at your own
'@' isn't particularly useful so only include that menu option if
the symbol or tile being displayed isn't the normal one.
2022-09-05 14:58:55 -07:00
Pasi Kallinen
e818395a55 Add tipping a container to herecmdmenu 2022-09-05 23:27:58 +03:00
PatR
7100534c80 typo fix and comment update for #migratemons 2022-09-01 13:36:50 -07:00
Pasi Kallinen
b4c45a4b8e Fix hang when getting an input prompt
When you were busy with an occupation, such as digging with
a pickaxe, and a prompt showed up to ask you enter something,
the game just hung with infinite loop.

Remove the occupation check returning a NUL from the input
function. I didn't notice any side effects, but I would not
be surprised if something comes up ...

I didn't investigate which commit caused this, but I suspect my
rhack or parse changes.
2022-08-28 14:09:09 +03:00
nhmall
a932841fc0 follow-up on display macro tests 2022-08-27 08:40:05 -04:00
nhmall
c92a3b0653 fix glyph_to_cmap() odd macro results
Some discrepencies between glyph_is_cmap and glyph_to_cmap
arose after b14b830b because the change resulted in
glyph_is_cmap matching on zap beams which weren't accounted
for in the glyph_to_cmap macro. It is unlikely that
glyph_to_cmap will ever be used on such a glyph, but at least
have glyph_to_cmap return a sane value rather than drop through
to the last-resort value (currently NO_GLYPH) which is far
outside the range of the defsyms[] array indices.
2022-08-27 08:23:24 -04:00
nhmall
4e8935ab9c extraneous line 2022-08-26 14:25:09 -04:00
nhmall
dcf9fce803 debug code to check some display macros 2022-08-26 14:01:52 -04:00
Michael Meyer
719a85f37c Allow lua test files to call error()
Enable 'debugging' function calls, including error(), from the lua files
called by the wizard-mode #wizloadlua command.  Without enabling them,
calling error() still produces an error but with a message like
"attempt to call a nil value (global 'error')" instead of the one
specified in the lua file.

I think this is the right way to do this without just enabling
everything across the board (which I assume would contradict the goals
of NHL_SANDBOX), but I will admit to being a little confused by trying
to understand exactly how the sandbox permissions work, so it's possible
this isn't the right solution.

Incidentally, I am probably misunderstanding this, but considering a lua
error still occurs when error() is called, just with a different error
message, is the function really "disabled" successfully by NHL_SANDBOX?
2022-08-26 18:08:37 +03:00
PatR
1766fbe352 make #migratemons unconditional
Make #migratemons command be unconditional.  The show existing
ones part is now always present.  Compile-time DEBUG_MIGRATING_MONS
controls whether the create N new migrators part is available.

Fix creating new ones from the Castle level.  It knew how to find
the next level (Valley) but wouldn't send monsters there because of
its Is_botlevel() check.
2022-08-25 10:36:47 -07:00
Pasi Kallinen
36f2dedeb6 Adjust couple therecmdmenu entries
- Don't show attacking a peaceful or tame monster, as
  that is actually swapping places with them - so add that.

- Don't show naming a hostile monster - it's usually not
  wanted, and this way when clicking a hostile monster, the
  only entry is the attack, so will be executed automatically.
  This makes it much more usable.
2022-08-25 18:10:50 +03:00
Pasi Kallinen
51ac21bc88 Make mouse clicklook report only the specific tile
Previously the mouse clicklook mentioned every tile that matched
the character symbol, leading to overload of information and
if playing with tiles, it was mostly useless. Also the most
important bit - the tile info - was last in the text.

Now mouse clicklook only reports the exact tile information
that was clicked on.
2022-08-25 17:17:42 +03:00
PatR
b8f8b170a8 sort #migratemons list of migrating monsters
If there are any migrating monsters, #migratemons offers a chance
to view them; display the list in arrival destination order rather
than the arbitrary migrating_mons order.  Doesn't change the list's
order and doesn't apply to viewing 'c' (mons aimed at current level)
or 'n' (mons aimed at next level), just to 'o' (other, neither 'c'
nor 'n') and 'a' (all migrating mons).
2022-08-24 15:33:35 -07:00
PatR
249f6395c5 bug fix for listing migrating monsters
A typo in the code added to #migratemons resulted in bad output when
listing a subset of migrating monsters if there were any aimed at the
next level.  Didn't affect listing 'a'll because the incorrect code
wasn't reached in that situation.
2022-08-24 14:53:36 -07:00
Pasi Kallinen
7c8ccb8ccd Prevent getpos queueing mouse commands
My change to allow binding the mouse buttons made getpos
push the mouse commands into a command queue, so when you
were asked for a map location, clicked on it with a mouse,
you'd first get the expected effect, and then (most likely)
immediately traveled there.

Change getpos to clear the commands bound to the mouse buttons,
and restore the binds afterwards.
2022-08-24 14:21:27 +03:00
Pasi Kallinen
6766943455 Add boulder pushing to therecmdmenu 2022-08-24 12:53:04 +03:00
Pasi Kallinen
c42e73fd9c Allow binding mouse buttons
Instead of hardcoding mouse button actions, allow the user to
bind mouse buttons to extended commands.  For example the new
defaults are:

BIND=mouse1:therecmdmenu
BIND=mouse2:clicklook

Currently a bit rudimentary; the defaults should be OK, but
documentation is bit lacking, and in-game binding and option
saving are missing.

Allowed commands to bind are "nothing", "therecmdmenu", "clicklook",
and "mouseaction". Clicklook replaces the "clicklook" boolean option,
and mouseaction does what mouse 1 button used to do - a context sensitive
action.
2022-08-23 23:27:21 +03:00
PatR
336ecf34c3 docrt()
Replace a few more instances of calling user command doredraw()
when docrt() is meant.
2022-08-23 00:45:30 -07:00
Pasi Kallinen
2b163d89b0 Rename command to #debugfuzzer, add some z and doc 2022-08-21 12:10:08 +03:00
Pasi Kallinen
54bff58598 Make #wizgenesis ignore debug_mongen blocking
Explicitly creating monsters in wizard-mode should go through
and not get blocked by the debug_mongen flag.
2022-08-20 21:45:26 +03:00
Pasi Kallinen
caaa527d45 Fix some #saveoptions issues
The #name default key was 'N', but that gets bound to #runsoutheast
when not using number_pad. Swap around the default #name key to M-n,
and bind the 'N' to it in commands_init instead.

The number_pad option wasn't getting saved because it has a separate
handler - mark the option as changed even if the value did not change
so it will be saved to the config.
2022-08-20 17:09:23 +03:00
Pasi Kallinen
ac5aadf0e3 Add #fuzzer wiz-mode command
Move the debug_fuzzer boolean out of the full options menu
and turn it into #fuzzer extended command
2022-08-20 08:34:52 +03:00
PatR
091c3333e9 \#wizkill fixes
Remove 'I' for remembered, unseen monster if it is successfully killed
as well as when a kill attempt reveals that there is nothing there.

When killing engulfer, don't report it to be "unseen" since hero is
able to recognized it by touch.
2022-08-19 07:35:58 -07:00
PatR
50665d10f2 m #optionsfull
Preceding #options or the key bound to that with m runs 'advanced'
options.  Implement the inverse:  preceding #optionsfull or the key
bound to that with m now runs 'simple' options.
2022-08-19 07:03:35 -07:00
PatR
8038f7108d '?' entry for 'O' help
Update the menu for the help command to change
  "i - using the 'O' command to set options"
to
  "i - using the '#optionsfull' or 'm O' command to set options"
(examples assume default key bindings but the actual help menu shows
currently bound keys; the "or 'foo'" part is omitted if #optionsfull
is bound to a key).

dat/opthelp should probably be updated to describe how doset_simple
works since that is different from normal menus and explicitly
contradicts the existing description for boolean settings being
deferred until the menu gets dismissed.  Any changes need to make
sense if displayed in the context of picking '?' in #optionsfull.
Maybe a separate help file and separate entry for it in '?' menu?
2022-08-18 14:38:45 -07:00
Pasi Kallinen
d062f4c4d8 Fix repeating untrapping
... or any that use getdir to ask direction.
2022-08-12 12:02:52 +03:00
Pasi Kallinen
fd9745f9c6 Command repeating by using cmd queues
This replaces the old pushq/saveq arrays (which were used to save
the keys pressed by the user for repeating a previous command)
with a new command queue.  This means there's no hard-coded limit
to the saved keys, and it can repeat extended commands which are
not bound to any key.
2022-08-09 11:54:45 +03:00
Michael Meyer
2b51a22c6c Fix: command counts greater than 2
Entering a count to repeat an action stopped working for counts greater
than 2 after 93db2a8: the unconditional call to reset_cmd_vars at the
top of rhack was resetting many more variables than had previously been
cleared at that point, including g.multi (which in this context tracks
how many more times the requested action should be repeated).  As a
result any count would perform the requested action twice at most.
Reduce the list of variables zeroed out at the start of rhack back to
what it was before 93db2a8.
2022-08-06 16:42:17 +03:00
Michael Meyer
76d9d65884 Fix: get_count and altmeta
M-<key> shortcuts with altmeta enabled weren't working when preceded by
a count (e.g. 2 M-j for "jump twice"): g.program_state.getting_a_command
determined whether <esc> should be read as staring a potential meta key
combination, and was being reset by readchar on the first digit entered
without being reactivated for subsequent input.  As a result, by the
time the player entered the actual command to be modified by the count,
readchar wasn't bothering to look for M-<key> sequences.
2022-08-06 16:42:17 +03:00
nhmall
958a8aa297 quiet a warning that appeared today
src/cmd.c(2867) : warning C4701: potentially uninitialized local variable 'win' used
2022-08-05 10:31:54 -04:00
Pasi Kallinen
fa1b326e31 Save changed key binds to config file 2022-08-05 13:07:26 +03:00
Pasi Kallinen
45613ea771 Experimental #saveoptions command
Add a #saveoptions extended command, to allow saving configuration
settings from within the game. This is still highly experimental,
and gives plenty of warnings before asking to overwrite the file.

Lack of option saving is one of the biggest complaints new players
have, so this should help with it.  More experienced players with
highly customized config file should not use this feature, as it
completely rewrites the file, removing all comments and non-config
lines.
2022-08-05 10:33:55 +03:00
Pasi Kallinen
4ff9537b0d Rudimentary key rebinding in game options
Currently shown only in the full options list, as it's not
quite complete. (For example, it doesn't handle movement commands,
or the getpos keys)
2022-08-04 14:42:45 +03:00
Pasi Kallinen
bfd262ebe8 Add optionsfull extended command
This is the previous, full options list. Adding it as
an extended command, so users can do

BIND=O:optionsfull

to go back to the old behaviour.
2022-08-03 19:18:44 +03:00
Pasi Kallinen
f3591ea07d User-friendly options menu
Make the default options menu only show the most important
options, split into categories. The full, traditional menu
can be accessed by using the m-prefix.
2022-08-03 14:08:31 +03:00
PatR
34db0b0dd3 \#wizkill tweak
If wizard mode player targets 'I' with #wizkill and there is no
monster there, remove that 'I'.
2022-07-29 15:55:53 -07:00
PatR
1a367c7ff5 \#migratemons
Extend the wizard mode #migratemons command.  Instead of just asking
for how many random new monsters to be sent to the next level, first
describe how many migrating monsters there already are, then if that's
non-zero ask whether to show them.  Choices are 'c' for ones scheduled
to arrive at the current level if hero leaves and returns, 'n' for
ones aimed at the next level, 'o' for ones that aren't in either of
those two categories, 'a' for all migrating monsters, and 'q' to skip.
After that, ask how many to make for the next level.  The default for
that is still zero.

For the 'o' and 'a' cases, they're displayed in the reverse order of
when they went onto migrating_mons, not sorted by destination level.
2022-07-28 00:34:31 -07:00
Pasi Kallinen
06efa695be Abort wiztelekinesis if changing levels 2022-07-18 13:14:11 +03:00
Pasi Kallinen
6fe0f7c132 Unify impaired movement direction checks 2022-07-17 12:23:49 +03:00
PatR
fcbeed21cc montraits vs monst->mstate
The new test in m_detach(mon) to check whether mon was already detached
is being tripped for trolls who died, revived, and died again.  Clear
out the MON_DETACH bit when saving montraits.
2022-07-16 06:36:45 -07:00
PatR
1b3d2c6781 \#wizmakemap fix fix
Check for the possibility of dead monsters on fmon when removing
everything from fmon.  Mustn't pass a pending dead monster to
mongone() and get rid of it twice.
2022-07-15 23:57:10 -07:00