Commit Graph

14035 Commits

Author SHA1 Message Date
nhmall
4e8935ab9c extraneous line 2022-08-26 14:25:09 -04:00
nhmall
bb4474bbaf fix some (not all) glyph_to_cmap odd returns
I think some of these discrepencies between glyph_is_cmap and
glyph_to_cmap started after b14b830b because the additional
ranges added by that didn't have a corresponding return in
glyph_to_cmap.
2022-08-26 14:08:03 -04:00
nhmall
dcf9fce803 debug code to check some display macros 2022-08-26 14:01:52 -04:00
Michael Meyer
e05f326d1c Add makesingular to test_src
There are already pretty solid tests of makeplural, so add some in the
other direction, since it's similarly complicated and has to implement
many of the same special cases and exceptions in the other direction.  I
originally tried just running the makeplural tests backwards to this
end, but several of them are tests to guarantee already-plural words
aren't further pluralized, so are not reversible.
2022-08-26 18:08:37 +03:00
Michael Meyer
3f3f530e43 Fix: test_src -eaux plurals
These plurals (e.g. "gateau" -> "gateaux") were added to makeplural and
makesingular in 0c0262e, so the test was outdated and failed.  I also
added another test for "Federal Bureau of Investigation", since 'bureau'
is an exception to the -eau rule (pluralizes as 'bureaus') and the
exception was originally implemented in a way that would have caused the
"Federal Bureau of Investigation" test to fail -- so it seems like a
good pitfall to test for.
2022-08-26 18:08:37 +03:00
Michael Meyer
70008fc684 Fix: movement tests
Movement tests weren't working because terrain was being positioned one
square to the left of where it was expected, and the error message
printed something other than the expected coordinates.

I wasn't able to figure out why they were like this in the first place
(referring to one spot to the left of the hero with <u.ux-2, u.uy>), so
it's quite possible that I am missing some context here, but the test
failed consistently for me before making these changes, and now works.
2022-08-26 18:08:37 +03: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
Pasi Kallinen
723ee6d1f6 Expose selection bounds to lua 2022-08-26 13:07:52 +03:00
Pasi Kallinen
5e9ed7a290 Some selection optimizations
- Add bounds, so that we don't process any locations outside
  as those locations are known to be unset
- The bounds are only recalculated if needed
- Replace instances of selection_not where we actually want
  a new selection with all locations set
2022-08-26 12:43:40 +03:00
PatR
e815498f07 git issue #838 - old time manipulation for BSD
Issue #838 from clausecker, relayed by copperwater:  old workarounds
for lack of type 'time_t' from pre-standard days aren't suitable any
more.  One of the instances was incorrect (diagnosed by entrez) and
no one had noticed for years (or possibly just ignored a compiler
warning).

Remove most of the old cruft from hacklib.c and some from system.h
but put in commented workarounds in unixconf.h in case someone needs
to resurrect it.  It would have been better to do things this way
back in the old days.

Resurrecting some non-Unix port might need to clone the unixconf.h
bits in its own *conf.h, but that probably won't be necessary for a
standard C compliant system.

Closes #838
2022-08-25 23:35:36 -07: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
Patric Mueller
b566574d45 curses: revert accidentally removed code block for #saveoptions 2022-08-24 23:41:31 +02:00
Patric Mueller
2deb119ee0 curses: implement a dialog for the windowborders option 2022-08-24 21:03:36 +02:00
Pasi Kallinen
2da4d92751 Fix room array overflowing into subrooms
If the map is big enough so that makerooms generates the maximum
allowed number of rooms for the level, the last room will "overflow"
into the subrooms array.

The rooms array assumes the last entry has hx = -1, and add_room
changes the next room hx to -1 but because the subrooms array
is right after the rooms array, this change actually touches
the first subroom on the level.

This has been present since who knows how long, but because
the levels are normally small enough, the room limit is never hit.
2022-08-24 21:30:46 +03:00
Pasi Kallinen
48db75fabc Add some hallu monsters 2022-08-24 18:40:27 +03: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
282b2a7bbe Make explosions give feedback message
... even when the explosion doesn't hit anything.
2022-08-24 13:26:44 +03:00
Pasi Kallinen
6766943455 Add boulder pushing to therecmdmenu 2022-08-24 12:53:04 +03:00
Pasi Kallinen
edae8273b9 Explicitly list the random breath types 2022-08-24 10:29:59 +03:00
PatR
f3f5fa8cfd fix mon digest mon conferring intrinsics
Pull request #846 from entrez:  pets got two chances to obtain
intrinsics if they hit for digestion damage (only possible with
engulf attacks).

Closes #846
2022-08-23 18:35:06 -07:00
Michael Meyer
cee6c9a919 Fix: engulf/digest intrinsic granting
Engulfing pets were getting a double chance to get an intrinsic from a
digestion attack, because they got the mon_givit call in mhitm_ad_dgst
and then also the one in mdamagem.

There is a bit of inconsistency here, in that mhitm_ad_dgst requires
corpse creation to grant nutrition, but the non-nutrition effects of
eating a corpse like polymorph, extra health, etc, in mdamagem don't
have any such requirement.  As a result, one of the mon_givit calls
required a corpse to be "created" before granting an intrinsic, and the
other didn't.   In choosing which one to remove, I figured intrinsic
granting is probably closer to those special effects than providing
nutrition (and also putting it in mhitm_ad_dgst is not ideal w/r/t
message ordering: it causes the 'intrinsic granted' message to appear
before the monster kill message).
2022-08-23 18:34:22 -07:00
PatR
422a06f01f black and white ice, sink
When moat and lava use the same screen symbol and color is Off, lava
is rendered in inverse video.  It used to be similar for floor and
ice, but that got broken last year.  Fix inverse ice, and now that
fountain and sink might be same symbol (recent IBMgraphics change),
render sinks in inverse if they match fountains and color is Off.

I started to give sink its own mapglyph flag but then got lazy and
used the same value as ice.  That can be amended if some interface
wants to use some more elaborate distinction than inverse video.
2022-08-23 16:01:35 -07:00
Pasi Kallinen
50b91bdcfa Make sink symbol match fountain in IBMgraphics 2022-08-23 23:36:41 +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
Pasi Kallinen
3a255e86c4 Some lua selection userdata code cleanup 2022-08-23 17:34:29 +03:00
Pasi Kallinen
d39b2f3a23 Remove extra definitions 2022-08-23 16:52:05 +03:00
Pasi Kallinen
4cfefb056a Clear or copy whole selectionvar 2022-08-23 14:39:39 +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
Patric Mueller
4aeb3875e2 Fix some coordxy declarations that should be xint16
By temporarily changing the type definition for each of xint16 and
coordxy to int32_t, the compiler was able to find several places where
the type definitions were wrong.
2022-08-23 09:10:17 +02:00
PatR
8d29733fc4 curses: 'perm_invent' revisited
Redo the fix for using doset(#optionsfull) to toggle perm_invent
under curses.  Move it to curses code and let the core be unaware
of it.  It does the perm_invent update twice when creating the
window for that.
2022-08-22 18:36:53 -07:00
PatR
9541f17126 fix end-of-game DUMPLOG panic
dump_create_nhwindow() has been returning a bogus value.  In the past
that didn't make any difference but after some recent perm_invent
changes, it started triggering a panic when writing the inventory
portion of DUMPLOG.

The changes to invent.c just avoid attempting to create a window that
won't be used.
2022-08-22 14:03:28 -07:00
Pasi Kallinen
4a84fb5b9d Monsters can blind you with a camera 2022-08-22 13:32:12 +03:00
nhmall
25fc7ea2f5 update tested versions of Visual Studio 2022-08-21 11:51:15 -04:00
nhmall
dd791cdcb7 update Guidebook 2022-08-21 10:20:32 -04:00
Pasi Kallinen
a9ca23e8f9 Random figurines are of harder monsters 2022-08-21 13:23:16 +03:00
Pasi Kallinen
2b163d89b0 Rename command to #debugfuzzer, add some z and doc 2022-08-21 12:10:08 +03:00
Pasi Kallinen
fcf5c1ea50 Monsters see and remember when others trigger traps
No longer will there be a conga line of hill orcs stepping into
the same arrow trap one after another.
2022-08-21 11:51:19 +03:00
Pasi Kallinen
953d43f5ac Monster known traps bit twiddling 2022-08-21 11:36:39 +03:00
PatR
96e9534289 error() doesn't return
This will fix some complaints from static analysis.  Note that the
code it complained about wasn't incorrect and that's likely to be
the case of a lot of its complaints.
2022-08-20 15:42:04 -07:00
Pasi Kallinen
b0f3371147 Monsters try to escape from boulder forts
If a monster cannot move, for example because it's being
blocked off by boulders or walls, it will try to escape by some
method - such as a wand or scroll of teleportation.
2022-08-20 21:49:55 +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
7ab1ac0a19 Split soldier-finding into separate function 2022-08-20 19:33:53 +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
535eb9327a Fix the corpse taste adjectives
Use proper grammar, and just go with randomized, not fixed by corpse type.
2022-08-20 16:35:31 +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
c1337773f5 'color' in simple options menu
'color' appears in the simplified O menu for curses, but was not
showing up for tty.  That's because it is hidden when tiles are in
use, and tty has had a bogus value for iflags.wc_tiled_map.

Presence of USE_TILES is not a reliable way to tell whether tiles
are available in a multi-interface binary.  Nor is the setting of
DEFAULT_WC_TILED_MAP from config.h.
2022-08-19 14:54:59 -07:00