Commit Graph

14735 Commits

Author SHA1 Message Date
nhmall
595d425d73 make a small change to sound interface
add a const
2023-01-22 13:49:38 -05:00
nhmall
5e0fea186c further utilize sound interface - part 2
Expand windsound to support SNDCAP_USERSOUNDS (existing),
SNDCAP_SOUNDEFFECTS, SNDCAP_HEROMUSIC.

Place a small number of wav files into sound/wav that are considered
more specific to some game stuff in the core, namely: playing
instruments by the hero, squeaky board traps. The intention is that
those ones can be integrated into the game without requiring user
file deposits or mappings. Building soundlib support for sound/windsound
searches for them as resources, so they should "just work."

No actual instrument playback is available in the base sound/windsound
soundlib implementation (yet, at least), so it works around that in
a cheap way by using the note-variant wav sounds to concoct the
notes. There are better ways of doing music generation than that,
of course, but this will do in the early going. Any other soundlib
port (such as Qt) can probably easily do the exact same thing. If it
can play USER_SOUNDS, it can almost certainly use the
sound/wav/se_squeak*.wav and sound/wav/sound_*.wav files for
SND_HEROMUSIC and squeaky board sounds soundeffects.

A few of the se_ sounds in sound/wav are free yet licensed, and
there is a file called attributions.txt to meticulously attempt
to comply with the two license variations involved.

SND_SOUNDEFFECTS_AUTOMAP

If SND_SOUNDEFFECTS_AUTOMAP is defined, and a SND_LIB_ interface
that supports SNDPROC_SOUNDEFFECTS is also defined to integrate
soundlib support, the following gets added:

  o If sounddir is defined (existing longstanding feature that's
    been used with USER_SOUNDS for many, many years) any wav file
    present in SOUNDDIR with a name that matches one of the defined
    sound effects in include/sndproc.h will get played each time
    that soundeffect comes up. So, just drop appropriate wav files
    into sounddir and rename it to match.

    No tedious config file entries are required to get soundeffects.

    [ The only config file change required is to
      set SOUNDDIR to point to your directory with the wav files.
      Note: SOUNDDIR only works in your config file if NetHack
      was built with USER_SOUNDS defined. ]

    This is new so there may certainly be some bugs in here.
    Please kindly report them if you encounter any.

    For those that don't read C very well, these are the file names
    that should trigger the SOUNDEFFECTS_AUTOMAP, assuming it is working.

        se_faint_splashing.wav
        se_crackling_of_hellfire.wav
        se_heart_beat.wav
        se_typing_noise.wav
        se_hollow_sound.wav
        se_rustling_paper.wav
        se_crushing_sound.wav
        se_splash.wav
        se_chains_rattling_gears_turning.wav
        se_smashing_and_crushing.wav
        se_gears_turning_chains_rattling.wav
        se_loud_splash.wav
        se_lound_crash.wav
        se_crashing_rock.wav
        se_sizzling.wav
        se_crashing_boulder.wav
        se_boulder_drop.wav
        se_item_tumble_downwards.wav
        se_drain_noises.wav
        se_ring_in_drain.wav
        se_groans_and_moans.wav
        se_scratching.wav
        se_glass_shattering.wav
        se_egg_cracking.wav
        se_gushing_sound.wav
        se_glass_crashing.wav
        se_egg_splatting.wav
        se_sinister_laughter.wav
        se_blast.wav
        se_stone_breaking.wav
        se_stone_crumbling.wav
        se_snakes_hissing.wav
        se_loud_pop.wav
        se_clanking_pipe.wav
        se_sewer_song.wav
        se_monster_behind_boulder.wav
        se_wailing_of_the_banshee.wav
        se_swoosh.wav
        se_explosion.wav
        se_crashing_sound.wav
        se_someone_summoning.wav
        se_rushing_wind_noise.wav
        se_splat_from_engulf.wav
        se_faint_sloshing.wav
        se_crunching_sound.wav
        se_slurping_sound.wav
        se_masticating_sound.wav
        se_distant_thunder.wav
        se_applause.wav
        se_shrill_whistle.wav
        se_someone_yells.wav
        se_door_unlock_and_open.wav
        se_door_open.wav
        se_door_crash_open.wav
        se_dry_throat_rattle.wav
        se_cough.wav
        se_angry_snakes.wav
        se_zap_then_explosion.wav
        se_zap.wav
        se_horn_being_played.wav
        se_mon_chugging_potion.wav
        se_bugle_playing_reveille.wav
        se_crash_through_floor.wav
        se_thump.wav
        se_scream.wav
        se_tumbler_click.wav
        se_gear_turn.wav
        se_divine_music.wav
        se_thunderclap.wav
        se_sad_wailing.wav
        se_maniacal_laughter.wav
        se_rumbling_of_earth.wav
        se_clanging_sound.wav
        se_mutter_imprecations.wav
        se_mutter_incantation.wav
        se_angry_voice.wav
        se_sceptor_pounding.wav
        se_courtly_conversation.wav
        se_low_buzzing.wav
        se_angry_drone.wav
        se_bees.wav
        se_someone_searching.wav
        se_guards_footsteps.wav
        se_faint_chime.wav
        se_loud_click.wav
        se_soft_click.wav
        se_squeak.wav
        se_squeak_C.wav
        se_squeak_D_flat.wav
        se_squeak_D.wav
        se_squeak_E_flat.wav
        se_squeak_E.wav
        se_squeak_F.wav
        se_squeak_F_sharp.wav
        se_squeak_G.wav
        se_squeak_G_sharp.wav
        se_squeak_A.wav
        se_squeak_B_flat.wav
        se_squeak_B.wav
        se_someone_bowling.wav
        se_rumbling.wav
        se_loud_crash.wav
        se_deafening_roar_atmospheric.wav
        se_low_hum.wav
        se_laughter.wav
        se_cockatrice_hiss.wav
        se_chant.wav
        se_cracking_sound.wav
        se_ripping_sound.wav
        se_thud.wav
        se_clank.wav
        se_crumbling_sound.wav
        se_soft_crackling.wav
        se_crackling.wav
        se_sharp_crack.wav
        se_wall_of_force.wav
        se_alarm.wav
        se_kick_door_it_shatters.wav
        se_kick_door_it_crashes_open.wav
        se_bubble_rising.wav
        se_bolt_of_lightning.wav
        se_board_squeak.wav
        se_board_squeaks_loudly.wav
        se_boing.wav
        se_crashed_ceiling.wav
        se_clash.wav
        se_crash_door.wav
        se_crash.wav
        se_crash_throne_destroyed.wav
        se_crash_something_broke.wav
        se_kadoom_boulder_falls_in.wav
        se_klunk_pipe.wav
        se_kerplunk_boulder_gone.wav
        se_klunk.wav
        se_klick.wav
        se_kaboom_door_explodes.wav
        se_kaboom_boom_boom.wav
        se_kaablamm_of_mine.wav
        se_kaboom.wav
        se_splat_egg.wav
        se_destroy_web.wav
        se_iron_ball_dragging_you.wav
        se_iron_ball_hits_you.wav
        se_lid_slams_open_falls_shut.wav
        se_chain_shatters.wav
        se_furious_bubbling.wav
        se_air_crackles.wav
        se_potion_crash_and_break.wav
        se_hiss.wav
        se_growl.wav
        se_canine_bark.wav
        se_canine_growl.wav
        se_canine_whine.wav
        se_canine_yip.wav
        se_canine_howl.wav
        se_feline_yowl.wav
        se_feline_meow.wav
        se_feline_purr.wav
        se_feline_yip.wav
        se_feline_mew.wav
        se_roar.wav
        se_snarl.wav
        se_buzz.wav
        se_squeek.wav
        se_squawk.wav
        se_squeal.wav
        se_screech.wav
        se_equine_neigh.wav
        se_equine_whinny.wav
        se_equine_whicker.wav
        se_bovine_moo.wav
        se_bovine_bellow.wav
        se_wail.wav
        se_groan.wav
        se_grunt.wav
        se_gurgle.wav
        se_elephant_trumpet.wav
        se_snake_rattle.wav
        se_hallu_growl.wav

This needs further testing. At the moment only windsound has
this.

If nobody else looks into it for Qt, I'll take a look in a
few days.
2023-01-22 13:29:44 -05:00
Pasi Kallinen
18a77b1c42 Hellfill: Random temples to Moloch 2023-01-22 20:09:26 +02:00
Pasi Kallinen
a99c473762 Intelligent peacefuls avoid digging shop or temple walls 2023-01-22 13:28:24 +02:00
Pasi Kallinen
8ec84ea7ff Higher chance of demon gating in Gehennom 2023-01-22 13:03:10 +02:00
PatR
550845c3a1 fit git issue #960 - out-of-bounds array access
Issue reported by argrath:  if getoptstr() executed its loop to
find the latest phase that set a role/race/gender/alignment option
value, the first iteration of the loop would use an index that's
out of bounds.

The code in question is wrong but happens to not be used, so the
out of bounds access doesn't occur.  Fix the value for the first
iteration in case the offending code eventually gets used.

Fixes #960
2023-01-22 01:43:20 -08:00
PatR
1f9cb8250b feedback bit
Handle the candle vs underwater message that just had its punctation
fixed slightly differently.
2023-01-21 11:24:52 -08:00
PatR
cf0a652e8f pull request #953 - map updating when underwater
Pull request from entrez:  moving while underwater didn't always
update the map properly if hero got more than one move during a turn.

Closes #953
2023-01-21 11:13:35 -08:00
Michael Meyer
891a20f569 Fix: underwater vision update frequency
Underwater vision was updated only once per turn, so if the hero had
more than one move per turn it could cause some spots to be left behind
on the map.  For example, after moving around underwater while very fast
for a while:

            }
          }}}
          }}}}
       }  }}@}
      }    }}}

Not only does the radius of vision appear to "smear" temporarily, but if
the hero moves fast enough, isolated spots can be left entirely behind
(since the normal underwater vision update only clears nearby spots, not
the entire map).  Both these effects are visible in the example above.

The fix in this commit is to update the frequency of underwater vision
updates to "once-per-time-taken" rather than "once-per-turn", so that it
updates with every move.  I'm not sure if it needs to happen more
frequently than that (i.e. in the "once-per-input" section) but I might
be overlooking something.

Also add missing punctuation to the message for applying a lamp
underwater.
2023-01-21 11:02:05 -08:00
Pasi Kallinen
52c98b300d Wrong order of params 2023-01-21 17:15:38 +02:00
Pasi Kallinen
677b32c2a7 Hit and wake sleeping monster makes it growl
Unless you kill the monster with one hit, it'll wake up
cranky and make noise - waking up other sleeping monsters.

This was a bit tricky with all the message sequencing; I tested
all the hit/throw/fire/zap combos I could think of, and it took
a while to get things looking right.
2023-01-21 16:52:23 +02:00
PatR
9dca76bb50 end.c bit - unnecessary 'else' 2023-01-21 01:56:07 -08:00
PatR
f3ed09bb8e splitobj() never returns Null
While deliberately omitting something unrelated from the
'analyzer vs eat.c' commit, I accidentally left this out too.
2023-01-21 01:53:59 -08:00
PatR
d6872c0431 analyzer vs eat.c
scan-build from llvm-14 (clang) doesn't complain about bite() or
maybe_finished_meal() so this is unlikely to fix those.  But this
does fix one bogus complaint it has for doeat().  Testing whether
the result from touchfood() is Null was fooling it into thinking
that that was a possibility when it's not.

Also, use plain 1 and 0 instead of TRUE and FALSE when assigning
to the victual bit-fields.  The analyzer doesn't care but the type
was mismatched due to the cast to (boolean) hidden in their macro
definitions.
2023-01-21 01:52:04 -08:00
Pasi Kallinen
b859288f5c Unify monster-consumes-object
This code was in three different places; pet eating,
monster eating metal, and monster eating other objects.

Other than very minor changes (eg. rustproofing completely
protects pets from bad effects, rustproof items are no longer
giving apport, and monsters eating corpses are healed), it
should behave the same as before... But I haven't exhaustively
gone through every iteration.
2023-01-21 10:13:26 +02:00
nhmall
f607a775a8 fix misplaced brace; also relocate Soundeffect()
The brace added to dokick was misplaced - it should have included
the You_hear() as well.

The puts the code back the way it was, and relocates the Soundeffect().
The Soundeffect should play whether the hero is Blind or not, and the
Soundeffect() macro already includes a Deaf guard.
2023-01-20 20:51:31 -05:00
nhmall
77d5f048a4 place a comment to identify the unreachable code 2023-01-20 20:41:03 -05:00
nhmall
cbb2830012 re-suppress the three warnings that reappeared
src/nhlua.c(1118) : warning C4702: unreachable code
src/nhlua.c(1045) : warning C4702: unreachable code
src/nhlua.c(1107) : warning C4702: unreachable code
2023-01-20 20:32:36 -05:00
PatR
0f257ec538 new static analyzer fix - nhlua.c
Cope with get_nh_lua_variable() possibly returning Null.

Either or both of the DISABLE_WARNING_UNREACHABLE_CODE and
RESTORE_WARNING_UNREACHABLE_CODE in the vicinity looked misplaced so
I took them out.  They may need to be added back in.
2023-01-20 17:18:27 -08:00
nhmall
28cd188259 resolve 5 analyzer warnings if no SND_LIB_* define 2023-01-20 17:32:55 -05:00
nhmall
5e920a7f94 Set SNDCAP_USERSOUNDS bit in windsound interface 2023-01-20 14:50:06 -05:00
nhmall
07d3b22b4e whitespace cleanup on files just modified 2023-01-20 14:28:33 -05:00
nhmall
8bbe9282aa add soundeffects hooks to core
Insert the calls to trigger a number of potential soundeffects
into the core.

If no additional soundlib support is integrated into the
build, then the Soundeffect macro (sndprocs.h) expands to nothing:

[#define Soundeffect(seid, vol)
]

If, however, at least one additional soundlib support is integrated
into the build, then the Soundeffect macro gets defined as this
in sndprocs.h:

[#define Soundeffect(seid, vol) \
    do {                                                              \
        if (!Deaf && soundprocs.sound_soundeffect                     \
            && ((soundprocs.sndcap & SNDCAP_SOUNDEFFECTS) != 0))      \
            (*soundprocs.sound_soundeffect)(emptystr, (seid), (vol)); \
    } while(0)
]

That macro definition checks for the hero not being Deaf; it checks
to ensure that the active soundlib interface has a non-null
sound_soundeffect() function pointer; and it checks to ensure
that the active soundlib interface has declared that it supports
soundeffects by setting the SNDCAP_SOUNDEFFECTS bit in its sndcap
entry. That just means that the interface routines are prepared to
accept and deal with the calls from the core, whether or not it
actually produces the desired soundeffect.
2023-01-20 14:20:08 -05:00
Pasi Kallinen
b1fd7344e3 Poly into fire elemental, eat flammable items 2023-01-20 18:56:01 +02:00
Pasi Kallinen
b998a368c7 Random sink effect: noxious gas cloud 2023-01-20 17:39:04 +02:00
Pasi Kallinen
93d7d79fca Fix mouse menu movement
When using mouse to move to a location next to the hero,
the test_move result was reversed, causing the click to fall
in to the travel case instead of normal movement.
2023-01-20 14:37:01 +02:00
Pasi Kallinen
af1bd84766 Add hell_tweaks to Orcus' level 2023-01-20 14:08:34 +02:00
nhmall
6c111aaed5 guard call 2023-01-20 05:19:06 -05:00
nhmall
76b569cae0 update visual studio dirs.props with new directory 2023-01-19 20:09:39 -05:00
nhmall
485211b72c mingw32 bit 2023-01-19 20:03:45 -05:00
nhmall
54a9b72e35 another update to visual studio project files 2023-01-19 19:48:55 -05:00
nhmall
897d58655d update visual studio project files 2023-01-19 19:44:25 -05:00
nhw_cron
411f56dbbe This is cron-daily v1-May-8-2022. 000files updated: Files 2023-01-19 19:28:02 -05:00
nhmall
3c7aad898f follow-up for windows build based on CI results 2023-01-19 19:26:23 -05:00
nhmall
3294d760a2 remove obsolete file sys/windows/ntsound.c 2023-01-19 19:13:55 -05:00
nhmall
ea4a81901d add an interface for sound libraries
Groundwork for a more versatile interface for using
sound libraries. A lot of sound libraries work across
multiple platforms.

The current NetHack sound stuff is quite limited.

Binaries can have a variety of window ports linked into
them, and it makes sense to have something similar for
sound.

This tries to set things up in a more soundlib-centric way,
rather than inserting things in a platform-centric way.

It establishes a new top-level directory sound (akin to win
for the window interface routines, or "window-port") where
sound-related additions and sndprocs and support files can be
added and used across platforms.

The default interface is nosound and the 'nosound' interface
is in src/sounds.c

The interface for 'windsound', which contains the same minimal
USER_SOUNDS support using built-in routines that has been in the
windows port for a long time is added to
sound/windsound/windsound.c.

For now, the sound interface support for 'qtsound' has been added
to the existing Qt files win/Qt/qt_bind.h and win/Qt/qt_bind.cpp,
and a note has been placed in sound/qtsound/README.md to avoid
confusion.

New header file added: include/sndprocs.h.
2023-01-19 18:51:42 -05:00
Pasi Kallinen
6e49372d8f Mindless monsters are not scared of music 2023-01-19 22:18:52 +02:00
Pasi Kallinen
242a7ba796 Boomerang hitting a sink is noisy 2023-01-19 19:59:19 +02:00
Pasi Kallinen
e260aa5877 Digging is noisy 2023-01-19 19:55:47 +02:00
Pasi Kallinen
1113373892 Fix vibrating square
The Gehennom changes broke the vibrating square, allowing hero to go
down into the Sanctum via stairs without performing the invocation.

Fix this by making the hellfill lua check for invocation level, and
placing down the vibrating square trap, instead of stairs.
2023-01-19 12:15:46 +02:00
PatR
8952ea9bb5 add Japanese item names to discoveries list
When playing as a Samurai, add things like "osaku" to the discoveries
list even though they don't have separate descriptions to be used
when not yet discovered.  Non-magic ones are pre-discovered and
players can now use the '\' command to figure out what things like
"tanko" mean without resorting to '/?'.

"wooden harp" has been getting changed to "koto (harp)"; make that be
| koto [wooden harp] (koto)
"magic harp" has been staying as "magic harp (harp)"; add it to the
list of Japanese item names.  Since it's magic it isn't pre-discovered.
Once discovered it becomes
| magic koto [magic harp] (koto)

Those two needed special case handling, none of the other items did
aside from forcing them to be discoverable when lacking descriptions.
The discoveries list now has things like
| wakizashi [short sword]
| naginata [glaive] (single-edged polearm)
| gunyoki [food ration]
if--and only if--the hero is a Samurai.
2023-01-18 22:00:57 -08:00
Pasi Kallinen
bb8656c190 Move familiar level message into function 2023-01-18 23:33:21 +02:00
PatR
f61cfe7e48 pacify static analyzer - vision.c
Include some assertions to convince the analyzer that some pointers
can't be Null.  They're Null if 'vis_func' is non-Null but only used
when that function pointer is Null and they have values.

If there's a macro that's defined when the analyzer is running and
undefined when not--or vice versa--it could be used to control NDEBUG
and avoid the assertion code when not analyzing.  That's a bit like
using fake code to pacify 'lint'; however, since the assertions should
never fail, suppressing them isn't really switching to fake code.

I reordered a couple of macros so that the set of them matches the
comment which precedes them and refers to "the last three".  It is
referring to the three within the block comment rather than the macro
defintions but putting those in the same order removes any ambiguity.
2023-01-18 11:57:49 -08:00
PatR
4571a49b3f static analyzer vs symbols.c
This will probably shut up the static analyzer's exceedingly verbose
complaint for symbols.c.
2023-01-18 11:29:40 -08:00
Pasi Kallinen
2511637169 Make plane of fire hot 2023-01-18 10:50:32 +02:00
nhmall
5c4ae701b3 visual studio package settings 2023-01-17 21:07:45 -05:00
nhmall
b0a5c0ee0d quiet a new warning
src/eat.c(74,46): warning C4132: 'zero_victual': const object should be initialized
2023-01-17 19:59:24 -05:00
nhmall
c5cc631b13 comment typo: vicutal -> victual 2023-01-17 19:44:05 -05:00
PatR
2ca7916fdf maybe pacify static analyzer - eat.c
The complaint is that victual.canchoke might be used without having
been initialized.  I'm fairly sure that that isn't correct but get
dizzy trying to trace through the eating code.

This might improve the situation, or maybe not.
2023-01-17 16:31:59 -08:00
PatR
a9dc8dcd1a pacify static analyzer - dog.c
This is similar to the earlier potential fix that I didn't like,
but I think think one is better.

The analyzer claimed that 'fptr' might be Null inside the switch
case for
|struct permonst *fptr = NULL;
|if (obj->otyp == CORPSE || ...) fptr = &mons[obj->corpsenm];
|switch (obj->otyp) { case CORPSE: ... /* dereference 'fptr' */ }
even though it will always have a non-Null value for otyp==CORPSE.

Make the assignment of 'fptr' unconditional.  mons[NUMMONS] is
valid and won't match any actual monster.  In this case it will
only be used when initializing fptr, never when fptr gets used.
2023-01-17 10:42:00 -08:00