Pasi Kallinen [Thu, 2 Feb 2023 17:04:48 +0000 (19:04 +0200)]
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.
Pasi Kallinen [Wed, 1 Feb 2023 08:23:20 +0000 (10:23 +0200)]
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.
nhmall [Tue, 31 Jan 2023 05:45:27 +0000 (00:45 -0500)]
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.
nhmall [Mon, 30 Jan 2023 17:07:03 +0000 (12:07 -0500)]
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.
Pasi Kallinen [Mon, 30 Jan 2023 15:07:40 +0000 (17:07 +0200)]
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.
Pasi Kallinen [Mon, 30 Jan 2023 10:39:32 +0000 (12:39 +0200)]
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.
nhmall [Sun, 29 Jan 2023 03:43:48 +0000 (22:43 -0500)]
soundlib in the Makefile hints updated
Move pieces of the Makefile hints sound-related changes that
are not macOS-specific from sys/unix/hints/macOS.370 to some new
include files. The WANT_MACSOUND block stays in
sys/unix/hints/macOS.370 because it is system-specific.
Before this change, the various Makefiles were assembled via
hints files macOS.370 or linux.370. Both were using included
portions from the following files in the sys/unix/hints/include
directory, in this sequence:
After this change, the various Makefiles will still be assembled
via hints files macOS.370 or linux.370. They will continue to use
included portions from the following files in the
sys/unix/hints/include directory, but with three additional
include files related to sound and soundlibs. This is the new
sequence:
The include mechanism continues to allow common portions that can
be shared between macOS and Linux to be maintained in a single
place only, with minimal duplication. Now, that has been extended
to include Makefile lines related to sounds and soundlib.
Pasi Kallinen [Sat, 28 Jan 2023 18:01:07 +0000 (20:01 +0200)]
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?
Pasi Kallinen [Sat, 28 Jan 2023 17:11:29 +0000 (19:11 +0200)]
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.
PatR [Fri, 27 Jan 2023 19:01:24 +0000 (11:01 -0800)]
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.
PatR [Thu, 26 Jan 2023 22:05:03 +0000 (14:05 -0800)]
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.
PatR [Thu, 26 Jan 2023 17:10:24 +0000 (09:10 -0800)]
\#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.
Michael Meyer [Wed, 25 Jan 2023 20:11:14 +0000 (15:11 -0500)]
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.
nhmall [Thu, 26 Jan 2023 05:49:11 +0000 (00:49 -0500)]
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.
nhmall [Wed, 25 Jan 2023 20:21:30 +0000 (15:21 -0500)]
Fix potential warning in music.c
I saw this included in PR966, but it has nothing to do with the
use-after-free that the pull request is meant to fix. It should
get applied independently of that pull request.
Pasi Kallinen [Tue, 24 Jan 2023 13:23:28 +0000 (15:23 +0200)]
Split hmon_hitmon into multiple functions
hmon_hitmon was the biggest function by far; this makes it far more
manageable.
There should be no change in functionality, and although I didn't
test every case, this was just moving chunks of code and changing
variable names until compiler did not complain anymore.