Commit Graph

2152 Commits

Author SHA1 Message Date
PatR
b37b9f25ce mention_decor vs Underwater or drowning escape
Avoid redundant
|You are on solid land again.
|You are back on floor.
when walking or teleporting out of water with the mention_decor option on.
2020-04-03 10:41:30 -07:00
PatR
a2338e92aa groundwork: u.uinwater manipulation
Toggle u.uinwater on or off in just one place.
2020-04-03 01:04:27 -07:00
Pasi Kallinen
5f9714bf92 Remove workarounds for ancient compilers 2020-04-03 08:21:08 +03:00
Pasi Kallinen
2f64f419ad Unify checking if monster is ok in poison gas 2020-04-02 20:53:08 +03:00
PatR
689c3e67fe restore 'use_inverse' option
'use_inverse' used to be unconditionally present but conditionally
had default value True for WIN32 and False for others.  The options
changes that moved things to optlist.h made it present for WIN32 and
absent for others.  Put it back, and change the default value to be
unconditionally True.
2020-04-01 14:58:40 -07:00
PatR
3eed500886 fix #K669 - 'nasty' monster summoning
Report complained about multiple Archons causing his character to
be swarmed by monsters on the Plane of Fire.  I don't think that
the behavior has changed significantly from how it worked in 3.4.3.
Nobody can summon an Archon directly because they're excluded from
the nasties[] list.  But whenever summoning picks a genocided
'nasty', the result gets replaced by random monster of appropriate
difficulty for the level (which could be an Archon for a high level
character in the endgame).  [Note that that won't pick an Archon
in Gehennom or at arch-lich outside of there because the random
monster creation honors the only-in-hell and never-in-hell flags;
picking from the nasties[] list doesn't.]

This prevents that for any creature (except arch-lich or the Wizard)
casting the summon nasties spell.  If a replacement creature is a
spellcaster it now has to have lower difficulty than the summoner.
If not, it will be discarded even though its difficulty is classified
as appropriate.  So to summon an Archon, the summoner has to have
higher difficulty than an Archon; arch-lich and the Wizard are the
only ones meeting that criterium.  When summoner is an arch-lich,
it can't summon another arch-lich (since that wouldn't have lower
difficulty than the summoner) and can summon (via replacement for
genocided type, and only if outside of Gehennom) at most one Archon.
When summoner is the Wizard, he could summon an arch-lich (when in
Gehennom; demoted to master lich elsewhere--see below) or an Archon
(outside Gehennom only), but at most one per summoning.

For post-Wizard harassment, which effectively has infinite
difficulty level, it could still happen.  However, each instance of
harassment is only allowed to create at most one Archon or arch-lich
now, so chain summoning should be lessoned.  Also if it tries to
pick an arch-lich when outside of Gehennom it will switch to master
lich instead (which won't be allowed to summon an Archon or an arch-
lich or even another master lich).

(The monmove.c bit is unrelated, just some comment formatting that
I had laying around that got mixed in.)
2020-03-27 19:05:52 -07:00
PatR
0ac3329289 reformat monflag.h
I started out fixing some strangeness near the very bottom then
ended up redoing the whole thing.
2020-03-27 17:47:07 -07:00
PatR
40d19525c3 updating 'time' status
Handling botl updates for 'time' was inconsistent.  Set the flag to
do that when moves is incremented (where the update is suppressed if
running) or when running stops short.

losehp() would cancel running/traveling if called when in normal form
but not if called when polymorphed, so theoretically you could take
damage and keep on running.  I don't have a test case to verify that.
2020-03-16 17:32:12 -07:00
Pasi Kallinen
408321b4f7 Use TAINT_AGE for old corpses instead of hardcoded value 2020-03-16 11:28:09 +02:00
Pasi Kallinen
04c59fff0a Major amnesia revamp
Instead of forgetting maps and objects, make amnesia forget skills.
Forgetting maps and objects could be circumvented with taking notes,
or by using an external tool to remember the forgotten levels.

Forgetting skills allows the player to optionally go down another
skill path, if they trained the wrong weapon in the early game.

Amnesia still forgets spells.

As a replacement for the deja vu messages when entering a forgotten
level, those messages will now indicate a ghost with your own name
existing on the level, given only when the level is entered for
the first time.

These changes based on fiqhack, with some adjustments.
2020-03-15 11:57:34 +02:00
PatR
3cd9d1afd8 X11 status overhaul
I started out adding a few new status conditions to X11's "fancy status"
(the default) to gauge how difficult it was going to be.  In the process
I found several latent bugs.  After fixing those, I decided that the same
status conditions should be added to the alternate "tty-style status".
Lots more latent bugs, some of the same nature, others different.  Things
spiraled until the code change is very substantial.

Code for the old two-line status is still present but I don't know how
to activate it.  Unlike tty-style status, it composes and displays two
lines of text and isn't capable of highlighting portions of that text,
so it would be considered deprecated anyway.

All testing was done with the default NetHack.ad (except when turning
'fancy_status' off) so I don't know whether the new code might override
previously customizable status settings.  I'm not sure whether this list
covers all the fixes....

both tty-style and fancy
  add new status conditions 'grabbed' (by eel), 'held', 'trapped', and
    'sinking-into-lava' (others will eventually follow); grab and lava
    are on by default, the others have to be enabled via options

both tty-style (not handled) and fancy (faulty boolean logic)
  polymorphing didn't change Xp to HD (silver lining: rehumanizing
    didn't need to reverse it)

tty-style only; fancy was ok
  force white text (on black background) instead of settling for gray
  turning on optional showexp, showscore, and/or time worked but turning
    them back off again didn't remove the relevant fields
  polymorphing when showexp was on didn't suppress Exp-points

tty-style only; fancy uses different layout
  condense conditions into simple left-to-right space separated list
    instead of giving them specific locations and having gaps of blank
    space for conditions that aren't in effect

tty-style only; not applicable for fancy (status_hilites not implemented)
  all highlights stuck if 'statushilites' was reset to 0 to disable them
  displaying anything with bold attribute stuck; it wouldn't revert to
    normal text if a different highlight rule without bold was used for
    subsequent updates
  avoid inverting leading space that separates from preceding field when
    highlighting with inverse video attribute
  add support for 'dim' attribute using gray foreground (only viable
    after the fix for white foreground)

fancy only
  reorganize the field layout so that things line up nicely instead of
    having columns with six, seven, or eight lines be spread over same
    amount of vertical space
  line up the values of the six characteristics, similar to how vertical
    status works in curses: all two digits; when exceptional strength is
    present, the '18' lines up and rest goes past implicit right margin
  use status conditions as provided by core instead of duplicating them
    (other fields still duplicate stuff done in botl.c); doing this
    required forcing 'VIA_WINDOWPORT()' if built without STATUS_HILITES
2020-03-14 03:47:27 -07:00
nhmall
5c3670b1f0 msdos build fix
../include/optlist.h:510:62: error: macro "NHOPTC" requires 10 arguments, but only 9 given
                 "color mappings for internal screen routines")
                                                              ^

../include/optlist.h:562:52: error: macro "NHOPTP" requires 10 arguments, but only 9 given
                 "prefix for old micro IBM_ options")
                                                    ^
2020-03-13 10:48:17 -04:00
Pasi Kallinen
2ff8523481 Fix priest generated inside temple wall
In a rare case, a random room's width can be 2 tiles, and if
that room was converted into a temple, the priest ended up
inside the wall. Try to put the priest on a random valid position
around the altar, or on it.
2020-03-12 19:17:06 +02:00
Pasi Kallinen
f18b5bb59b Make special levels generate objects with genocided monster classes
If a special level explicitly requests eg. a statue with a genocided
monster class, allow generating it.

Rationale is that those objects were generated before the monsters
became extinct. Also fixes a lua error.
2020-03-08 14:08:32 +02:00
Pasi Kallinen
f5d9324f28 Fix wizmakemap to consider monster birth counts and uniques
Also add a new wizmode command #wizborn to show those.
2020-03-07 21:35:26 +02:00
PatR
2a37fe5a3b remove mhitm.c's 'otmp'
Get rid of a couple of variables that were file scope and then
incorporated into 'g'.  This should prevent the situation where
attacking a shade gave bogus feedback about glorkum although I
never did reproduce that.

This eliminates g.otmp and g.dieroll but leaves a couple of others.
g.vis really should go away....
2020-03-07 11:20:45 -08:00
nhmall
2af37f44d4 Merge March 2020 changes into NetHack 3.7 2020-03-06 10:59:50 -05:00
nhmall
e20024e42b March 2020 updates 2020-03-06 10:31:51 -05:00
nhmall
abdd3254ae updates for 3.6 March 2020 2020-03-04 10:41:57 -05:00
Pasi Kallinen
c9b21e36a7 Add lua selection match method
Also improve the replace_terrain command parameters.
2020-03-02 16:17:53 +02:00
nhmall
058fbc1cd5 more duplicate detect; also copy-and-paste for vt_tiledata entry left it enabled by default 2020-03-01 10:48:46 -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
2f1be94bfa since sole argument to set_duplicate_opt_detection was unused, eliminate it altogether 2020-02-29 18:47:34 -05:00
nhmall
5d310d815d options follow-up: fix up duplicate_option_detection and !pet 2020-02-29 17:54:41 -05:00
nhmall
cca2bcaa84 minor flavor bit of the day 2020-02-29 13:57:31 -05:00
nhmall
d609314d64 transpose error in comments bit 2020-02-26 15:03:58 -05:00
nhmall
1115402c14 Merge branch 'options-overhaul' into NetHack-3.7 2020-02-26 14:36:20 -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
PatR
cff63b5b4c fix curses' create_nhmenu() warning
The extra flags argument to create_nhmenu() wasn't propagated to
anywhere useful.  It still doesn't do anything yet.
2020-02-25 16:18:58 -08: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
194b174bbc flipping current level with #wizlevelflip
Give wizard mode player control over how a level gets transposed by
prompting for the desired outcome.

Refreshing the screen showed that remembered, no longer in view wall
corners and T walls were shown with their old orientation instead of
being transposed along with the level.  This fixes that, but does so
by adding a chunk of code that will be irrelevant for normal play.
2020-02-24 17:07:01 -08:00
Pasi Kallinen
509576a8b7 Minor tweaks to level flipping 2020-02-23 15:06:44 +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
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
86f5e73ef3 ensure condition menu always starts the same way even under "play again" 2020-02-20 20:36:37 -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
cfd425d5db Wounded_legs condition
Mounting a steed while legs are wounded would offer to cure them
but wasn't going through the heal_legs() routine so didn't update
the status line when Wounded_legs condition is enabled.

Move some common code for describing left/right/both legs into a
new routine used for feedback by jumping, kicking, and ridiing.

For ^X, distinguish between one wounded leg and both but don't
bother with left vs right when it is just one.
2020-02-19 15:47:55 -08:00
PatR
8659dcd7bc monster sound changes
MS_MOO was placed among the humanoid sounds, resulting in a minotaur
being able to articulate "I'm hungry".  Move it to the animal sounds,
which causes almost all the sounds to be renumbered.

Give MS_MOO to rothes.

Change mumak from MS_ROAR to new sound MS_TRUMPET and mastodon from
silent to that.

I changed MS_ORC from a synonym for MS_GRUNT into a distinct type
which also just grunts.  Grunt is in the animal group of sounds and
orc is now in the 'other' group (neither animal nor understandable
humanoid).  [There are a bunch of other humanoid monsters (gnomes and
ogres, for example) that still use MS_GRUNT.  They aren't animals so
that's not right.]

Have pets who beg for food but happen to have 'other' sounds between
animal and humanoid be described as looking hungry instead of being
skipped.

Hat tipped to a peaceful humanoid will behave as non-peaceful if
Conflict is active (without giving the monster a resistance check).

Despite mons[].msound getting new values, save files should be ok.
2020-02-18 13:33:00 -08: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
PatR
3981e3e6e5 controlling u.ustuck
Setting or clearing u.ustuck now requires that context.botl be set,
so make a new routine to take care of both instead of manipulating
that pointer directly.
2020-02-16 13:04:12 -08:00
nhmall
751f1f47ab Windows options dynamically
There are two executables int the windows binary, each of which
have different options and capabilities. Sharing of one dat/options
file hasn't really been an accurate approach.

Produce that information dynamically for the Windows exe files.

This impacts alt-v results.
2020-02-13 21:24:24 -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
nhmall
a213811975 stone/unexplored glyph follow-up
typo
2020-02-13 17:37:55 -05:00
PatR
75e9055b89 plug a couple of memory leaks in sp_lev.c, take II
[...]
| Change selection_free(foo) to also free(foo) after freeing foo's
| fields.  Every use was already
|   selection_free(foo);
|   free(foo);
| except for the two instances of memory leak.

And except for the three which aren't in sp_lev.c, one of which was
dealing with memory managed by Lua.  This time it seems to be working
as intended.
2020-02-12 18:56:41 -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
nhmall
1566063b4c bump editlevel
the code in pr298 altered the sound bit for one existing monster
2020-02-10 22:12:38 -05:00