Commit Graph

3627 Commits

Author SHA1 Message Date
Pasi Kallinen
a6dfbfca2f Lua: Add contents function to room and map
The function will get the map/room width and height as a parameter.
2020-03-04 20:05:15 +02:00
PatR
12c2f84f64 corpse_xname() fix
Potential write out of bounds, in front of the block of obufs.
Not exploitable but could conceivably trigger a crash.
2020-03-04 01:58:22 -08:00
PatR
cb18f60331 match_str2clr() fix
Integrity fix.  Make sure color values obtained via atoi() are sane
so that use as array indices can't go out of bounds.
2020-03-03 16:46:04 -08:00
PatR
4b78763d70 Mister Fantastic's sea monster form
While polymorphed and underwater, an eel bite killed the hero who
rehumaized and crawled out of the water, then the eel continued with
its second attack and "wrapped itself around you" even though no
longer adjacent.  That's a long reach....

| ...@.
| .;}..
| .}}..

Make any additional attacks silently miss if hero changes location
during the attack sequence of a monster who has pinpointed the hero.
2020-03-02 15:58:42 -08:00
Pasi Kallinen
00be8be45a Start of lua api docs
... in asciidoc format. Use "asciidoctor -b html5 lua.adoc"
to generate the HTML version.
2020-03-02 18:10:35 +02:00
PatR
ffcd471ef7 fix github issue #309 - random role segfault
Role selection is insanely complex.  I had to use a debugger to force
the relevant routine to be executed.

The analysis was correct:  it could use rn2(14) to pick a role (valid
values 0 through 12) and randomly getting 13 would lead to a crash.

The terminating element of roles[] passes all the ok_role(), ok_race(),
etc tests.  Explicitly exclude that element when collecting the roles
to choose from.
2020-03-01 14:36:28 -08:00
nhmall
0f3719d15e typos in doc/options.doc 2020-03-01 11:04:02 -05:00
PatR
99035e72ee throw-and-return vs !fixinv
Implement the request that a wielded+thrown aklys be given the same
inventory letter when it returns and is caught and rewielded, even for
the !fixinv setting where inventory letters don't stick.  Works for
Valkyrie-thrown Mjollnir and returning (ie, didn't hit) boomerangs as
well as for aklys.

I'm not sure how useful this really is, because on the rare occasions
that it either doesn't return or fails to be caught, it won't be given
the same letter when subsequently picked up.  So the player who relies
on it will still be vulnerable to using the wrong letter next time a
throw is attempted.  But at least picking it up explicitly displays
the new inventory letter, unlike catching it upon return.
2020-03-01 06:46:37 -08:00
nhmall
9f01b33d9f fixes entry
This issue was present prior to the options overhaul; a fix
was embedded in the options overhaul code changes
2020-02-26 15:45:04 -05:00
nhmall
21ae547dec typo in fixes 2020-02-26 15:30:10 -05:00
nhmall
1115402c14 Merge branch 'options-overhaul' into NetHack-3.7 2020-02-26 14:36:20 -05:00
nhmall
64e3cd72a4 fixes37.0 update for options overhaul 2020-02-26 14:32:07 -05:00
nhmall
96a559e392 fix the menu_* options which had valok set to No 2020-02-26 14:23:26 -05:00
Pasi Kallinen
d86b7e8e7c Demon lords and princes suppress teleporting in Gehennom
Instead of having the demon lair levels unconditionally no-teleport,
grant demon lords and princes the ability to suppress teleportation
in Gehennom on the level they are on.
2020-02-26 20:03:00 +02:00
nhmall
68fdc3bbcb February 2020 options.c overhaul
combine boolean and compound options into a single allopt[] array for
processing in options.c.

move the definitions of the options into new include/optlist.h file which
uses a set of macros to define them appropriately.

during compile of options.c each option described in include/optlist.h:
   1. automatically results in a function prototype for an optfn called
      optfn_xxxx (xxxx is the option name).
   2. automatically results in an opt_xxxx enum value for referencing
      its index throughout options.c (xxxx is the option name).
   3. is used to initialize an element of the allopt[] array at index
      opt_xxxx (xxxx is the option name) based on the settings in the
      NHOPTB, NHOPTC, NHOPTP macros. Those macros only live during the
      compilation of include/optlist.h.

each optfn_xxxx() function can be called with a req id of: do_init, do_set,
get_val or do_handler.

req do_init is called from options_init, and if initialization or memory
allocation or other initialization for that particular option is needed,
it can be done in response to the init req.

req do_set is called from parseoptions() for each option it encounters
and the optfn_xxxx() function is expected to react and set the option
based on the string values that parseoptions() passes to it.

req get_val expects each optfn_xxxx() function to write the current
option value into the buffer it is passed.

req do_handler is called during doset() operations in response to player
selections most likely from the 'O' option-setting menu, but only if the
option is identified as having do_handler support in the allopts[]
'has_handler' boolean flag. Not every optfn_xxxx() does.

function special_handling() is eliminated. It's code has been redistributed
to individual handler functions for the option or purpose that they serve.

moved reglyph_darkroom() function from options.c to display.c
2020-02-26 00:24:37 -05:00
Pasi Kallinen
ccb00f59bc Add new level init type, swamp
Creates a "relaxed blockwise maze".
Make Juiblex's swamp use it.
2020-02-25 19:24:58 +02:00
PatR
cbdda9dc9d adopt github pull request #286 - rndmonst()
Eliminate the cache that was supporting rndmonst() and pick a random
monster in a single pass through mons[] via "weighted reservoir
sampling", a term I'm not familiar with.

It had a couple of bugs:  if the first monster examined happened to
be given a weighting of 0, rn2() would divide by 0.  I didn't try
to figure out how to trigger that.  But the second one was easy to
trigger:  if all eligible monsters were extinct or genocided, it
would issue a warning even though the situation isn't impossible.

Aside from fixing those, the rest is mostly as-is.  I included a bit
of formatting in decl.c, moved some declarations to not require C99,
and changed a couple of macros to not hide and duplicate a call to
level_difficulty().

Fixes #286
2020-02-22 17:40:55 -08:00
PatR
29321c6f80 fix github issue #302 - divide by 0 crash
The traceback points directly to the problem:  divide by 0 happens
if the 'bogusmon' file only contains the "do not edit" line, which
would happen if 'bogusmon.txt' is empty.  makedefs probably ought to
complain about that.

There is now one hardcoded bogus monster to fall back to:  'bogon'.

Random tombstone epitaphs report divide by 0 if their text source is
empty, but it is done by rn2() rather than rn2_for_display_rng() so
is just a warning for pre-release code.  It would crash for release
version though.

I tried placing an empty engravings file and expected similar results
but didn't see any response.  Not sure what that means.

After the fix, empty epitaph file yields blank result so graves that
want a random epitaph won't have any epitaph.

Fixes #302
2020-02-22 01:41:04 -08:00
PatR
9366307210 extra ^X info (mon's location) for u.ustuck 2020-02-21 13:46:03 -08:00
Pasi Kallinen
88aa0793dc Allow flipping levels horizontally or vertically
When a special level is created, there's a chance it gets flipped
horizontally and/or vertically.

Add new level flags "noflip", "noflipx", and "noflipy" to prevent
flipping the level. Add a wiz-mode command #wizlevelflip to test
the flipping on current level - although this doesn't flip everything,
as level flipping is meant to happen during level creation.
2020-02-21 18:16:14 +02:00
nhmall
67df8dd784 add an entry for the start_menu change to fixes37.0 2020-02-20 20:19:49 -05:00
nhmall
d81c096ce6 window port interface change - add mbehavior flags to start_menu()
Provide a way to communicate additional behaviors and/or appearances
desired from NetHack window port menus.

This is foundation work for changes to follow at a future date.
2020-02-20 20:12:51 -05:00
nhmall
d50c3577e9 some more status condition follow-up
- Don't display 'Held' when swallowed.
- Don't display 'Held' when the hero is doing the holding; add a condition display
  entry "UHold" for that (the opt_in option is "holding")
- Allow resorting of the 'O' menu for status condition fields. Default is alphabetical, but you
  can sort by condition field ranking now.
2020-02-20 01:22:27 -05:00
PatR
814adb41b8 fix #K376 - tipping cap
Allow #tip to do something if you pick your worn helmet instead of
a container.  It's mostly just a variation of #chat but probably adds
several new bugs....
2020-02-18 03:14:22 -08:00
nhmall
f177675cbc Guidebook.txt update from cron-NetHack-3.7 2020-02-17 14:39:24 -05:00
nhmall
73ffb61e7e typo in .tex and replacement of obsolete OS reference 2020-02-17 13:39:04 -05:00
nhmall
f9c9c8262c Guidebook.txt and Files from cron daily 2020-02-16 00:26:43 -05:00
PatR
63c3ec21b8 yet more Guidebook tweaks
A couple of indentation adjustments:  a bit more space for continued
lines in the table for suits of armor, and restore the indentation of
the list of Achievements in the Postscript version (lost when dealing
with the wouldn't-span-page-boundary issue).
2020-02-15 17:44:41 -08:00
PatR
2d150d323b new status conditions
Several conditions result in stale data on the status line when
starting or stopping because things which didn't used to affect it
haven't been setting context.botl to force an update.  This wasn't
systematic; there are bound to be lots more.
2020-02-15 15:41:24 -08:00
PatR
c78a69bc44 Guidebook.dat typo
A typo in Gbk-1pg-sfx.mn resulted in " /" as a "last word" on the
end-of-data marker line of the intermediate 12345 line single page.
That was effectively invisible because it immediately got deleted
during the post-processing which strips off that marker through to
the end (producing a 5266 line single page at present).
2020-02-15 14:42:00 -08:00
PatR
c21921668a fix github issue #293 - raven vs raven
The saying /corvus oculum corvi non eruit/ (Latin) means "a crow
doesn't pluck out the eye of another crow" (roughly).  Something
along the lines of "like-minded people stick together".  Honor the
literal meaning by preventing a raven's blinding attack that gets
directed at another raven from being able to cause blindness.

Fixes #293
2020-02-15 13:55:51 -08:00
PatR
998d8b1fd4 more Guidebook tweaks
Add a missing word to Guidebook.tex and add a couple of new sentences
to both Guidebook.{mn,tex}.

Also, add Guidebook.dat to .gitignore.
2020-02-15 13:08:34 -08:00
nhmall
f37dd40110 Guidebook date bump and .txt sync 2020-02-15 13:24:48 -05:00
PatR
5c2c517c35 Guidebook.tex catch up 2020-02-15 05:45:27 -08:00
PatR
4bd3fdbd57 Achievements documentation
> Todo:  redo the recently revised Achievements table again.  Current
> formatting isn't spanning page boundaries, resulting in a big chunk
> of blank space preceding it so that it will start on the next page.

The '.SD i' environment was causing this, and also changing the font
somehow when forcing the text to start on the next page (but not when
it fit on current page?).  Taking '.SD i' out loses the indentation
that Guidebook.ps had (one of the explicit differences between it and
Guidebook.txt), which looks a little inferior, but fixes the page
boundary issue.
2020-02-15 05:19:23 -08:00
PatR
91b569e6c4 Guidebook.dat, one-page edition of Guidebook.txt
Update sys/unix/Makefile.doc to be able to build Guidebook.dat, an
unpaginated copy of the plain text Guidebook.  It's generated from
the 'roff source rather than by attempting to post-process the
regular text Guidebook.

No doubt there are easier ways to do this.
2020-02-14 18:15:25 -08:00
PatR
eb919d3cdb fix #K355 - grammar issues with monster+container
Mon rummages in <container> and Mon takes <item> from <container>
was missing an() for the container itself and should have been
using doname() rather than xname() for any items taken out (when
done adjacent to hero).
2020-02-14 16:24:49 -08:00
PatR
629e417bba Guidebook update
This adds a new figure that shows the 3-line status.  Also expands
a couple of status items.

In the commands section, redo the hjkl direction diagram to make
"Figure 2" (now Figure 3) line up with the rest of the table.  Lot's
of trial and error involved, and the plain text version didn't come
out as expected (but still looks better than before).

Modify suit of armor table to wrap an additional line and make the
table narrower.  Having the pair of columns closer together is a bit
easier on eyes when tracking from the suit names to the AC number.

Todo:  redo the recently revised Achievements table again.  Current
formatting isn't spanning page boundaries, resulting in a big chunk
of blank space preceding it so that it will start on the next page.
(Only noticeable at the moment with the Postscript output; plain
text had enough room on its current page to not need to force next.)

Guidebook.tex is lagging again.
2020-02-14 15:28:28 -08:00
nhmall
334db31cd0 Guidebook update from latest cron-daily 2020-02-13 22:10:37 -05:00
PatR
cbe27c7702 unseen pet drowning
The "you have a sad feeling for a moment" message was only given when
one monster kills another (and the latter is an unseen pet).  Give it
for drowning too.  There are probably a bunch of other circumstances
which warrant it as well but I've settled for handling minliquid().
2020-02-13 15:38:59 -08:00
PatR
914c78546f Guidebook spelling mistake 2020-02-12 16:22:33 -08:00
PatR
804499d9be add some new, easier achievements
Introduce eight achievements that can be attained by more players.
 Entered Gnomish Mines  - self explanatory
 Entered Mine Town      - the town portion, not just the level
 Entered a shop         - any tended shop on any level
 Entered a temple       - likewise for temple
 Consulted the Oracle   - bought at least one major or minor oracle
 Read a Discworld Novel - read at least one passage
 Entered Sokoban        - like mines
 Entered the Big Room   - not always possible since not always present

The novel and bigroom ones aren't always achieveable since novels are
only guaranteed if a book or scroll shop gets created and bigroom is
only guaranteed in wizard mode.  No one ever claimed that every
possible achievement can be attained in a single game.  (If one for
entering the Fort Ludios level--or perhaps entering the Fort itself--
eventually gets add, that won't be possible in every game either.)

The mine town one probably needs some tweaking.  Two of the town's
seven variants have no town boundary (despite a rectangular area of
pre-defined map) and at present simply arriving on either of those
levels is enough to be credited with the entered-town achievement.

Bump EDITLEVEL because u.uachieved[] has increased in size.  This
time it has been expanded to the maximum that xlogfile's bitmask of
achievements can handle, enough for up to 9 more achievements without
another EDITLEVEL increment.
2020-02-12 14:35:37 -08:00
PatR
1ec6e6f96b Guidebook.mn streamlining
Set up variable 'fF' once and use it to conditionalize between
fixed-width font Guidebook.txt and proportional-width font
Guidebook.ps instead of making the width comparison of 'f' and 'F'
each time.  There are four instances where it is used; three that
suppress some indentation for the plain text output and one that
manually wraps a couple of long lines for it.

This change shouldn't produce different output from before (last
night) and doesn't need any corresponding change in Guidebook.tex.
2020-02-12 11:43:25 -08:00
PatR
bfe23d0c8c Guidebook update: Achievements
Redo the Achievements section in Guidebook.mn to be more compact.
It's also become more complicated because it formats Guidebook.txt
differently from Guidebook.ps/.pdf.

Finally add the Achievements section to Guidebook.tex to catch up.
Not as complicated but also not tested.
2020-02-12 02:35:35 -08:00
PatR
7da5a8b8e3 Guidebook update: armor and other objects
Condense the clunky one entry per line table of suits of armor and
their AC values in Guidebook.mn.  Guidebook.tex uses a two-column table
that I've left alone.

Mention all the other types of armor instead of leaving out gloves and
shirts.  For armor commands, mention that P and R work.

Rings:  describe their interaction with gloves.  For ring commands,
include a pointer to amulets.

Amulets:  for amulet commands, mention that A, W, and T work.

Tools:  mention that some can be worn and include a pointer to amulets
for the relevant commands.  Also, that some can be wielded as weapons.

Boulders and statues:  boulders can be pushed and smashed, statues can
be smashed.

Gold:  not subject to blessing or cursing.  goldX option affects BUCX
filtering.
2020-02-11 17:21:39 -08:00
nhmall
40bb0b2bb8 update Guidebook.txt from cron-NetHack-3.7 2020-02-11 00:25:27 -05:00
nhmall
b7e0a9a9dc version bit 2020-02-11 00:04:28 -05:00
nhmall
0342a2b029 bump Guidebook date 2020-02-10 23:56:46 -05:00
nhmall
a7122a0656 minor correction to Guidebook.tex 2020-02-10 23:33:34 -05:00
nhmall
4a7cb8d3d7 Merge branch 'chasonr-msdos-video-doc' into NetHack-3.7 2020-02-10 23:26:26 -05:00