Commit Graph

6866 Commits

Author SHA1 Message Date
Pasi Kallinen
65b320de39 Start of movement tests
Adds the following lua functions:

- nh.pushkey("x")
    Pushes a key into the command queue. Support is spotty,
    currently only the keys handled in rhack.
- nh.doturn()
    Runs one turn of main loop, or if optional boolean param
    is true, until g.multi == 0
- nh.monster_generation(false)
    Disable monster generation, and kill off all monsters.

Adds a testmove.lua script to test hero movement. Currently
covers only hjklyubn and HJKLYUBN.
2021-07-28 19:19:40 +03:00
Michael Meyer
fa8c3f82be Fix: crash when appending to long engraving
If an engraving was appended to repeatedly, it could eventually exceed
BUFSZ and cause a crash.  Add some checks to prevent this from happening
and inform the player when she runs out of space to engrave on a
particular square.
2021-07-28 16:33:25 +03:00
Pasi Kallinen
2775a07e5b Explicitly set the altlabels array size
This will allow the compiler to complain after you add new glyphs.
2021-07-28 07:45:25 +03:00
nhmall
7c4244edf7 typo 2021-07-27 15:56:47 -04:00
nhmall
67ca460356 be explicit on the array name in tiletext.c 2021-07-27 15:55:04 -04:00
nhmall
e2f28f3a08 Merge branch 'NetHack-3.7' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.7 2021-07-27 15:37:18 -04:00
nhmall
43e3ea2836 tile-build follow-up for new CMAP entries 2021-07-27 15:36:04 -04:00
PatR
81b3b56296 unfixed bug #H2668 - hitting disenchanter w/ rings
From 8 or so years ago, hitting a disenchanter without wielding a
weapon and without wearing gloves while wearing a possitively
'charged' ring should reduce the ring's enchantment.  This doesn't
fix that, it just adds a brief comment about it.
2021-07-27 12:31:32 -07:00
PatR
068fa6c658 fix #H2797 - avoid "vision clears" if hero can't see
From 8 years ago, sitting on a throne and getting the confers-see-
invisible result gave "your vision becomes clear" message even when
hero was blind (who stays blind at the time).  Give an alternate
message if hero is blind, with another alternate when the blindless
is due to being poly'd into something without eyes.
2021-07-27 12:29:46 -07:00
PatR
3c49cd2074 drowning monster's [lack of] corpse
From the newsgroup 6.5 years ago,
| Subject: Re: Reviving drowned pets impossible
if you displaced your pet into water and it drowned, it would never
leave a corpse.  That seems to be moot these days because a pet or
peaceful monster which would drown will refuse to swap places, but
change corpse handling anyway.
2021-07-27 12:18:55 -07:00
PatR
e3712dbb31 gaze vs hider
From a 7 or 8 year old bug report from a beta tester.  A pyrolisk's
gaze against a mimic didn't unhide that mimic.  Somewhere along the
line that has been fixed, but some apparently redundant code inside
'if (visible)' should be done even when not visible.
2021-07-27 11:58:44 -07:00
PatR
31d6b27481 altmeta revisited
Put the flag that parse() uses to tell readchar() that the next
keystroke is a command into the program_state structure instead of
having it be a static variable in cmd.c.  Conceivably an interface
could make use of it, and even if none do, it is program state....

More #558
2021-07-27 11:03:20 -07:00
Pasi Kallinen
267ac5add2 Add colored branch stairs
Different color for stairs that go to another dungeon branch.

Adds four new glyphs, S_br{up,dn}{stair,ladder}, which use the
same character as normal stairs/ladders, but yellow color.
In tiles, the up/down arrow is yellow-green instead of while-blue.

This feature has been around a lot and is in several different
variants, but this is implemented from scratch so tiles work too.
2021-07-27 17:21:01 +03:00
Pasi Kallinen
141a7915d6 Bugle playing should not scare some monsters
Make awaken_soldiers match awaken_monsters in what monsters
it can scare.
2021-07-26 21:40:23 +03:00
PatR
b70f00578c fix github issue #558 - 'altmeta' input
Setting the 'altmeta' option affects how ESC is handled.  Normally it
is for terminals/emulators which transmit two character sequence ESC c
when the user types Meta+c, but it can also be used to construct meta
characters 'manually' by typing ESC c.  Unfortunately setting this
option has a side-effect of requiring a second character after ESC
before our readchar() will return, so it is only honored when parse()
wants the next command, not for general input.

When readchar() was recently split into two parts, the use of static
variable 'alt_esc' by parse() and readchar() was removed.  That
resulted in requiring the user to type a second character whenever
ESC was typed, instead of just when it was transmitted or typed as
the prefix of a command that uses a meta-character keystroke.

Instead of just putting 'alt_esc' back, do things differently by
adding static 'getting_cmd' flag instead.

Fixes #558
2021-07-25 10:52:11 -07:00
Pasi Kallinen
c88bdb0a32 Hide internal commands from key list 2021-07-25 11:57:09 +03:00
nhmall
227ef401df change NetHack's MACOSX references to MACOS 2021-07-24 17:52:47 -04:00
PatR
2e43f83db0 wizard mode enlightenment tweaks + Glow status fix
For extended monster detection, show the number of turns remaining
during enlightenment (wizard mode only).  The value is also
available via #timeout but various enlightenment entries already do
something like this.

For confuse monster, show the number of hits left for glowing hands
(again, wizard mode only).

And for the latter, the 3.7 conditional status condition set up was
storing u.umconf, an unsigned int, into contests[bl_glowhands].test,
a boolean, so would yield the wrong value if glowing hands managed
to become high enough to be a multiple of 256 (assumes 8-bit char
for boolean).
2021-07-24 11:30:52 -07:00
Pasi Kallinen
e2c6cbe347 Fix missing Izchak shop
My recent commit broke Izchak's shop in minetn-6.
Fix it as per the suggestion from entrez.
Fixes #555
2021-07-24 20:18:44 +03:00
Pasi Kallinen
7f39d53ad3 Lua: improve level testing
Add des.finalize_level() used for testing in conjunction with
des.reset_level().
Add nhc.DLB to return 0 or 1 if DLB was defined at compile-time.
Change the test_lev.lua to give more informative messages instead of
just lua error when required file doesn't exist.
Add bigrm-11 to the level tests.
2021-07-24 10:49:06 +03:00
Pasi Kallinen
93b66ff8da Prevent segfault on nonexistent mapseen
Cannot happen on normal play, but with some lua trickery ...
2021-07-23 21:09:39 +03:00
Pasi Kallinen
f07829045a Prevent impossible with secret doors in sokoban
Doesn't currently happen as no Soko levels use secret doors,
but handle them anyway gracefully.

Secret doors have their doormask set, but it's overloaded wall_info.
The display routines aren't happy with D_CLOSED in wall_info.
2021-07-23 20:58:45 +03:00
PatR
5a09a01a13 gold dragon and scales
Add two new monsters and two new objects:
 gold dragon
 baby gold dragon
 gold dragon scale mail
 set of gold dragon scales

A couple of variants seem to have added these already, but this came
off my ancient list of monsters to add and was done from scratch.
It's a clone of silver dragon, but instead of having reflection and
breathing cold, a gold dragon emits light and breathes fire; because
of the latter it can be seen with infravision like a red dragon.
Adult gold dragons are lawful as in the AD&D Monster Manual rather
than chaotic as the wiki pages show for the variant versions.

Worn gold dragon scales operate similar to wielded Sunsword:  when
blessed, radius is 3 (same as a lamp), if uncursed, radius is 2, and
if cursed, radius is 1 (but functions as 2 when worn by the hero,
otherwise there would be no tangible effect).  Gold dragon scale mail
gets an extra +1, making blessed gold DSM have a bigger radius than
lamps.  Embedded scales have radius 1 regardless of BUC state; light
for that case comes from the gold dragon monster form the hero is in.
When not worn, gold scales and scale-mail don't emit any light.

The tiles use a mix of yellow (for gold) and red.  The two object
tiles seem reasonable variations of the corresponding silver dragon
ones.  The two monster tiles definitely need work since the silver
ones were mostly cyan and changing that to red did not produce very
good result; subsequent attempt at a mixture was haphazard at best.
2021-07-23 10:41:57 -07:00
Pasi Kallinen
dbac44596e Lua: Allow boolean params in level_init 2021-07-22 18:02:58 +03:00
Pasi Kallinen
b566bbda38 Split calculating your movement speed out of moveloop 2021-07-22 12:28:15 +03:00
Pasi Kallinen
5cf0bb1de9 Split moveloop into preamble and core 2021-07-22 12:01:26 +03:00
Pasi Kallinen
932b6d03c9 Lua: Make des.monster use boolean params 2021-07-22 11:05:40 +03:00
Michael Meyer
23cfa24ee9 Fix: engraving with dry magic marker
Engraving with a marker can use up remaining charges to write
semi-permanently in ink, or--if the marker has no remaining charges--can
draw in the dust as with a normal blunt item.  Handling in engrave after
a recent refactor (9c6a5fc423) didn't fully cover this second case, and
as a result using an empty marker to engrave would deduct a charge per
attempt and cause an impossible.  This could be exploited by repeatedly
engraving with the same empty marker to underflow the marker charges.
2021-07-22 07:21:40 +03:00
Michael Meyer
e8cb683ad0 Fix: off-by-one error in movecmd
The for loop which iterates through the list of movement keys in
movecmd(cmd.c) was updated in 5abf948116 to count down to 0 instead of
up to the end of the list.  This commit inadvertently introduced an
off-by-one error which started the loop one past the actual end of the
array.  On my system this made 'H' stop working as the 'run West' key.
2021-07-21 22:43:46 +03:00
Pasi Kallinen
893a14e2bd Remove special doinv key
The same thing can be done in config file with BIND=0:inventory
2021-07-21 16:33:10 +03:00
Pasi Kallinen
a5e5435619 Make mouselook use internal extended command
... instead of faking a key press
2021-07-21 12:23:25 +03:00
Pasi Kallinen
433f0cc15f Add new command: #retravel
Retravel travels to the previously selected destination.

Also changes the travel-via-mouse to execute the extended command
instead of faking a special key.
2021-07-21 10:59:08 +03:00
PatR
fc62610ee3 a uke
Fix a copy+paste blunder.
2021-07-17 12:16:03 -07:00
Pasi Kallinen
8ff2badf51 Use define for wand wresting chance 2021-07-17 20:59:40 +03:00
PatR
bb74aeef03 fix github issue #552 - "an ukulele"
Add "ukulele" to the exceptions that yield "a u<something>" in case
someone names their fruit that.  Add the shortened form "uke" too.

While in there, generalize "one" handling to accept "one", "one<space>
<anything>" and "one<underscore><anything>" as exceptions in addition
to existing "one<dash><anything>", and "eu<anything>" to replace
existing "eucalyptus".

Fixes #552
2021-07-17 08:32:07 -07:00
Patric Mueller
4c1f2ffa48 Fix heap-use-after-free when attacking monster with potion
Attacking a monster which has a passive attack (e.g. a red mold) with a
wielded potion that breaks during the attack, the variable weapon would
not be correctly reset and passive() would be called with the pointer to the
freed object.
2021-07-17 13:20:14 +02:00
Michael Meyer
d8dc16e393 Add 'readable' Hawaiian shirt designs
Functionally similar to reading a T-shirt or apron, but rather than
actual text printed on the shirt being displayed, the design of the
Hawaiian shirt is described: for example, "hula dancers on an orange
background" or "tropical fish on an abstract background".  Much like
T-shirts have their text included in the game-end inventory list ('a
blessed +2 T-shirt with text "foo"'), Hawaiian shirts now have a brief
description of their design appended to their item name under the same
circumstances.

Because 'reading' a Hawaiian shirt doesn't actually involve reading
text, using the 'r' command in this way doesn't break illiterate
conduct.
2021-07-16 18:05:21 +02:00
Patric Mueller
71084bbf61 Fix format-overflow warnings in botl.c 2021-07-16 18:04:28 +02:00
PatR
e9c813b6ba fix issue #510, pull request #519 - vomit effects
Add some vomiting effects:

Trigger divine wrath if hero vomits at an altar's location.  (What
about adding throne and maybe sink special effects too?)

If poly'd into a yellow dragon, breathe (acid) on self.  (I'm not
sure why.)

If on ice and poly'd into an acidic form, melt the ice.  Also,
change melt_ice() to give its message when melting happens at the
hero's location even if hero can't see.

Fixes #519
Fixes #510
2021-07-15 16:10:34 -07:00
PatR
475648bd02 fix github issue #423, pull request #549
Zapping at an object with teleportation resulted in scrambled zap
targetting as soon as any object was hit.

flooreffects() got changed to set bhitpos for handling erosion damage,
but bhitpos is used by wand/spell zap handling to pick the next target
spot.  So a zap that teleported an object resumed one step beyond the
object's destination rather than one step beyond where it was hit.
The rest of the zap could hit things (monsters as well as other
objects) which weren't in line with the original zap.  Reported case
was one of the Riders on Astral, coming from beyond multiple walls to
arrive adjacent to hero (usual position when a Rider gets teleported).

Fixes #549
Fixes #423
2021-07-14 19:21:18 -07:00
PatR
91248a2b7e fix pull request #548 - encumbrance feedback
when polymorphing into "new man".  Characteristic stats are shuffled
if turning into new man, but when already polymorphed those get
overridden by the old pre-polymorph characteristics, resulting in
another encumbrance check which might contradict the one that just
happened.  Skip the encumbrance check done when shuffling stats so
that there's only one and it comes after all changes are finished.

Fixes #548
2021-07-14 18:29:03 -07:00
PatR
f7436fd02d fix pull request #540 - don't autoquiver aklys
If player throws a wielded aklys and it fails to return, and quiver
is empty when picking it back up, don't put it into that slot because
it needs to be wielded to achieve best throwing effect.  A player who
had wielded it and was using 'f' to throw it might not notice that
it isn't returning until it hasn't returned several times.  Moot if
quiver already has some missile readied.  Don't autoquiver even if
some other weapon is wielded because that might have been done just
to go retrieve the aklys.

The game doesn't keep track of whether a previously thrown item was
wielded at the time, and shouldn't be changed to auto-wield in such
situation.  Leaving quiver empty so that player is prompted for what
to throw is sufficient.

Fixes #540
2021-07-10 19:09:17 -07:00
PatR
683b78068f gold kicking bit
One of the gold kicking changes I had pending.  The "Thwwpingg"
message is obviously intended as a sound effect so shouldn't be
given if the hero is Deaf.
2021-07-10 17:37:38 -07:00
PatR
f441ef11f6 wishing fixes
Changes in wish parsing included with figurine gender implementation
3 or so weeks ago accidentally broke asking for "large box" and
possibly other stuff.

Re-do "paperback book" handling to accept "paperback" and "paperback
book" but to reject previously accepted "paperback spellbook" when
wishing for a novel by description.
2021-07-10 17:13:46 -07:00
nhmall
ed9647310a deal with gold leaving shop via scatter()
fixes #538
2021-07-10 19:41:55 -04:00
nhmall
a4711739c0 get rid of some recent signed/unsigned mismatches
src/mkroom.c(529): warning C4389: '!=': signed/unsigned mismatch
src/sp_lev.c(981): warning C4389: '==': signed/unsigned mismatch
src/sp_lev.c(983): warning C4389: '==': signed/unsigned mismatch
src/sp_lev.c(985): warning C4389: '==': signed/unsigned mismatch
src/sp_lev.c(987): warning C4389: '==': signed/unsigned mismatch
src/sp_lev.c(989): warning C4389: '==': signed/unsigned mismatch
2021-07-10 07:42:27 -04:00
janne-hmp
74a64b1647 Fixed two index out of bounds errors when eating standard eggs. Their corpsenm is -1, resulting in index being out of bounds in mons array. 2021-07-10 11:47:22 +03:00
PatR
563cb33d67 novel named Thud!
Accept "Thud" as an alternate spelling for "Thud!" when parsing novel
titles.
2021-07-09 19:56:10 -07:00
PatR
2c3b9d1d2d wishing for "paperback book"
Something I noticed recently:  a wish request for "paperback book"
yielded "Nothing fitting that description exists in the game."
Asking for "paperback spellbook" worked though.

I'm not sure whether this is the best way to handle this particular
exception but wishing for "paperback book" now works.
2021-07-09 19:40:52 -07:00
Pasi Kallinen
2261f998a6 Fix des.room doors
Fix special level des.room shop doors broken by my recent commit.
Mark the shopdoor error as impossible, so the fuzzer stops there.
2021-07-09 20:32:00 +03:00