Commit Graph

8524 Commits

Author SHA1 Message Date
Pasi Kallinen
dbfd7879df Split engulfer explosion message into separate function 2023-02-05 20:26:52 +02:00
nhmall
43af05a6b8 Unchanging and improvisations
Adds a reveal.

Increments EDITLEVEL.
2023-02-05 11:32:58 -05:00
Pasi Kallinen
d3430bed9f Prevent certain items from random erosion
Prevent wished for items (unless specified), artifacts,
armor and weapons of NPC heroes, and ammo from Longbow of Diana
being generated eroded.
2023-02-05 16:46:54 +02:00
Pasi Kallinen
ee3daba8c9 Split peaceful responses into separate functions 2023-02-05 08:24:34 +02:00
copperwater
50b18b1324 Fix: default lregion exclusion area occupied real space on the map
The intuitive behavior of des.levregion or des.teleport_region when
"exclude" is left unspecified is that there is no exclusion area.
However, this wasn't actually the case: since l_get_lregion defaulted
the exclusion area to (0,0,0,0) and exclude_islev to 0, this meant that
the 0,0 space on the map would always be excluded from regions. In cases
where a region was specified with its inclusion area constrained to the
0,0 space of the map, this would create a "Couldn't place lregion"
impossible message.

This fixes that issue by defaulting the exclusion area to (-1,-1,-1,-1),
and if the exclusion area is left unspecified, forces exclude_islev=1.
This means that the exclusion zone will be outside the walkable space of
the level where it can't cause any problems.

If a level designer puts negative coordinates in their inclusion or
exclusion parameters, this might not work correctly, but negative region
coordinates aren't currently used anywhere and probably shouldn't be
supported anyway.
2023-02-05 07:49:19 +02:00
PatR
9ce98594a4 up/down level feedback
With sounds on, using #levelchange to drop more than one level only
gave the level-loss sound effect once.  Level-gain sound was better
because the more verbose messaging triggered --More-- before moving
on.  Have both gain and loss use urgent_pline() in case messages
are being suppressed due to ESC, and have both request --More-- to
make the player acknowledge the message.  That has a side-effect of
letting the sound play to conclusion.
2023-02-04 15:28:13 -08:00
nhmall
36ca64acdb start to add some SOUND_TRIGGER_ACHIEVEMENTS code
Start to add supporting code to windsound and macsound. The latter
remains commented out because I haven't had a chance to try
it on macOS yet.

In order to test it out, I added two more stock sounds:
sa2_xplevelup and sa2_xpleveldown.
2023-02-04 14:28:59 -05:00
Pasi Kallinen
9fd87db543 Ceiling hiders on lava pools
Lava pools are perfectly valid locations for ceiling hiders
if they're hiding there - aka hanging from the ceiling.
2023-02-04 19:39:33 +02:00
Pasi Kallinen
e1b01a5d7c Fix segfault when farlooking monster under generic object
A detected cave spider was hiding under a generic spellbook object;
farlooking at it produced a segfault.  OBJ_NAME is null for the generic
objects, so don't try to strcmp it.
2023-02-04 17:48:57 +02:00
nhkeni
31d5fecbb2 leave a note on a potential future Lua sandbox issue 2023-02-04 09:50:49 -05:00
PatR
c212ee44c0 breaking iron bars with weapon
For strength over 18, A_CURR(A_STR) can return up to 125, giving
the chance to break bars by hitting them with a warhammer a 50:50
chance.  Switch to acurrstr() which returns at most 25.

Allow heavy iron balls (wielded or thrown, regardless of whether
they're chained to hero) to have a chance to break bars too.  They
are slightly more complicated because they don't use obj->spe like
a weapon but are otherwise straightfoward.
2023-02-03 17:01:49 -08:00
PatR
3e6ea3faed fix #K3857 - hiding while trapped in a non-pit
sanity_check feedback which occurred after using locking magic to
set off a bear trap at the location of a monster hiding under an
object.

Trivial bit: a recent change made stunning via knockback only occur
when not already stunned but was still adding the current stun time
to the new stun time even though current stun is now always zero.

Several formatting bits included.
2023-02-03 10:45:59 -08:00
nhmall
2acd8e7b29 update soundlib interface
Add SOUND_TRIGGER_AMBIENCE
2023-02-03 13:32:44 -05:00
Pasi Kallinen
0722a5c2dd Fix punishment iron ball yanking hero on top of a monster
When attached iron ball was in a pit (or a pool) with a monster,
and your levitation ended, you were put on top of the monster.

Add a sanity check for hero over monster.
2023-02-03 08:51:48 +02:00
Pasi Kallinen
cae29f1dfd Comment typofix 2023-02-02 19:07:56 +02:00
Pasi Kallinen
8535b248c8 Fix ceiling hiders on pools
While fuzzing, I saw a sanity checking error complaining about
a ceiling hider being on top of a pool; the rock piercer was
teleported on top of the pool while it was hiding in the ceiling.

Try to be a bit more consistent when a monster is hiding in ceiling,
and if it's valid for it to be on a pool.
2023-02-02 19:04:51 +02:00
Pasi Kallinen
c2a1b97627 Stun from knockback only if not already stunned 2023-02-02 13:50:59 +02:00
Pasi Kallinen
6af26751e6 Monsters never try to pick up ball or chain
Apparently my m_move reorg made it possible for monsters to
pick up the chain attached to hero; explicitly prevent that.
2023-02-01 21:43:26 +02:00
Pasi Kallinen
56f1201e43 Use strchr, not index 2023-02-01 16:10:41 +02:00
Pasi Kallinen
df8a0ac654 Split monster looking for items into separate function 2023-02-01 14:37:12 +02:00
Pasi Kallinen
6c9700ab25 Monster movement and object pickup cleanup
Clean up some of the code for monster deciding what objects
to pick up, removing duplicate code.  There should be no real
difference in behaviour, other than monsters now can pick up
one stack of items at a time; previously monster could pick up
gold, then a practical item, followed by a magical item all
in a single turn, although this very rarely mattered.

Not extensively tested.

Code originally from NetHack4.
2023-02-01 10:23:23 +02:00
nhmall
8ee42f5644 further work on soundlib support code
move some inline code into functions
replace some magic numbers

The mingw code is not tested yet.
2023-01-31 22:19:29 -05:00
Pasi Kallinen
4ccee5a177 Use could_reach_item 2023-01-31 19:09:43 +02:00
Pasi Kallinen
97d7a735a4 Separate function for monster safe touch object
Also added the check for touching an artifact to it
2023-01-31 18:44:13 +02:00
nhmall
ce0a4f60ca more windows Makefile tinkering
It looks like the Windows API call for PlaySound using SND_RESOURCE, from a
mingw32 built program, cannot find the resources that are
embeded into the .exe by the mingw32 resource compiler. That works fine
from visual studio.

For now, fall back to not using the SND_RESOURCE flag, use an ordinary
wav file name in the filesystem. Makefile.mingw32 has been modified
to copy the wav files to the binary directory along with the exe.

This probably won't be the final approach, but it will get things
working for now.
2023-01-31 00:45:27 -05:00
nhmall
9bbb2e17cf add a master off/on switch for sounds
sounds can be set in the config file or on the fly with the Options menu.

This also adds a mechanism for specifying a terminology preference
for a boolean option in the options menu.

The choices are: Term_False, Term_Off, Term_Disabled

Term_False, the default, will use the terms "false" and "true" in the
Options menu.
Term_Off will use the terms "off" and "on" in the Options menu.
Term_Disabled will use the terms "disabled" and "enabled" in the Options
menu.

I didn't review any of the existing options to see if one of the new
alternative terms might be a better fit. They were all left at the default.
2023-01-30 12:07:03 -05:00
Pasi Kallinen
744d64487b Helltweaks: improve lava river
The lava river will now draw another river, until a certain
amount of map locations have been turned into lava, so you don't
get a teensy "river" made out of 2 lava pools.

Add a lua selection method to count the number of locations
in the selection.
2023-01-30 17:10:39 +02:00
Pasi Kallinen
8eeeec41f5 Avoid repeating the god ray
My recent change to hit and wake monsters caused a recursive
ghod_hitsu -> wakeup -> dobuzz -> buzz -> ghod_hitsu loop.
Don't call the ghod_hitsu again if the priest is already angry.
2023-01-30 12:39:35 +02:00
Pasi Kallinen
77797450f5 Remove obsolete comment 2023-01-29 18:49:58 +02:00
Pasi Kallinen
394a46ab13 Fix teleported eel hiding in dry land 2023-01-29 14:25:01 +02:00
Pasi Kallinen
7c2c692ee5 Generate random eroded, erodeproof, or greased items
Items in initial hero inventory, or generated via lua in
special levels or themed rooms are not subject to this.

Code via xnethack by copperwater <aosdict@gmail.com>,
with some modifications.
2023-01-29 11:20:03 +02:00
nhmall
4575d564c7 do warning suppression for soundlib vars another way
Instead of introducing a bunch of preprocessor #ifdef blocks,
this approach is less-intrusive.
2023-01-28 14:55:54 -05:00
Pasi Kallinen
734dcfdabe Don't let monsters loot Schroedinger's box 2023-01-28 20:27:36 +02:00
Pasi Kallinen
60cbab1130 Fix shopkeeper getting mad when monster triggers a trap
When a monster triggered a rolling boulder trap which buried
a shop item in a pit, the shopkeeper would bill the hero.
(Or get mad at hero, if they were out of the shop)

The fix might not be quite right - should the shopkeeper get
mad at hero when monster triggers a trap created by hero?
Or when an item is buried in a pit created by a hero?
2023-01-28 20:03:23 +02:00
Pasi Kallinen
cb81631a38 Fix open showing wrong glyph
Trying to open a location where a pet was removed the glyph
and showed the underlying terrain glyph instead.
Just use newsym - it'll use feel_location when Blind.
2023-01-28 19:12:24 +02:00
nhmall
44677e82ab warning fix if no added soundlib compiled in 2023-01-28 09:09:39 -05:00
nhmall
5b3a8b5774 more Soundeffects tinkering 2023-01-27 23:41:54 -05:00
nhmall
90895330c5 soundlib terminology update - sound_triggers
Switch to using the term "sound triggers" for things that
result in a call to one of the soundlib routines.

SNDCAP_* renamed to SOUND_TRIGGER_*
sndcap field in the sound_procs struct changed to sound_triggers
2023-01-27 22:21:53 -05:00
PatR
47efcd90c7 shop object sanity - buried objects
This fixes the reported sanity check warning about a buried object
within shop boundary staying flagged no_charge after the shopkeeper
leaves the shop.  Leaving the shop to pursue the hero moves unpaid
items off the bill to owed-as-robbery and changes no_charge items
to shop-owned but it wasn't doing the latter for buried objects.

I haven't attempted to test on a level with multiple shopkeepers.
If that was working correctly for unpaid items than I think it
ought to work correctly for no_charge items now.  I'm not sure how
thoroughly the handling for unpaid items was tested though.
2023-01-27 11:01:24 -08:00
nhmall
5401983d76 suppress "set but not used" warning if no soundlib 2023-01-27 09:57:54 -05:00
nhmall
aee2ff57e8 additional Soundeffect, additional SoundAchievement
Also adds a macro SoundeffectEvenIfDeaf for a couple of proposed
special cases where Deafness shouldn't factor in.
2023-01-27 01:25:05 -05:00
nhmall
446044e1d5 1st of a few sequencing changes
rename display_gamewindows() to init_sound_and_display_gamewindows()
(I know that's getting pretty long-named).

move activate_chosen_soundlib() into init_sound_and_display_gamewindows()
from moveloop_preamble().

Also included was a missing break in a switch related to sounds.
2023-01-26 17:15:59 -05:00
PatR
52a44b3255 fix github issue #967 - nearby objects
Issue reported by entrez:  distant_name() used different criteria
for 'nearby' than map_object() and see_nearby_objects(), so it could
mark objects as seen when they were being displayed as generic,
without redisplaying them as a specific.  Generic object with dknown
set leads to confusion.  Example was "a spellbook spellbook".

I think this should fix things, but I've only done a small amount of
testing so far.

Fixes #967
2023-01-26 14:05:03 -08:00
PatR
b684f2c401 offer_real_amulet() tweaks
Mote PR #965.  Add a couple of comments and fix up some formatting.
2023-01-26 13:39:00 -08:00
PatR
cef8206af4 \#version warning fix
Avoid #ifdef/#else/#endif inside expansion of Strcat() macro.

Also, change constructed
|soundlib_nosound, soundlib_macsound, and soundlib_qtsound, user sounds.
to be
|nosound, macsound, qtsound, and user sounds.

OPTIONS=soundlib:somelib doesn't--or won't, when finished being
implemented--include the "soundlib_" prefix in the user-visible
value, and placement of "and" vs "user sounds" was odd.

The code should probably be reorganized so that makedefs can put that
into dat/options or at least have it put a placeholder for the missing
paragraph.
2023-01-26 09:10:24 -08:00
PatR
3a2d6d6d0a pull request #965 - split offering the Amulet
into a separate routine

Pull request from argrath:  move the code used when offering the
Amulet of Yendor on a high altar out of dosacrifice() into a new
routine.

Closes #965
2023-01-26 08:28:27 -08:00
Pasi Kallinen
f61e1e8e23 Tiny chance of breaking iron bars with war hammer
Also add some different sounds to hitting the iron bars,
and make it noisy.
2023-01-26 18:21:53 +02:00
SHIRAKATA Kentaro
38cb1b9096 split offering the real amulet into a separate function 2023-01-26 08:19:39 -08:00
Michael Meyer
7f4e69f885 Fix: use-after-free in dog_eat()
I think moving the m_consume_obj call (which will free the eaten item)
further down should fix this without causing any really wacky message
sequencing issues, but if maintaining the exact order is important
obj->unpaid and its price could be cached before the free instead.
2023-01-26 08:30:00 +02:00
nhmall
7ecb1e0757 fix warning
In file included from makedefs.c:180:
./../src/mdlib.c:92:12: warning: unused function 'count_and_validate_soundlibopts' [-Wunused-function]
static int count_and_validate_soundlibopts(void);
           ^
1 warning generated.

Function definition is in the #ifndef MAKEDEFS_C section, so move the prototype there too.
2023-01-26 00:49:11 -05:00