For the !defined(DEF_PAGER) config, if the file to be displayed
can't be opened, refresh the screen after complaining about that
rather than when no complaint is issued.
I was looking at backporting an X11 build fix to 3.6 and decided
that the hangup handling wasn't correct if SAFERHANGUP is defined
(which it is by default). It didn't attempt to perform a hangup
save. Also, the handler might return when the X code calling it
expected it to not do so.
I don't know how to force a hangup within X11 so haven't tested
this properly. It works fine when there's no hangup. :-/
Give generic objects a name as well as a description to avoid some
potential object formatting problems. Also remove the 'unique' flag
from them to avoid confusion. Not exhaustively tested.
sound_verbal(char *text, int32_t gender, int32_t tone, int32_t vol,
int32_t moreinfo);
-- NetHack will call this function when it wants to pass text of
spoken language by a character or creature within the game.
-- text is a transcript of what has been spoken.
-- gender indicates MALE or FEMALE sounding voice.
-- tone indicates the tone of the voice.
-- vol is the volume (1% - 100%) for the sound.
-- moreinfo is used to provide additional information to the soundlib.
-- there may be some accessibility uses for this function.
It may be useful for accessibility purposes too.
A preliminary implementation has been attempted for macsound to test
the interface on macOS. No tinkering of the voices has been done.
Use of the test implementation requires the following at build time with make.
WANT_SPEECH=1
That needs to be included on the make command line to enable the test code,
otherwise just the interface update is compiled in.
I don't know for certain when AVSpeechSynthesizer went into macOS, but older versions
likely don't support it, and would just leave off the WANT_SPEECH=1.
If built with WANT_SPEECH=1, the 'voices' NetHack option needs to be enabled.
It was a bit strange, when I first started up the test, to hear Asidonhopo,
the shopkeeper, talking to me as I entered his shop and interacted with him.
Add "walls of lava", basically lava which blocks vision and
require a bit more than just levitation or flight to move through.
No levels use this yet, as testing isn't thorough enough.
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.
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
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.
Having a hardcoded relative path worked okay with the nmake Makefile
build but cause problems on a visual studio build. The CI caught that
right away.
Remove the relative paths, and add additional include directories for
the resouce compiler to search in the Makefile and in visual studio.
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.
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.
Remove some conditional code that isn't needed these days.
Use C99 fixed width integer types for all platforms, instead
of using it for some and Microsoft types for others.
A number of C compiler suites have a math.h library that includes a yn()
function name that conflicts with NetHack's yn() macro:
"The y0(), y1(), and yn() functions are Bessel functions of the second kind,
for orders 0, 1, and n, respectively. The argument x must be positive. The
argument n should be greater than or equal to zero. If n is less than zero,
there will be a negative exponent in the result."
At one point, isaac64.h included math.h, although that has since been removed.
Some libraries used in NetHack (Qt for one) do include math.h and that required
build work-arounds to avoid the conflict.
Rename the NetHack macro from yn() to y_n() and avoid the math.h conflict
altogether, eliminating the need for that particular work-around.
A recent commit to alloc.c by Keni drew attention to the fact that
there are extern prototypes scattered around in various .c files.
Those can make use of ATTRNORETURN (non-gcc compilers and C23) the
same way the prototypes in extern.h can, and they were overlooked
when ATTRNORETURN was first added.
Since tile files can now contain comments, incorporate the comments
that accompanied some contributions that were adopted back when
male and female tile differentiation became possible.
If the original contributing artist wants to alter their name or handle
that was used in any of the credits, or wants to change any comment text,
please send your corrections to devteam@nethack.org.
Or, better yet, do a pull request with your desired alterations.
Alternatively, if they are fine as they are, a note to devteam@nethack.org
acknowledging that would be welcome, but certainly not required.
Thanks again for contributing the tiles.
Issue reported by argrath: building with 'address sanitizing'
reported tile2bmp writing out of array bounds after the addition
of the generic object tiles.
'MAGICTILENO' in tile2bmp.c is extremely fragile. It was already
inaccurate before the generic tiles, but had a big enough value to
handle the final row of tiles prior to that.
Fixes#955
Add 17 fake objects to objects[], one for each object class. All
specific color as gray. They're grouped at the start--actually near
the start since "strange object" is still objects[0]--rather than
being among the objects for each class. init_object() knows to start
at [MAXOCLASSES] instead of [0]; other code that loops through every
object might need adjusting.
For potions, non-stone gems, and non-novel/non-Book_of_the_Dead
spellbooks that don't have obj->dknown set, display the corresponding
generic object rather the object itself. Fixes the longstanding bug
of seeing color for not-yet-seen objects whose primary distinguishing
characteristic is their color. Walking next to a generic object
while able to see its spot will set dknown and redraw as specific.
It's slightly disconcerting to have objects change as you reach them;
I hope it's just a matter of becoming used to that. (If there is any
code still changing the hero's location manually instead of using
u_on_newpos(), it should be changed to use that routine.)
Most of the new tiles are just a big rendering of punctuation
characters. The potion, gem, and spellbook ones could be cloned from
a specific object in their class and then have the color removed. I
started out that way but wasn't happy with the result. I'm not
artisticly inclined; hopefully someone else will do better. Each of
them is preceded by a comment beginning with "#_"; the underscore
isn't required, just being used to make the comments stand out a bit.
Invalidates existing save and bones files.
From the newsgroup: identifying by menu pops up multiple menus in
succession if the player picks fewer invent entries than are being
granted, but the second and subsequent ones could cover up the
message window and hide the feedback from prior ones.
If multiple popup menus are needed when identifying, issue --More--
before each menu after the first. The code seemed to be trying to
do this already, but it should have used wait_synch() rather than
mark_synch(), or perhaps used display_nhwindow(WIN_MESSAGE, TRUE)
instead of either one of those. For curses, both mark_synch() and
wait_synch() were no-ops. Now they do something. X11's behavior
wasn't right either; it seemed to be lagging one message behind
(something I had noticed recently and then forgotten about; I still
don't remember the context then so don't know whether this fixes
that earlier situation).
Accept
<start of line><optional whitespace>#<anything>
as a comment in win/share/{monsters,objects,other}.txt. Existing
<start of line><optional whitespace># tile <rest of line>
is grandfathered in as data.
It wouldn't take much more to accept
<data><optional whitespace>#<rest of line>
comments too but this hasn't gone that far.
Reading the colormap at the beginning of each of the three files
used "%[A-Za-z0-i]" to read one characer into a two-character array.
Change that to "%1[A-Za-z0-9]" so that it can't overflow the buffer
if the input data gets accidentally or maliciously mangled. (Not a
security issue.)
Remove a spurious blank line from objects.txt.
Also, clean up some warnings when compiling gifread.c for gif2txt
although I ultimately didn't do anything with that.
Also includes support by paxed for polearm targeting using the
frame color.
Also renames USE_TILES to TILES_IN_GLYPHMAP which is a more
accurate description.
Not all window interfaces have full support for the color framing
of the background square yet.
MS-DOS needs further work (to bring it to both VESA and VGA, with
and without tiles.
Windows GUI is missing support.
X11 and Qt have been started, but may require further refinement.
tilemap isn't linked with util/panic.o so doesn't have access to
panic(). Despite that, linking on OSX found panic() somewhere.
(It doesn't do format argument substitution, just prints out the
argument we pass as format string, then aborts.)
Instead of calling panic(), print a message to stderr, delete the
incomplete tile.c whose construction has failed, and exit with
failure status. Linking with panic.o wouldn't handle the message
and final failure but not help with the incomplete output file part,
so this hasn't done that.
I'm headed back to the drawing board for some tiles changes I was
attempting, but before tossing what I had I've extracted a modest
amount of cleanup for the code in win/share/tilemap.c. Some
formatting, a bit of generated formatting, make ENHANCED_SYMBOLS
less intrusive, and an error check to prevent a crash in tilemap
I triggered. Also avoid one in nethack caused by an object (not
included here) which had a description but no name.
This ended up combining several unrelated changes.
Add missing 'fixes' entry for curses-specific item in New Features.
When answering "Shall I pick ... for you? [ynaq]", accept \m as well
as \n and space for choosing the default of 'y', same as normal
ynaq() would. Also add '*' to '@' as not-shown potential answers;
they force 'random'.
When tty tore down any of the menus, things were reasonable if they
were short enough for corner windows, but tall ones that switch to
full screen weren't fully erased. The parts of those outside of the
map window stayed behind when the tall menu was closed and cleared.
Mainly affects picking the "~ - reset filtering" choice but also
affected the role menu on 24 line tty screens. (Didn't affect curses
because it tracks and refreshes its base window when some overlaying
window goes away.)
The role menu used 25 lines so required a second page for the case
of a 24 line screen on tty. Dealing with that is a bit ugly but it
wasn't an issue when this form of role selection was tty-only (because
the info about choices made so far was displayed on the base window
rather than in an extra menu line back then) so I added a hack for it.
If the role menu will take one more line than the screen height, the
separator between 'random' (below 'Wizard') and 'pick race first' gets
squeezed out. If the menu needs two more lines (doesn't happen now,
except by changing screen size to 23 lines for testing), a second line
gets squeezed out. (Not attempted for curses because it wouldn't
help. 'windowborders' and one or two extra separators it adds make
menus taller. I doubt if many players use curses on 24-line screens
but if they do, they'll be using something new rather than going from
something that used to fit on one page with 3.6.x.)
Move the tty role/race/&c selection from wintty.c to role.c and remove
its references to BASE_WINDOW. Have curses call the same routine now
so that the player has the option to choose role, race, gender, and
alignment in any order and to confirm or override random settings
prior to starting play. Also if you went through "who are you?" then
final confirmation includes an extra menu choice to rename the hero.
It still has the quirk of sometimes remembering some of the previous
aspects when you re-pick a new value for some aspect which already
been selected.
The menus pop up on top of the copyright screen and that looks a bit
strange. I don't think core code has any way to erase that base
window without erasing the entire screen so to fix the strangeness
the window ports would need to do that before calling the selection
routine. I didn't do that because the very first prompt, "Shall I
pick ... for you? [ynaq]" shows up in that window rather than in a
popup over it, and having it be all by itself on an otherwise blank
screen seemed to be even stranger.
X11 and Qt both have more sophisticated selection routines so I
haven't tried to switch either of them to use this. They both use a
fancy role-selection-specific menu with all the aspects present at
once so this wouldn't fit without more work than I care to tackle.
bkglyph variable gets initialized to GLYPH_UNEXPLORED so ends
up being returned by get_bk_glyph() if something more interesting
wasn't chosen in the switch statement.
The Windows win32 interface will then use the tile mapped to
GLYPH_UNEXPLORED as a background. The tile is 16x16 all black
pixels. That looked very odd.
Treat GLYPH_UNEXPLORED as an out-of-range value.
Closes#929