Commit Graph

17428 Commits

Author SHA1 Message Date
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
nhmall
ce8cef7906 get rid of spurious warning on Microsoft compiler 2024-12-09 23:29:38 -05:00
nhmall
c897f3a950 a comment for the obj side of discard_migrations() 2024-12-09 22:59:56 -05:00
nhmall
d99a24843b deal with light sources in discard_migrations()
Otherwise, when discard_migrations() purges monsters,
their stale monster pointers can be left inside the light source data
structure.
2024-12-09 21:41:26 -05:00
nhmall
64d41e10de update #migratemons for debugging purposes
For the wizard-mode command #migratemons at the
"How many random monsters to migrate to next level? [0]" prompt,
allow a negative number to cause it to use existing monsters
already on the level for the forced migration, up until the
absolute value of the number, instead of random new monsters
as it does for a positive number.

For example, specify -20 to force-migrate 20 existing monsters
already on the map.
2024-12-09 21:14:14 -05:00
nhmall
1f8b75b8c6 different ls content values, so bump EDITLEVEL 2024-12-09 16:21:31 -05:00
nhmall
b744ad41d9 follow-up correct ordering of impossible() fmt 2024-12-09 16:07:27 -05:00
nhmall
02259dd1d0 light source troubleshooting
I don't think this solves the recent light source reports,
but it changes a couple of things in an attempt to get more
information.

1. Having gy.youmonst.m_id field always be zero makes it tough
to distinguish it from uninitialized memory, or a random memory
value. This changes the m_id for the hero's gy.youmonst.m_id
to always hold the identifier 1, instead of 0.

2. write_ls was taking the stashed pointer in the light source,
and using it to immediately extract the m_id field and search
for that m_id. This changes the approach slightly, to actually
try and locate the stashed pointer itself in one of the monster
chains. Only if the monster pointer is located, do we dereference
it to obtain the m_id field.

3. For the interim, mark the saved ls with another set bit when
there has been a failure to locate the monst. At this time,
no code is acting on that bit, but it can be seen in a debug
session.

Hopefully, the next report will provide enough information to
understand the scenario a little better.
2024-12-09 15:52:29 -05:00