Commit Graph

17435 Commits

Author SHA1 Message Date
PatR
8a7f3b2b6b more issue #1303
Various bits I had in progress before Michael's commit.

Mainly forget engravings when bones are saved instead of leaving them
flagged as seen for the next hero who gets the level.
2024-12-19 18:18:11 -08:00
nhmall
21d35e768c bump EDITLEVEL for previous two commits DEC19-2024 2024-12-19 17:54:55 -05:00
nhmall
111ef1e1a5 consume a bit in obj.h for future resolution of a TODO in bones.c
Since EDITLEVEL is being incremented for the previous patch anyway,
add the "name_from" bit to the obj struct now, as groundwork for
the code change mentioned in a TODO comment in bones.c:

            /* strip user-supplied names */
            /* Statue and some corpse names are left intact,
               presumably in case they came from score file.
               [TODO: this ought to be done differently--names
               which came from such a source or came from any
               stoned or killed monster should be flagged in
               some manner; then we could just check the flag
               here and keep "real" names (dead pets, &c) while
               discarding player notes attached to statues.] */
            if (has_oname(otmp)
                && !(otmp->oartifact || otmp->otyp == STATUE
                     || otmp->otyp == SPE_NOVEL
                     || (otmp->otyp == CORPSE
                         && otmp->corpsenm >= SPECIAL_PM))) {
                free_oname(otmp);
            }

Also, the bitfield per-byte groupings identified in the struct
weren't accurately reflected, so rearrange the Bitfields,
and correct the per-byte groupings.

This invalidates existing save files and bones.
2024-12-19 17:54:14 -05:00
nhmall
f7853be3dc fix GitHub issue 1303 related to engravings
GitHub issue reported by ars3niy:
https://github.com/NetHack/NetHack/issues/1303

@ars3niy commented on Oct 27:
Stepping on a square with a dust or "graffiti" engraving while blind
produces no message because presumably you can't read them by swiping
the floor with your hands, however the engraving glyph still shows up on
the map afterwards. While this helps zen players, it looks like a bug.

@ville-v commented 3 days ago:
Searching while blind also reveals the engravings. Here is a save file
demonstrating the issue.
[...]

This adds an erevealed bit to engravings, to accompany the the eread
bit that is already there.

eread:      refers to the text of the engraving
erevealed:  refers to the engraving map symbol

Hopefully, this resolves issue 1303 without creating additional bugs.

This invalidates existing save files and bones.

Fixes #1303
2024-12-19 17:53:43 -05:00
PatR
1e431139b4 fix issue #1342 - garbled iron bars message
Issue reported by elunna:  the message given when zap_over_floor()
hits iron bars with lightning or acid was substituting a couple of
words or phrases in the wrong order, resulting in
|The {melt|dissolve} iron bars somewhat but remain intact.
when the iron bar location is flagged as non-diggable.  It should be
|The iron bars {melt|dissolve} somewhat but remain intact.

Not mentioned:  the corresponding message for locations that aren't
flagged as non-diggable used "melt" unconditionally.  Change it to
keep "melt" for lightning but switch to "corrode away" for acid.

Fixes #1342
2024-12-19 13:11:01 -08:00
Pasi Kallinen
5de7f986a0 Forget obj trap known in bones file 2024-12-19 15:29:29 +02:00
Pasi Kallinen
87694e1a95 Hero remembers trapped boxes
After finding a trap on a chest or a large box, remember it
as trapped: "You see here a trapped large box."
Randomly generated chests and boxes can be obviously trapped.
Allow defining obviously trapped containers via lua.

Invalidates saves and bones.
2024-12-19 13:11:25 +02:00
PatR
27a03ef75b more /e /E
Discovered but covered engravings weren't being shown by /e and /E.
2024-12-19 01:11:14 -08:00
PatR
01e781fff3 /e /E lint
In look_engrs(), 'sym' isn't used anymore.
2024-12-18 18:14:30 -08:00
PatR
65070b7462 fix /e and /E
A fix in Janurary to avoid appending engraving text or headstone
text when examining a map location where a monster or object covers
the engraving or headstone inadvently broke the /e and /E variations
of the '/' command, which is intended to list such text even when
covered.
2024-12-18 02:15:09 -08:00
Pasi Kallinen
faf2267aba Use correct variables, not where we are trying to go 2024-12-18 10:35:54 +02:00
nhmall
f32e766728 MIPS cross-compile bit
Use 3 additional Makefile variables
2024-12-17 19:16:00 -05:00
PatR
6e587fb282 fix out-of-bounds not in test_move()
Commit 0381e61624 fixed a problem
for mon vs hero in test_move(), but the situation can also happen
with mon vs mon which doesn't use test_move().
2024-12-17 13:46:25 -08:00
Pasi Kallinen
80a0a309ea Don't advance spell skills when using wizcast 2024-12-17 22:55:22 +02:00
nhmall
6ce2ae956e simplify inclusion of debugging capability in msdos package
This build command will include line number info, gdb.exe or nhgdb.bat in the package:

        make CROSS_TO_MSDOS=1 WANT_DEBUG=1 package

This build command will not include line number info, gdb.exe or nhgdb.bat in the package:

        make CROSS_TO_MSDOS=1 package
2024-12-17 15:33:39 -05:00
Pasi Kallinen
20c456cbbb Avoid using doopen return value in test_move
We can't rely on doopen_indir return value to
check whether hero moved and opened a door.
Instead, explicitly check whether the door is still
closed, and whether hero moved.
2024-12-17 20:58:02 +02:00
nhmall
8da4f74dcf revisit some coordxy casts inherited from time of xchar
The ones below marked "left,revisit" might be worthy of code changes

explode.c:removed: arg sx,sy passed to breaks() are coordxy and so are the parameters
invent.c: removed: discover_artifact() parameter is xint16, so change cast to match
mail.c: removed: gv.viz_rmin[] contains coordxy's, and enexto() 2nd param is too
mkmaze.c: removed: x, y are coordxy and so are cc->x, cc->y
mkroom.c: removed: tx, ty are coordxy and so are parameters to occupied()
mplayer.c: left,revisit: x,y declared int, but mk_mplayer() params are coordxy
sp_lev.c 2890: left alone: x,y declared int, but is_ok_location() params coordxy
sp_lev.c 4114: left alone: cast from lua_Integer
sp_lev.c 4123: left alone: cast from lua_Integer
sp_lev.c 4650: left alone: cast from lua_Integer returned from lua_tointeger
sp_lev.c 4765: left alone: cast from int_Integer returned from lua_tointeger
sp_lev.c 4772: left alone: cast from int_Integer returned from get_table_int
teleport.c 366: left alone: cast from int returned from rn2()
timeout.c 2171: left alone: cast from long
vault.c: left,revisit: guardx,guardy declared int, but bestcc fields are coordxy
worm.c 791: left,revisit: wseg.wx, wseg.wy are coordxy, so are nx, ny, but not
                          ox, oy; why are ox, oy needed at all?
worm.c 955: left alone: wx, wy are coordxy, wseg_at() params are int x, int y
zap.c 5061: left alone: cast from long
2024-12-17 13:02:05 -05:00
Pasi Kallinen
0381e61624 Fix out-of-bounds in test_move
Hero was on the top-left of an open map at (1,0), and
a monster was trying to knock them back to (0,-1).
2024-12-17 18:23:01 +02:00
nhmall
5a3795184f use bash for sys/msdos/fetch-cross-compiler.sh
bash allows arrays thus preventing duplication during fetching
2024-12-16 13:35:05 -05:00
nhmall
0a5948fffc follow-up on msdos cross-compile
Obtain gdb.exe during the execution of sys/msdosfetch-cross-compiler.sh
ahead of the build, so that the Makefile just has to move it into place.
2024-12-15 20:08:10 -05:00
nhmall
69600c3f38 add an optional deploy-to-dosbox target for msdos cross-compile
The WANT_DEBUG=1 will cause the cross-compile to include line
number information in the NetHack executable, useful for
backtraces and gdb debugging sessions.

How a developer can use the optional deploy-to-dosbox target:
    make CROSS_TO_MSDOS=1 WANT_DEBUG=1 dosbox=/mnt/c/dosbox deploy-to-dosbox

where dosbox= points to the directory which will be mounted for
your drive in dosbox

THe deploy-to-dosbox recipe ensures that a target copy of gdb.exe
ends up alongside nethack.exe at the target, including:
  - placing the source code that gdb requires on the target
    in the nhsrc subfolder.
  - an nhgdb.bat that supplies the right switches to gdb
    for locating the NetHack sources.
2024-12-15 10:26:49 -05:00
nhmall
fd7c314e9e adjust compiler switches in msdos cross-compile 2024-12-15 10:15:23 -05:00
nhmall
2965ce4bc5 msdos build correction
ENHANCED_SYMBOLS is defined by default in config.h.
The msdos build tried to #undef ENHANCED_SYMBOLS
in tilemap.c, but doing it in there created a mismatch
between the data struct definition for glyph_map in wintype.h
and the initializers generated in tilemap.c

Move the msdos build catch for ENHANCED_SYMBOLS to
one single place in config1.h so that the code and data agree.
2024-12-15 09:53:50 -05:00
Pasi Kallinen
e778d95ace Accessibility: more message locations pt 7 2024-12-14 16:37:49 +02:00
Pasi Kallinen
79affad312 Accessibility: more message locations pt 6 2024-12-14 16:28:20 +02:00
Pasi Kallinen
141d24bdeb Accessibility: more message locations pt 5 2024-12-14 16:19:14 +02:00
Pasi Kallinen
1849985214 Accessibility: more message locations pt 4 2024-12-14 15:51:55 +02:00
Pasi Kallinen
369f1ff959 Accessibility: more message locations pt 3 2024-12-14 15:36:05 +02:00
Pasi Kallinen
055c0d5954 Accessibility: more message locations pt 2 2024-12-14 15:30:12 +02:00
Pasi Kallinen
8e186fd5e6 Accessibility: more message locations 2024-12-14 15:24:24 +02:00
Pasi Kallinen
7fa38eb7b3 Use pline_mon instead of pline_xy
Forgot about this function. Whoops.
2024-12-14 15:20:17 +02:00
Pasi Kallinen
4f37795f96 Accessibility: pet message locations 2024-12-14 15:00:46 +02:00
Pasi Kallinen
fd23463941 Sparkle shield effect and accessibility
When sparkle is turned off, there are some places where
a monster resisting the effect did not give any message.

This fixes some of those.
2024-12-14 14:34:22 +02:00
PatR
b2b9b685c5 fix issue #1305 - failed #untrap from doorway
Issue reported by loggersviii:  attempting #untrap from an adjacent
doorway can move the hero diagonally out of the doorway.

A followup comment by elunna pointed out that a monster's attack that
results in knockback can produce similar result.

Fixes #1305
2024-12-13 22:48:32 -08:00
PatR
bbb4bfa938 fix issue #1337 - 'fireassist' vs 'f'iring aklys
Issue reported by elunna:  if the 'fireassist' option is on and the
quiver contains ammo, 'f' while wielding an aklys switches to the
ammo's launcher instead of throwing the aklys.

Fixes #1337
2024-12-13 12:30:48 -08:00
nhmall
c7739171a2 follow-up: consoletty.c 2024-12-12 22:46:44 -05:00
nhmall
c7276bcf67 more MSYS2 warning clean-up 2024-12-12 22:35:38 -05:00
nhmall
8bb764e624 follow-up: leading tab to spaces 2024-12-12 17:06:12 -05:00
nhmall
1b607d1757 deal with some MSYS2 warnings 2024-12-12 17:02:37 -05:00
Alex Smith
3491535548 More bugfixes for the recent artifact gifting changes 2024-12-12 07:35:50 +00:00
Alex Smith
459c456838 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2024-12-12 07:01:35 +00:00
Alex Smith
3d8081c748 Bugfixes for the recent artifact gifting changes 2024-12-12 06:58:43 +00:00
PatR
9768677f91 comment tweak 2024-12-11 20:53:08 -08:00
Alex Smith
c2c797fa35 Artifact and #offer rebalance, part 2: luck from sacrificing
Luck from sacrificing is now limited by the value of the sacrifice.

This fixes two exploits, both of which rely on getting luck up to
maximum as soon as you have an altar, a luckstone, and a few
rations, via altar-camping until you accumulate enough luck. One of
them is to use the resulting luck to throw off the balance of combat
via using it to make hit chance calculations irrelevant. The other
is to use it to get crowned early in the game; in particular,
getting crowned pre-Sokoban is often viable and, especially for
chaotic characters, solves most of the game's difficulty at that
point (because the intrinisics and weapon are enough to carry a
character to the Castle given even mediocre luck with finding armor).

After this commit, becoming crowned very early in the game is more
difficult (likely requiring unicorns and identified gems), and the
hit chance gain from luck becomes a more gradual gain over the
course of the game rather than all happening immediately upon
finding the altar and luckstone.

In addition to making the game more balanced, this also discourages
grinding by reducing the incentive for altar-camping, so it will
hopefully make it more fun as well.
2024-12-12 03:37:02 +00:00
Alex Smith
d87cadaf73 Artifact and #offer rebalance, part 1: sacrifice gifts
In 3.6, artifact gifts are often either a) entirely useless or
b) gamebreaking, neither of which is really ideal from a balance
perspective.

This commit aims to make artifact gifts more useful in the early
game by greatly increasing the chance for situational artifacts to
generate positively enchanted.  However, the most powerful
artifacts will now only be gifted if you offer a high-value corpse,
meaning that they are only likely to be accessible later in the
game.  The selection of which artifact to gift has become more
complicated in order to a) increase the chance that it fits the
character and b) reduce cheese strategies (e.g. it is no longer
possible for elves to force the gifting of Stormbringer as the
first sacrifice gift).
2024-12-12 03:14:47 +00:00
PatR
aedb24d343 partly fix issue #1336 - pets vs floating eyes
Issue reported by ars3niy:  pets with reflection or ranged attacks
would only attack floating eyes when rolling the 10% random chance
that other pets have even though they could have always safely
attacked.

This fixes the situation for melee attacks by pets who have
reflection.

dog_move() is too complicated for my feeble brain to cope with the
ranged attack aspect.  Pets still won't use ranged attacks against
floating eyes.

With the fix for reflection, I discovered that silver dragons
would be subjected to floating eyes' passive paralysis even when
their breath attack was suppressed.  (It wouldn't impact them, due
to reflection, but the message about the floating eye being hit by
its reflected gaze was being delivered without being preceded by
any message since no attack had taken place yet.)  This fixes that.

\#1336 is still open
2024-12-11 12:38:28 -08:00
nhmall
e08bd9ef8a Windows NetHackW memory leak bit 2024-12-10 14:49:56 -05:00
nhmall
323359ed83 rework a #migratemons change from yesterday 2024-12-10 14:01:10 -05:00
nhmall
175260807b wiz mode teleport starting destination selection
Ensure that the destination selection for intentional
teleport begins at the hero, rather than starting at
a place on the map stored from a prior travel command.
2024-12-10 13:39:55 -05:00
nhmall
548c021049 freedynamicdata() adjustment
The location of the call to dobjsfree() in freedynamicdata()
appears to have been non-ideal.

After getting complaints from a leak-sensing tool after
#quit, the source of the leaks was investigated.

The call to dobjsfree() had been placed immediately following
a call to dmonsfree(), and it did clear out the go.objs_deleted
chain at that point.

Further investigation revealed that the following functions
later on in freedynamicdata() were then adding more deleted
objects to the go.objs_deleted chain:
    free_current_level();
    freeobjchn(gi.invent);
    freeobjchn(gm.migrating_objs);

Move the call to dobjsfree() to a location after those listed
above.
2024-12-10 13:33:42 -05:00