Commit Graph

199 Commits

Author SHA1 Message Date
PatR
82fc66da0e wands zapped by monsters
Reverse part of commit 4021a63bcf
"wand/spell/breath killer reason" so that wand of magic missile
zapped by a monster isn't ambiguous about who is responsible.
2023-03-31 10:59:48 -07:00
nhmall
de79240dea some comment spelling fixes 2023-03-16 22:27:01 -04:00
Pasi Kallinen
62476fe101 Stop blinking cursor on hero when farlooking
I happened to notice when looking at a ttyrec that farlooking
with automatic description would blink the cursor on hero for
one frame, and then back on the farlooked map location.
2023-03-10 14:11:56 +02:00
PatR
4021a63bcf wand/spell/breath killer reason
Extend "killed by the touch of death inflicted by <monster>" to buzz().
"Killed by a bolt of cold" becomes "killed by a bolt of cold zapped by
<monster>" or "killed by a blast of cold" becomes "killed by a blast
of cold exhaled by <monster>" and so forth.

More work than expected; the zap code isn't passed enough context.

BZ_M_WAND() was producing the wrong value for wands zapped by monsters.
2023-03-07 02:47:42 -08:00
Pasi Kallinen
fc7a32b86e Tutorial level
Add a tutorial level to teach commands to new players.
Very much a WIP.

Breaks save and bones compat.
2023-03-01 14:00:29 +02:00
Pasi Kallinen
00c756ba75 Lua: Traps without victims
Traps may get corpses generated on them on early dungeon levels,
to warn off fragile starting heroes. Allow creating traps in lua
without the corpse.
2023-02-25 18:05:09 +02:00
Pasi Kallinen
5d659cf1f6 Tips and option to disable them
Adds a more general way to handle gameplay tips, and adds
a boolean option "tips", which can be used to disable all
tips.  Adds a helpful longer message when the game goes
into the "farlook" mode.

Also adds a lua binding to easily show multi-line text
in a menu window.

Breaks save compat.
2023-02-19 15:56:18 +02:00
nhmall
fbd9a7bae8 another update to the soundlib interface
sound_verbal(char *text, int32_t gender, int32_t tone, int32_t vol,
             int32_t moreinfo);
    -- NetHack will call this function when it wants to pass text of
       spoken language by a character or creature within the game.
    -- text is a transcript of what has been spoken.
    -- gender indicates MALE or FEMALE sounding voice.
    -- tone indicates the tone of the voice.
    -- vol is the volume (1% - 100%) for the sound.
    -- moreinfo is used to provide additional information to the soundlib.
    -- there may be some accessibility uses for this function.

It may be useful for accessibility purposes too.

A preliminary implementation has been attempted for macsound to test
the interface on macOS. No tinkering of the voices has been done.

Use of the test implementation requires the following at build time with make.
    WANT_SPEECH=1
That needs to be included on the make command line to enable the test code,
otherwise just the interface update is compiled in.

I don't know for certain when AVSpeechSynthesizer went into macOS, but older versions
likely don't support it, and would just leave off the WANT_SPEECH=1.

If built with WANT_SPEECH=1, the 'voices' NetHack option needs to be enabled.

It was a bit strange, when I first started up the test, to hear Asidonhopo,
the shopkeeper, talking to me as I entered his shop and interacted with him.
2023-02-07 00:44:36 -05:00
Pasi Kallinen
f61e1e8e23 Tiny chance of breaking iron bars with war hammer
Also add some different sounds to hitting the iron bars,
and make it noisy.
2023-01-26 18:21:53 +02:00
nhmall
ea4a81901d add an interface for sound libraries
Groundwork for a more versatile interface for using
sound libraries. A lot of sound libraries work across
multiple platforms.

The current NetHack sound stuff is quite limited.

Binaries can have a variety of window ports linked into
them, and it makes sense to have something similar for
sound.

This tries to set things up in a more soundlib-centric way,
rather than inserting things in a platform-centric way.

It establishes a new top-level directory sound (akin to win
for the window interface routines, or "window-port") where
sound-related additions and sndprocs and support files can be
added and used across platforms.

The default interface is nosound and the 'nosound' interface
is in src/sounds.c

The interface for 'windsound', which contains the same minimal
USER_SOUNDS support using built-in routines that has been in the
windows port for a long time is added to
sound/windsound/windsound.c.

For now, the sound interface support for 'qtsound' has been added
to the existing Qt files win/Qt/qt_bind.h and win/Qt/qt_bind.cpp,
and a note has been placed in sound/qtsound/README.md to avoid
confusion.

New header file added: include/sndprocs.h.
2023-01-19 18:51:42 -05:00
nhmall
ba5356603a yn()
A number of C compiler suites have a math.h library that includes a yn()
function name that conflicts with NetHack's yn() macro:
"The y0(), y1(), and yn() functions are Bessel functions of the second kind,
for orders 0, 1, and n, respectively. The argument x must be positive. The
argument n should be greater than or equal to zero. If n is less than zero,
there will be a negative exponent in the result."

At one point, isaac64.h included math.h, although that has since been removed.

Some libraries used in NetHack (Qt for one) do include math.h and that required
build work-arounds to avoid the conflict.

Rename the NetHack macro from yn() to y_n() and avoid the math.h conflict
altogether, eliminating the need for that particular work-around.
2023-01-12 16:04:40 -05:00
nhmall
02a48aa8cf split g into multiple structures
The consolidation of global variables from scattered source
files into decl.c and declared in decl.h was begun in 3.7.0.
Their placement in common files was done for centralized
initialization and potential re-initialization during a
"play again" scenario.

It wasn't really necessary for all of them to be housed in a
single huge structure to meet the "play again" requirement,
and the single huge structure has been a little unwieldy when
it comes to maintenance.

Following this commit, instead of one single extremely large structure
named 'g' to house all of the relocated global variables, they
are distributed into several ga through gz.

To make things easy for the developer, each variable is placed
into the struct corresponding to the starting letter of the variable.
That way, no lookup is required in order to know which struct houses
a particular variable, it is a simple match to the starting letter
for all the centralized global variables.

A global variable named 'amulets', would be found in ga.
    ga.amulets
     ^ ^
A global varable named 'move', would be found in gm.
    gm.moves
     ^ ^
A global variable named 'val_for_n_or_more' would be found in gv.
    gv.val_for_n_or_more
     ^ ^
A global variable named 'youmonst' would be found in gy.
    gy.youmonst
     ^ ^
2022-11-29 21:53:21 -05:00
PatR
73f69a99cb paranoid-pray vs do-again
If paranoid_confirm settings include praying, don't put the answer
to "are you sure you want to pray?" into the do-again buffer where ^A
would use it to ignore confirmation if prayer is repeated.  And for
wizard mode, when confirmation is 'y' then the answer to "force the
gods to be pleased?" has to be suppressed from the do-again buffer too
or it would be used by subsequent ^A to answer "are you sure?".

This is basically a band-aid just for #pray.  There are probably other
confirmations that should be suppressed from do-again instead of being
reusable.  The rest of the paranoid_confirm ones should be ok because
they require "yes" and that doesn't end up in the do-again buffer, but
there are bound to be other confirmations that shouldn't automatically
be re-used during repetition.
2022-11-26 15:59:01 -08:00
nhmall
3398b34cc7 another follow-up, don't cast hardcoded u.ux, u.uy 2022-11-23 19:10:28 -05:00
nhmall
937355038d some coordxy and other conversion warnings
When dist2() got changed to use coordxy parameters, a macro that uses
it in its definition was overlooked and it had (int) casts in it.
That caused a warning about possible data loss when the int
then got converted to coordxy for the dist2() call.

Give online2() coordxy parameters instead of int, like its bretheren.

Avoid a couple of implicit conversion warnings where ints were being assigned
to smaller uchar or ints being assigned to smaller short.

A couple of signed vs unsigned warnings on some rumor processing.

Avoid some signed vs unsigned warnings in mdlib/makedefs where a signed int
param eventually got used in an external call that took size_t.
Eliminate all of it by just having the outer NetHack routine also take
a size_t.

Lastly, insert some default C99 alternative time-related code
in mdlib/makedefs since asctime() and ctime() are being flagged as
deprecated in the upcoming C23 standard and will now start to trigger
warnings for anyone using a C23-compliant compiler.
2022-11-23 17:49:55 -05:00
PatR
fa0cc01ae7 PR #926 tweak - mdistu()
Define mdistu() in terms of distu() rather than dist2().  It's an
extra level of macro expansion when compiling but that's negligible
overhead.
2022-11-19 00:08:44 -08:00
Michael Meyer
619781dbb8 Add 'mdistu' macro
Short for distu(mtmp->mx, mtmp->my) (i.e. the distance between the hero
and the specified monster), which is a very common use of distu().  The
idea is that this would be a convenient shorthand for it; I actually
thought it (or something very similar) existed already, but couldn't
find it when I tried to use it earlier.  Based on the number of uses of
fully-spelled-out 'distu(mtmp->mx, mtmp->my)' replaced in this commit
I'm guessing I just imagined it.
2022-11-18 23:42:47 -08:00
PatR
546fea7db8 getting knocked off flying steed
I was trying to reproduce the reported "no monster to remove" warning
from remove_monster() when a mounted hero was knocked off jabberwocky
steed but so far haven't been able to.

While trying, I came across a more minor bug.  The hero got knocked
off a flying steed and got feedback of "you fly off" rather than
"you fall off".  Flying capability came from the steed and dismount
feedback is aware of that but calls u_locomotion() which isn't.  This
commit fixes that.

This adds some groundwork (DISMOUNT_KNOCKED) for better dismount
control.  With a map fragment of
|....
|.Du.
|....
I got knocked off my steed by the attacking dragon and ended up with
|..@.
|.Du.
|....
It would be better to prefer spot 1, then the 2s, then 3s, then 4s
(not sure about farther spots if none of those are available)
|.432
|.D@1
|.432
when forced to dismount by knockback.  This does _not_ implement that.
2022-10-03 15:53:35 -07:00
PatR
0735b790f9 object name assignment vs persistent inventory
This is an alternate way to deal with pull request #876, where
splitting a stack that has a name assigned updated perm_invent when
cloning the name and ran into trouble with shop billing when trying
to format for persistent inventory display.

The PR#876 fix has been left in place but wouldn't have been needed
if this had gone in first.
2022-09-26 14:25:06 -07:00
Pasi Kallinen
c05a6f3199 Expose some debug flags in options
Show and allow changing the debugging flags in options:

debug_fuzzer: turn on the fuzzer
debug_hunger: prevent hunger
debug_mongen: prevent monster generation
debug_overwrite_stairs: allow level generation overwrite stairs

These are wizard-mode only, cannot be set via config file,
and the fuzzer cannot change these either.
2022-08-17 20:17:30 +03:00
PatR
3dac38eb0f look_here() arguments
Add LOOKHERE_NOFLAGS to use instead of 0 for look_here()'s 2nd arg.
Fix the call to look_here() that passed FALSE.
2022-08-10 18:02:57 -07: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
Pasi Kallinen
82f0b1e8ea Scared hostile monster which cannot move away will attack 2022-07-21 20:21:10 +03:00
Pasi Kallinen
d713c1826b Buzz macros and related stuff
Add macros to convert AD_foo, WAN_foo, and SPE_foo to relative values
for passing to BZ_U_foo and BZ_M_foo macros.

Change some return values in monster spellcasting function from
magic numbers to MM_MISS or MM_HIT.

Make buzzmu consider hero resistances - previously the
monster with innate zapping ray (Angels and Asmodeus) would
just keep doing that attack, but they will now just curse if
it saw the hero resist the attack.
2022-07-19 15:14:55 +03:00
Michael Meyer
cc46da90e0 Fix #812: recovered stair dlevel
Stair dlevels weren't being restored with the correct values when
recovered after the game crashed, apparently because they weren't being
reset back to their 'absolute' level from a 'relative' level.  I'm not
totally sure of why this affected only recovered games (maybe that's the
only time when the 'relative' stair values are used?) but this fix seems
to work.

Fixes #812
2022-07-17 16:12:39 -07:00
Pasi Kallinen
486ed29077 Blessed potion of polymorph asks user for monster to poly into
... unless there's some other form that would override the choice,
such as a worn dragon armor, lycanthropy, or vampirism.

The polymorph will be in effect for 10-24 turns.
2022-07-14 14:04:27 +03:00
nhmall
30b557f7d5 change xchar to other typedefs
One of the drivers of this change was that screen coordinates require a
type that can hold values greater than 127. Parameters to the window
port routines require a large type in order to be able to have values
a fair bit larger than COLNO and ROWNO passed to them, particularly for
their use to the right of the map window.

This splits the uses of xchar into 3 different situations, and adjusts
their type and size:

                        xchar
                          |
               -----------------------
               |          |          |
            coordxy     xint16     xint8

coordxy: Actual x or y coordinates for various things (moved to 16-bits).

xint16:  Same data size as coordxy, but for non-coordinate use (16-bits).

xint8:   There are only a few use cases initially, where it was very
         plain to see that the variable could remain as 8-bits, rather
         than be bumped to 16-bits.  There are probably more such cases
         that could be changed after additional review.

Note: This first changed all xchar variables to coordxy. Some were
reviewed and got changed to xint16 or xint8 when it became apparent that
their usage was not for coordinates.

This increments EDITLEVEL in patchlevel.h
2022-06-30 23:48:18 -04:00
nhmall
377be376fe more Verbose
Make verbose a prefix compound option. verbose and !verbose
should still work just as the boolean option did.

verbose0, verbose1, verbose2, verbose3, verbose4 must be
given a decimal value in the config file to set the bits in
verbosity_suppressions[0] through verbosity_suppressions[4].
That can be used to suppress any messages represented by the
verbosity_values defined in include/hack.h.

This also adds a more verbose variation of prinv() where the
total count is included in the message (that particular more
verbose message can be suppressed with OPTIONS=verbose3:134217728).

  Verbose(n,x) name     Hex Value       Decimal             Option
  -------------------------------------------------------------------
  interrupt_multi       0x00000001               1          verbose0
  use_stethoscope       0x00000002               2          verbose0
  Mb_hit                0x00000004               4          verbose0
  adjattrib             0x00000008               8          verbose0
  ballfall              0x00000010              16          verbose0
  use_crystal_ball1     0x00000020              32          verbose0
  use_crystal_ball2     0x00000040              64          verbose0
  digactualhole1        0x00000080             128          verbose0
  digactualhole2        0x00000100             256          verbose0
  mdig_tunnel1          0x00000200             512          verbose0
  mdig_tunnel2          0x00000400            1024          verbose0
  boulder_hits_pool1    0x00000800            2048          verbose0
  boulder_hits_pool2    0x00001000            4096          verbose0
  drop1                 0x00002000            8192          verbose0
  drop2                 0x00004000           16384          verbose0
  drop3                 0x00008000           32768          verbose0
  go_to_level1          0x00010000           65536          verbose0
  go_to_level2          0x00020000          131072          verbose0
  go_to_level3          0x00040000          262144          verbose0
  rot_corpse            0x00080000          524288          verbose0
  getpos1               0x00100000         1048576          verbose0
  getpos2               0x00200000         2097152          verbose0
  off_msg               0x00400000         4194304          verbose0
  on_msg                0x00800000         8388608          verbose0
  Blindf_on             0x01000000        16777216          verbose0
  dog_eat               0x02000000        33554432          verbose0
  dog_invent            0x04000000        67108864          verbose0
  dokick                0x08000000       134217728          verbose0
  toss_up               0x10000000       268435456          verbose0
  consume_tin1          0x20000000       536870912          verbose0
  consume_tin2          0x40000000      1073741824          verbose0
  doengrave1            0x00000001               1          verbose1
  doengrave2            0x00000002               2          verbose1
  doengrave3            0x00000004               4          verbose1
  explode               0x00000008               8          verbose1
  moverock              0x00000010              16          verbose1
  still_chewing         0x00000020              32          verbose1
  trapmove1             0x00000040              64          verbose1
  trapmove2             0x00000080             128          verbose1
  trapmove3             0x00000100             256          verbose1
  trapmove4             0x00000200             512          verbose1
  trapmove5             0x00000400            1024          verbose1
  getobj1               0x00000800            2048          verbose1
  getobj2               0x00001000            4096          verbose1
  doprgold              0x00002000            8192          verbose1
  doorlock1             0x00004000           16384          verbose1
  doorlock2             0x00008000           32768          verbose1
  monpoly1              0x00010000           65536          verbose1
  monpoly2              0x00020000          131072          verbose1
  mswingsm              0x00040000          262144          verbose1
  missmu                0x00080000          524288          verbose1
  mswings               0x00100000         1048576          verbose1
  wildmiss              0x00200000         2097152          verbose1
  gulpmu                0x00400000         4194304          verbose1
  explmu                0x00800000         8388608          verbose1
  meatmetal1            0x01000000        16777216          verbose1
  meatmetal2            0x02000000        33554432          verbose1
  meatmetal3            0x04000000        67108864          verbose1
  meatmetal4            0x08000000       134217728          verbose1
  relobj                0x10000000       268435456          verbose1
  ready_weapon          0x20000000       536870912          verbose1
  wield_tool            0x40000000      1073741824          verbose1
  meatobj1              0x00000001               1          verbose2
  meatobj2              0x00000002               2          verbose2
  meatobj3              0x00000004               4          verbose2
  meatobj4              0x00000008               8          verbose2
  meatcorpse1           0x00000010              16          verbose2
  meatcorpse2           0x00000020              32          verbose2
  mpickgold             0x00000040              64          verbose2
  mpickstuff            0x00000080             128          verbose2
  setmangry             0x00000100             256          verbose2
  mb_trapped            0x00000200             512          verbose2
  m_move1               0x00000400            1024          verbose2
  m_move2               0x00000800            2048          verbose2
  m_move3               0x00001000            4096          verbose2
  m_move4               0x00002000            8192          verbose2
  m_move5               0x00004000           16384          verbose2
  thitu1                0x00008000           32768          verbose2
  thitu2                0x00010000           65536          verbose2
  m_throw               0x00020000          131072          verbose2
  handler_menustyle     0x00040000          262144          verbose2
  handler_autounlock    0x00080000          524288          verbose2
  handler_msg_window    0x00100000         1048576          verbose2
  handler_whatis_coord1 0x00200000         2097152          verbose2
  handler_whatis_coord2 0x00400000         4194304          verbose2
  dolook                0x00800000         8388608          verbose2
  describe_decor1       0x01000000        16777216          verbose2
  describe_decor2       0x02000000        33554432          verbose2
  loot_mon              0x04000000        67108864          verbose2
  dotip                 0x08000000       134217728          verbose2
  polymon               0x10000000       268435456          verbose2
  teleds                0x20000000       536870912          verbose2
  level_tele            0x40000000      1073741824          verbose2
  ghost_from_bottle     0x00000001               1          verbose3
  dodip1                0x00000002               2          verbose3
  dodip2                0x00000004               4          verbose3
  dodip3                0x00000008               8          verbose3
  intemple              0x00000010              16          verbose3
  doread1               0x00000020              32          verbose3
  doread2               0x00000040              64          verbose3
  doread3               0x00000080             128          verbose3
  doread4               0x00000100             256          verbose3
  doread5               0x00000200             512          verbose3
  doread6               0x00000400            1024          verbose3
  doread7               0x00000800            2048          verbose3
  drop_boulder_on_player0x00001000            4096          verbose3
  do_genocide           0x00002000            8192          verbose3
  call_kops1            0x00004000           16384          verbose3
  call_kops2            0x00008000           32768          verbose3
  call_kops3            0x00010000           65536          verbose3
  erode_obj1            0x00020000          131072          verbose3
  erode_obj2            0x00040000          262144          verbose3
  erode_obj3            0x00080000          524288          verbose3
  trapeffect_rocktrap   0x00100000         1048576          verbose3
  climb_pit             0x00200000         2097152          verbose3
  drown                 0x00400000         4194304          verbose3
  mon_adjust_speed      0x00800000         8388608          verbose3
  hit                   0x01000000        16777216          verbose3
  miss                  0x02000000        33554432          verbose3
  makewish              0x04000000        67108864          verbose3
  prinv                 0x08000000       134217728          verbose3
  do_attack             0x00000001               1          verbose4
  known_hitum           0x00000002               2          verbose4
  hmon_hitmon1          0x00000004               4          verbose4
  hmon_hitmon2          0x00000008               8          verbose4
  mhitm_ad_tlpt         0x00000010              16          verbose4
  mhitm_ad_wrap1        0x00000020              32          verbose4
  mhitm_ad_wrap2        0x00000040              64          verbose4
  mhitm_ad_dgst         0x00000080             128          verbose4
  damageum              0x00000100             256          verbose4
  missum                0x00000200             512          verbose4
  hmonas1               0x00000400            1024          verbose4
  hmonas2               0x00000800            2048          verbose4
  hmonas3               0x00001000            4096          verbose4
  hmonas4               0x00002000            8192          verbose4
  passive               0x00004000           16384          verbose4
  flash_hits_mon        0x00008000           32768          verbose4
2022-06-19 21:02:50 -04:00
nhmall
95a39d0b71 granular verbose message suppression mechanics updated
update the macro definition

[re-do full commit message due to errors in last one]

Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

flags.verbose = 0
is still a master suppression of all the verbose messages.

flags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).
2022-06-09 15:16:28 -04:00
nhmall
be76727265 granular verbose message suppression mechanics
Switch to using a macro invocation Verbos(n, s) in place of the
flags.verbose checks.

Provide the mechanics for individual suppression of any of the
existing messages that were considered verbose.

Mechanics only - this code update does not provide any means of
setting the suppression bits.

iflags.verbose = 0
is still a master suppression of all the verbose messages.

iflags.verbose = 1
turns on the verbose messages only for those whose suppression
bit is 0 (not set).
2022-06-09 13:53:20 -04:00
nhmall
4a8deefaa3 replace leading tabs in several more files 2022-05-30 12:38:22 -04:00
nhmall
9e6ac144b4 switch to using a flag parameter on newcham() 2022-05-28 19:35:48 -04:00
PatR
2ef0291d15 context-sensitive inventory item-action split
When picking an item from inventory and then picking 'I - adjust
inventory by splitting this stack' in the item-action menu,
yn_function("Split off how many?") is used to start getting the
count without needing to wait for <return>.  It includes the response
in message history (so review of history will see that first digit).
The code then uses get_count() to obtain any additional digits.  Tell
the latter to store "Count: N" in message history if N is different
from the first digit.

That's not as good as updating message history to replace the entry
showing the prompt with the first digit with one that shows the full
count but at least it's accurate when the count is 10 or more.
2022-05-18 01:17:14 -07:00
nhmall
cb0c21e91d ENHANCED_SYMBOLS
A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c
2022-05-07 10:25:13 -04:00
PatR
d1217b9f25 add glyphs+tiles for door+chest traps
When trap detection finds trapped doors and trapped chests, it shows
those as bear traps.  When the hero comes within view, they revert to
normal and the detected trap is forgotten.  This doesn't change that,
it is just groundwork to be able to show them distinctly.  Like the
TT_BEARTRAP patch, it increments EDITLEVEL so this seemed like a good
time to put the groudwork in place.

There shouldn't be any visible changes even though internal glyph and
tile values have been renumbered after inserting two new entries.
Adding traps after S_vibrating_square was quite a hassle and suffered
though a couple of off-by-one errors that weren't trivial to find and
fix.
2022-04-27 11:22:12 -07:00
PatR
a9a9d19038 item-action 'I' - use #adjust to split a stack
More context-sensitive inventory support.  While examining inventory,
if you pick an item other than gold and it has a quantity of more
than 1, "I - Adjust inventory by splitting this stack" will be one
of the menu choices.

Breaking doorganize() into two parts was much easier than expected,
but the new internal command added to be an alternate for the first
part had more niggling details than anticipated.

Message history only shows the first digit with "Split off how many?"
if the player enters more than that.
2022-04-20 13:38:09 -07:00
PatR
feac8c8f68 'm' prefix for drinking and dipping
Allow the player to precede q/#quaff or M-d/#dip with the 'm' prefix
to skip asking about fountains, sinks, or pools if one of those
happens to be present, similar to how using it for e/#eat skips food
on the floor and goes straight to inventory.

If you use it and don't have any potions, you'll get "you don't have
anything to drink" or "you don't have anything to dip into", same as
when there is no suitable dungeon feature present combined with no
potions.  However, if an applicable dungeon feature is present and
you don't use the prefix but answer 'no' to drink from fountain,&c
and you don't have any potions, "else" will be inserted into the
message: "you don't have anything else to drink".

A big part of the diff is just a change in indentation level for
code that is now inside 'if (!iflags.menu_requested) {' ... '}'.
2022-04-13 03:14:39 -07:00
PatR
f0c7394968 git issue #717 - avoid putting monsters on scare \
monster and Elbereth unless there's no other choice.

Suggested by NetSysFire, don't create new monsters on top of scrolls
of scare monster.  Not mentioned in the suggestion:  unless they are
a type of monster that isn't affected by such scrolls.  This extends
it to teleport destination too.

Avoid placing a monster on a scroll of scare monster or on engraved
Elbereth if there are other locations available.  Only performed for
callers of goodpos() who explicitly request it, which at the moment
are makemon(), rloc(), and enexto().

Also, propagate 'mmflags_nht' to a bunch of places that were left
using long or unsigned for makemon() and goodpos() flags.  I didn't
attempt to be systematic about that though.

Implements #717
2022-04-01 05:09:58 -07:00
nhkeni
fc5e991b06 Add typedef mmflags_t to assure enough bits for all MM_* flags. 2022-03-17 17:14:12 -04:00
nhkeni
e51026aee1 LIMIT_TO_RANGE_INT macro and various casts. 2022-03-16 17:59:23 -04:00
PatR
77dc522a62 artifact tracking again
Redo the recent artifact creation stuff by replacing several nearly
identical routines with one more general one.  Also adds a tracking
bit for one or two more creation methods.  That changed artiexist[]
from an array of structs holding 8 or less bits to one holding 9, so
bump EDITLEVEL in case the total size changed.
2022-03-12 17:25:54 -08:00
PatR
d37fa4138a found_artifact() groundwork
Lay groundwork for generating a log event when finding an artifact
on the floor or carried by a monster.  This part should not produce
any change in behavior.

Move g.artidisco[] and g.artiexist[] out of the instance_globals
struct back to local within artifact.c.  They are both initialized
at the start of a game (and only used in that file) so don't need
to be part of any bulk reinitialization if restart-instead-of-exit
ever gets implemented.

Convert artiexist[] from an array of booleans to an array of structs
containing a pair of bitfields.  artiexist[].exists is a direct
replacement for the boolean; artiexist[].found is new but not put to
any significant use yet.  If will be used to suppress the future
found-an-artifact event for cases where a more specific event (like
crowning or divine gift as #offer reward) is already produced.

Remove g.via_naming altogether and add an extra argument to oname()
calls to replace it.

Add an extra argument to artifact_exists() calls.
2022-03-07 02:06:55 -08:00
Pasi Kallinen
7523623d95 Make m_move return defines instead of magic numbers 2022-02-26 17:40:17 +02:00
PatR
ab2bcf4dac trap followup
Make the flags argument to dotrap() and mintrap() and the constants
passed to them all have consistent type: unsigned int.
2022-02-24 12:17:21 -08:00
Pasi Kallinen
0c20bf116c Moving a monster with telekinesis hurles it through the air
... and at the end of the flight, it can't avoid a trap, if it
lands on one.
2022-02-24 19:27:59 +02:00
Pasi Kallinen
2777f45bd5 Get rid of force_mintrap, allow passing flags to mintrap
It uses the same flags as dotrap, so simulate force_mintrap
by passing FORCETRAP flag.
2022-02-24 17:13:23 +02:00
Michael Meyer
1e951db9bc Fix: monster hurtling and liquid
A monster hurtling over liquid would drown immediately the instant it
touched the first square of water, even if normally it would have kept
moving (e.g. hurtling over a short moat).  Additionally, its placement
on liquid would not take into consideration other monsters, so it could
overwrite an existing monster on that spot and lead to an impossible,
and/or two monsters occupying a single position.

Fix these issues, so that liquid effects like drowning only happen if
the monster ends up in liquid at the end of the hurtle, and so that
other monsters in the way will stop it early even if they're floating
over or swimming on a pool/water/lava square.

Also use canspotmon instead of canseemon for the wiztelekinesis debug
command.
2022-02-24 14:53:48 +02:00
Pasi Kallinen
c434236f1e Allow creating unhidden traps in special levels
des.trap({ type = "rust", seen = true });
2022-02-19 12:38:28 +02:00
Pasi Kallinen
953a534cc5 Fix fire auto-swapweaponing to polearm
When you have a polearm as secondary weapon, have a fireassist on,
and press 'f' to fire, the code tries to swapweapon to the polearm.
This failed badly and got stuck in a loop if you were also wearing
a shield - as polearms are two-handed and shield prevents wielding
those.

Add a new "command failed" result, and clear the command queue
in that case. Also make swapweapon and wield actually return
the ECMD flags back to the rhack loop.
2022-02-17 09:12:07 +02:00
PatR
50d8463b71 <Mon> suddenly appears! vs ^G
For ^G, throttle the monster creation feedback.  Don't say "suddenly"
and don't exclaim the message, just say "<Mon> appears."  Also, use
Norep() so creating lots of similar monsters at once only gives a few
messages (just one unless varied by "next to you" vs "nearby" vs no
qualifier for farther away).  And for mimics created as objects or
furniture, report the sudden appearance of new object or furniture.
2022-02-07 15:55:04 -08:00