Commit Graph

14152 Commits

Author SHA1 Message Date
Michael Meyer
f8ec9dc32e Fix: antigravity trap doors
Trap doors saved their destinations as an absolute level, rather than a
relative one, so if you loaded bones from a special level their
destinations would reflect the dungeon layout from the bones player's
game.  For example, die on the Oracle level, on dlvl5, with a trap door
that goes to dlvl6.  Another player gets those bones on their Oracle
level, which is dlvl8... the trap door would still go to dlvl6.  Pretty
amazing trap door -- something you might see in a funhouse!

Include relative rather than absolute destinations in save and bones
files, much like stairs do, to avoid this problem.

I bumped EDITLEVEL because although this won't break save files in an
obvious way, it will interpret the (absolute) destinations in existing
save and bones files as relative, leading to some crazy long falls. :)
2022-09-22 11:36:47 +03:00
PatR
ecf55926be github pull request #628 - duplicate code
Pull request from argrath nearly a year ago: an 'if' and corresponding
'else' have the same code so there's no point in testing for if/else.

I'm still not convinced that simply removing the if/else is the right
fix here but nothing else is going on.  I've put part of the removed
code back inside '#if 0' in case it needs to be resurrected someday.

Closes #628
2022-09-21 17:02:45 -07:00
SHIRAKATA Kentaro
2a8ddf1145 remove duplicate code
Here, `then` clause and `else` clause is identical.
2022-09-21 17:00:01 -07:00
PatR
f679a537d4 github PR #879 - pets eating shapeshifter corpses
Pull request from entrez:  the check for whether a pet in desperate
straits will eat a corpse that will cause it to polymorph used bad
logic.  The suspect code was added post-3.6.

Fixes #879
2022-09-21 12:07:05 -07:00
nhmall
c92e232a99 update tested versions of Visual Studio 2022-09-21 2022-09-21 14:55:34 -04:00
Michael Meyer
951a99f5e6 Fix: starving herbivore pet vs polymorphing corpse
The special handling of polymorphing corpses included an "is acceptable
food if starving" rule which ignored the pet's other food preferences,
so a starving herbivorous pet would become willing to eat a
non-vegetarian corpse iff the corpse would polymorph it when eaten.
Along the same lines but latent: if there were a vegan polymorphing
corpse, a carnivorous pet would eat it not only if starving, but also if
maltreated and on the verge of becoming feral.

Instead of trying to fix this by reimplementing all the herbi vs carni
rules specifically for polymorphing corpses, just have a "don't eat
polymorphing corpses if neither starving nor almost untame" rule, and
fall back to the normal palatable corpses tests once it's been
determined that the pet is willing to eat even a polymorphing corpse.

I rephrased the comment just to make it negative (about avoiding
polymorph, rather than polymorph being OK under certain circumstances)
to match the new form of the rule.
2022-09-20 17:25:18 -07:00
PatR
169258d608 github PR #858 - feedback when poly'd hero engulfs
Pull request from entrez:  the change to remove digestion damage
from trappers and lurkers above didn't handle engulfing by poly'd
hero adequately.

Fixes #858
2022-09-20 16:59:43 -07:00
Michael Meyer
34aabca74b Describe engulf attacks a bit more consistently
Use verbiage for mon vs mon and hero (mostly hero) engulf attacks that
matches recent changes to monster vs hero engulf attacks more closely
(e.g. "swallows whole" instead of "engulfs" for purple worm, other
changes in b07fe59...).  Also ensure non-AD_DGST engulf attacks
(e.g. from revamped trapper or lurker above polyforms) aren't treated as
"eating" (or as involving "debris").

Also change the enfolds and digests macros so they produce booleans
rather than attack pointers (I got a compiler warning about casting
struct attack * to boolean when I did 'boolean b = digests(ptr);').
2022-09-20 16:54:23 -07:00
PatR
0145a020c1 fixes entry and tweaks for PR #871 - revive corpse
Pull requet from entrez:  give better feedback than "it" when hero
observes a corpse reviving into a monster that can't be seen.

Tweak reviving from a container which was coded as if the container
was optional.  That can lead to confusion when someone reads the
code so make the situation more explicit.

Fixes #871
2022-09-20 14:33:39 -07:00
Michael Meyer
74704c8836 Improve description of invisible mon revival
An invisible monster reviving would be called "it" (as in, "It rises
from the dead!").  Improve on this a bit by instead saying that "the
troll corpse disappears!" (similar to the messaging used when undead
turning is used on an invisible monster's corpse), or calling the
revived monster "something" (as in "something escapes from a sack!")
instead of "it".  Distinguish between the original location of the
corpse and the location of the revived monster when describing seeing
things that have happened to the corpse, since revival may not place it
on the corpse's location.
2022-09-20 13:51:37 -07:00
PatR
b93abcd4bf github #877 - fix "disintegration resistance"
Pull requet from vultur-cadens:  use space instead of hyphen in
enlightenment and end-of-game feedback.

All the other resistances already use space.  The inappropriate
hyphen in "disintegration-resistance" seems to have been present
since enlightenment was added (in 3.0; back then the relevant code
was in cmd.c; current insight.c didn't exist until 3.6).

Fixes #877
2022-09-20 13:24:54 -07:00
vultur-cadens
ce2f3ae259 Use a space instead of a hyphen in "disintegration-resistant"
This is for consistency with the other resistance insight messages,
which use spaces instead of hyphens.
2022-09-20 13:24:11 -07:00
Pasi Kallinen
ccaadaa00e Prevent trapdoors and holes dropping you into Sanctum 2022-09-20 12:07:37 +03:00
PatR
2a0d88823f fixes entry for PR #876 - shop impossible \
when splitting a stack of named, shop-owned objects

Pull request from entrez:  when perm_invent is on, splitting an unpaid
stack would issue impossible "unpaid_cost: object wasn't on any bill"
while cloning the new stack's name from the old stack.

Fixes #876
2022-09-19 19:01:35 -07:00
Michael Meyer
7e96026b44 Fix: impossible from splitting named stack on bill
Trying to split an unpaid stack of named items in a shop, with
perm_invent enabled, would cause an impossible 'unpaid_cost: object
wasn't on any bill' because copy_oextra -> oname triggered an inventory
update while the newly created split stack was marked unpaid but before
the billing information had been split to match.  Defer the copy_oextra
call until the billing info has already been split.
2022-09-19 18:44:42 -07:00
nhmall
8ef9cf85ab remove unused math.h in isaac64.c
Close  #878
2022-09-19 17:32:42 -04:00
PatR
4de71302a3 unix Makefile.src and hints
Change the handling for windowing system specific files so that
when building for more than one set, each gets compiled as a set
instead of some being interspersed among rival window systems.
Put differently, handle tile.o specially so that there's no need
for the hints to sort the WINOBJ list in order to avoid tile.o
duplication.

So the order of compilation is
  common source files
  unix-specific files
  tty files
  curses files
  X11 files
  Qt files
  tile.c (if applicable), version.c, date.c

Previously, some of the X11 files were scattered around among the
others because of the spelling of their file names.

Only matters if you're watching the progress of a build.
2022-09-18 14:25:33 -07:00
Pasi Kallinen
2368c59f69 Knockback requires solid physical hit
Exclude unsolid monsters - air, water, and fire elementals.
2022-09-18 17:56:04 +03:00
Pasi Kallinen
bb3dc379bc Themerooms: Engraving hints the location of buried treasure
Add two new themeroom functions that are called when generating
the level: pre_themerooms_generate and post_themerooms_generate,
calles before and after themerooms_generate.

Allow the buried treasure -themeroom to put down an engraving
anywhere on the level, hinting at the location of the treasure.

des.object contents function now gets the generated object passed
to it as a parameter.
2022-09-18 12:45:16 +03:00
nhmall
2f7b202530 avoid a format-overflow warning
options.c: In function ‘option_help’:
options.c:8820:55: warning: ‘%s’ directive writing up to 255 bytes into a region of size 220 [-Wformat-overflow=]
 8820 |     Sprintf(buf, "Set options as OPTIONS=<options> in %s", configfile);
      |                                                       ^~   ~~~~~~~~~~
2022-09-17 19:29:09 -04:00
nhmall
6151623cce Revert "NEED_VARARGS bit for end.c and files.c"
This reverts commit af71163d99.
2022-09-17 15:58:05 -04:00
nhmall
8df41a6ba2 Revert "NEED_VARARGS followup"
This reverts commit 4d34e153e0.
2022-09-17 15:57:52 -04:00
nhmall
1bd4c3c022 Revert "paste fix"
This reverts commit d1750e4abe.
2022-09-17 15:57:31 -04:00
nhmall
d1750e4abe paste fix 2022-09-17 14:48:02 -04:00
nhmall
4d34e153e0 NEED_VARARGS followup 2022-09-17 14:22:20 -04:00
nhmall
af71163d99 NEED_VARARGS bit for end.c and files.c
avoid build failure in the event that NEED_VARARGS is already defined
on the compiler command line.
2022-09-17 12:31:26 -04:00
PatR
a483482082 Revert "onefile: isaac64.c <math.h> vs yn()"
This reverts commit 94945a719a.
It was too intrusive and can be handled by the 'onefile' script
by compiling isaac64.c before any source file that includes hack.h.
2022-09-16 17:45:31 -07:00
PatR
829aedd923 insults
random_insult[] and random_malediction[] are only used in wizard.c
so make them file-scope static instead of global.
2022-09-16 16:38:44 -07:00
PatR
e4ff874e0b fix issue #875 - contnr-to-contnr tip explosion
Issue reported by k2:  tipping a wand of cancellation, bag of
holding, or bag of tricks from a non-magic container into a bag of
holding causes the bag of holding to explode but it wasn't dealing
out explosion damage nor being logged for livelog/chronicle the way
putting the item directly into a bag of holding is handled.

This fixes the described issues but bones handling leaves a lot to
be desired.

Fixes #875
2022-09-16 16:14:20 -07:00
PatR
a4f7bf2101 tradstdc.h, USE_STDARG
Make USE_STDARG explicitly the default (it was implicitly the default
when NHSTDC is defined) and update some comments related to VA_DECL.
2022-09-16 15:02:23 -07:00
Pasi Kallinen
d4c28b3ab5 Prevent impossible lighting a massive stack of candles 2022-09-16 19:55:49 +03:00
nhmall
a5d462b194 more inconsistencies 2022-09-16 10:44:39 -04:00
nhmall
018a39d2de modernize added old-style function declarator 2022-09-16 00:55:08 -04:00
PatR
2b04cc9f5b fix issue #843 - vampire revival sequencing
Reported by Umbire:
|You kill SpaceMannSpiff!  SpaceMannSpiff puts on a dwarvish cloak.
|SpaceMannSpiff puts on a dwarvish iron helm.
|The seemingly dead SpaceMannSpiff suddenly transforms and rises as
| a Vampire.

This was tough to reproduce but I finally managed it.  The issue
text mentions that it was fixed by copperwater in xNetHack with
commit 8c4af50f0aa3e72522f3eb98df039ff25c2a1ea0 to the repository
for that variant.  My attempt to cherry-pick that failed--I'm not
even sure whether it should have been expected to work--and some of
the code has been impinged upon by changes, so I ended up applying
the contents of that commit manually.

The commit changes how/when monsters put on new armor rather than
anything directly related to vampires.  Circumstances similar to
the example above now yield:
|You kill SpaceMannSpiff!
|The seemingly dead SpaceMannSpiff suddenly transforms and rises as
| a Vampire.
on one turn, then on the next turn the revived vampire produces:
|SpaceMannSpiff puts on a dwarvish cloak.

My test case only had one item of interest; I assume that the second
item of armor gets worn on a subsequent turn rather than at the same
time as the first one.

Fixes #843
2022-09-15 18:02:07 -07:00
PatR
6353bddaf6 obj.h mixup
\#if 0 should have been #if 1.  Swap #then and #else instead.
2022-09-15 14:17:43 -07:00
PatR
aa8f73c890 empty horn of plenty
Format a horn of plenty whose charge count is unknown but is known to
be empty as "empty horn of plenty" like is done for real containers.

This was too easy; I must have missed something....
2022-09-15 14:14:12 -07:00
PatR
5b0f4a2e6d more #tip, mostly container-to-container
Require a free hand when tipping a container into another container.
Presumeably you need to open the destination container and possibly
keep holding it open.

If you try to tip a carried container into an unknown bag of tricks,
apply the bag (once) instead of performing the tip.  (To 'open' the
destination as above.)  Possibly slightly confusing if bag is empty.

When tipping a container, always ask for the destination instead of
doing that only when carrying other containers.  Confirming floor
as destination can be annoying but having to do that sometimes and
skipping that sometimes is aggravating because it is error prone.
And floor is preselected so can be chosen with space or return.
(I wanted to change the selector letter for floor from '-' to '.'
and then keep '-' as an unseen group accelerator, but the latter
doesn't work for PICK_ONE so I've left '-' as-is.)

Don't display "monsters appear" after tipping a bag of tricks.
Monster creation gives feedback these days.  (Comparable to recent
"summon nasties" fix.)
2022-09-15 12:30:44 -07:00
Pasi Kallinen
48bd67a25f Fix CI warning 2022-09-15 18:55:15 +03:00
Pasi Kallinen
3605f18a8e Split themeroom shape from themeroom contents
Previously, the tetris-shaped rooms were always either
normal rooms, or turned into shops or other special rooms
in NetHack core. Now, the themed room lua code first picks
the themed room (which can be a themed or shaped), and some
of those will then pick a random filling (eg. ice floor,
traps, corpses, 3 altars).

Adds a new lua binding to create a selection picking locations
in current room.

The content-function in special level regions now get passed
the room data as a parameter.
2022-09-15 18:09:40 +03:00
nhmall
1c177dcb39 a couple of inconsistencies
make pmatchregex regex_error_desc return type match cppregex.cpp and
posixregex.c

make the extern declaration for loadsyms[] in options.c match the
one in symbols.c.
2022-09-14 20:23:48 -04:00
PatR
c2a9343367 horn_of_plenty-to-container #tip
For tipping purposes, a horn of plenty is treated like a container.
But using one as the source container in a container-to-container tip
wasn't supported.  Implement that.

Also, #tip was offering carried bags of tricks as candidate containers
to tip some other carried container into.  Only do that for ones which
aren't known to be bags of tricks (so when type not discovered yet, or
specific bag not seen yet due to blindness).
2022-09-14 15:54:24 -07:00
nhmall
970a263d90 Merge branch 'pr873' into NetHack-3.7 2022-09-13 23:06:52 -04:00
nhmall
3951b4dc2a Merge branch 'vga-fixes' of https://github.com/chasonr/NetHack into pr873 2022-09-13 23:05:59 -04:00
Ray Chason
686153f6cb Sundry fixes for DOS 16-color VGA mode
To test 16-color mode, specify OPTIONS=video:vga explicitly;
autodetect will choose a VESA mode if it can.

* Draw tiles correctly when redrawing from panning or from changing
  the map mode among text, tiles and overview. Previously, this would
  draw everything with the tile at the hero's position.

* Draw corridor walls with the stone tile.

* Map the statue colors to the nearest neutral tone among the main
  16 colors. This mainly affects altars and female cats.

* Fix the code that shows statues as the generic statue tile. This
  code could be deleted, but the statues don't draw with the full
  range of gray tones.

* Document the option OPTIONS=video:vesa.
2022-09-13 19:49:56 -04:00
PatR
94945a719a onefile: isaac64.c <math.h> vs yn()
isaac64.c includes <math.h>.  yn() is a non-STDC math function in
<math.h> and that conflicts with nethack's yn() macro or vice versa.

If other source files begin using <math.h> this will probably need
to be handled differently.
2022-09-13 13:59:24 -07:00
PatR
bac60d21a5 onefile: 'here'
extralev.c's 'here' macro was interferring with subsequent uses of
'here' in code from other files.
2022-09-13 10:52:15 -07:00
PatR
a1e83d1d3a forward declarations for struct monst, struct obj
This should eliminate the 'onefile' complaint for objects.c without
breaking anything with any standard conforming compiler.  (Fingers
crossed.)
2022-09-13 10:27:53 -07:00
PatR
d0ee89ab68 container-to-container #tip typo
When tipping a magic-bag exploder from a sack or box into a bag of
holding, the choice of whether to call useup() or useupf() was
backwards.  But nothing bad happened which is fishy.
2022-09-13 04:28:49 -07:00
Pasi Kallinen
99e45e6daa Allow suppressing debugfuzzer warnings 2022-09-13 13:41:27 +03:00
PatR
7ae4efb07c fix issue #872 - container-to-container #tip
Reported by k2:  tipping one container's contents directly into
another container allowed transferring a wand of cancellation (not
mentioned:  or a bag of holding or a bag of tricks) into a bag of
holding without blowing it up.

That's now fixed.  There are other issues that this doesn't touch:

I think it's odd that you can transfer stuff from one carried
container to another but not from a carried container to a floor
container nor from one floor container to another one at same spot.

I didn't test shop billing so an not sure what happens when #tip
blows up a bag of holding and there are some unpaid items involved.

Using #tip on horn of plenty treats it like a container, but doing
that when it's carried doesn't offer the chance to tip its contents
directly into a carried container.

Tipping a carried container does not require free hands or even
limbs (for playability) but tipping such into another container
should require at least one free hand.

Fixes #872
2022-09-12 14:17:22 -07:00