Commit Graph

3487 Commits

Author SHA1 Message Date
nhmall
329ffae7df simple O menu requires clear screen for symset 2024-05-12 08:10:36 -04:00
PatR
4927b2cc1b simplify #overview shop handling
Add the shop type variations used for automatically generated
annotations to the shop structure and get rid of the switch that
has been being used to pick them.
2024-05-08 14:17:11 -07:00
Pasi Kallinen
7139ee7446 Move light source and timer types so zero means none
Breaks saves and bones.
2024-05-06 19:58:21 +03:00
Pasi Kallinen
1a58ed8de9 Rework object deletion
Make object deletion work similarly to monster deletion:
it's marked for deletion (by setting the where-field to OBJ_DELETED
and moved to specific deleted-objects chain), but they're actually
freed at the beginning of turn.

This may need some more tweaking, especially in places that iterate
over object chains, but fuzzing did not find any obvious problems.

Fix a case of accessing freed memory: a monster breathed at hero,
destroying some items.  The code stored the next item in the chain
(a cloak), but a ring of levitation was destroyed, causing hero to
plop down into lava, destroying the cloak.  The item destruction
code then tried to access the destroyed cloak object.
Make the code check the object where-field - which will be different
if the object was marked for deletion.  Also removed an extra loop
going through the whole object chain looking for the items to
destroy.
2024-05-06 17:57:47 +03:00
Michael Meyer
b662134eba Fix: bill_dummy_obj billed excessively for stacks
Add a way to request that unpaid_cost() produce the cost for a single
item, which is necessary for the price adjustment made in
bill_dummy_object.  Another option would be to simply divide by quan in
bill_dummy_object, but this might be more future-proof in case
unpaid_cost ever involves more than simple multiplication by quan
(e.g. the use of alternate units vs the base price, as are used for
globs).

Fixes #1236
2024-04-27 18:42:50 -07:00
PatR
1f8db3a0f3 pull request #1238 - pit interaction when pool
underneath gets boiled away

Pull request by disperse:  when a water walking hero zaps a wand of
fire downward and it boils away the water, hero should fall into the
resulting pit.

The PR commit didn't handle monsters (who don't zap wands downward
but could be on/in water that's boiled out from under them).  And
while testing it I noticed that the existing code had message
sequencing issues (being enveloped in a cloud of steam before seeing
the water evaporate).  This ended up redoing the fix rather than
using the commit.

Fixes #1238
2024-04-27 18:37:42 -07:00
Pasi Kallinen
94dd316e80 Make saveoptions save changed autocompletions 2024-04-25 10:13:08 +03:00
PatR
9d71c8e1f4 Sunsword #invoke, directed at self
Give a resistance animation if you #invoke Sunsword while it's
wielded and direct its blinding ray at yourself.  Flashing a camera
at a monster who is wielding it will also produce the animation.
2024-04-19 10:50:46 -07:00
Pasi Kallinen
7db8f7c6a5 Fix mention_map and hiders causing a light source error
Prevent glyph change messages while loading a level file.
Otherwise a monster hiding under an item triggered a vision recalc
before light sources were linked to their sources, leading into
strange errors looking like pointer corruption.

getlev -> hide_monst -> hideunder -> newsym -> show_glyph ->
 pline_xy -> vision_recalc -> do_light_sources -> get_obj_location

Add in_getlev program state variable, analogous to in_mklev
2024-04-18 09:01:11 +03:00
PatR
064523e162 mon name of monster appearing as another monster
When a monster mimicks another monster (traditionally Double Trouble
Wizard, since 3.6.x also pet that eats a mimic corpse), using farlook
or getpos+autodescribe revealed the monster's real identity.  Hard to
believe that nobody ever noticed, but it was obvious when a pet dog
quick-mimicked a cat or vice versa.

Add an extra x_monnam() flag to ignore monst->m_ap_type==M_AP_MONSTER
plus monst->mappearance.  Only the m_monnam() variation of x_monnam()
includes it (via EXACT_NAME); monnam() and the rest will now describe
an M_AP_MONSTER by its appearance rather than as its true self.
2024-04-17 14:40:20 -07:00
PatR
29b4c47bdf fix #K4142 - camera flash vs mimic
When a camera flash hit a mimic which was posing as something, the
feedback mentioned the mimic but didn't bring it out of hiding.

Change to make light pass over a mimic impersonating an object but
unhide one impersonating furniture.  Ones impersonating some other
monster are woken up but wakeup doesn't force it back to mimic shape.

Trying to get the messages right brought on more code changes than
antipated.  I changed one of the arguments to mhidden_description()
so had to change its callers; fortunately there aren't very many.
2024-04-16 23:34:26 -07:00
Pasi Kallinen
3086f16386 Shopkeepers bill you for using their bear trap or land mine 2024-04-13 15:10:15 +03:00
Pasi Kallinen
a57d0e6f4f Curses: add support for the palette config option
Depends on CHANGE_COLOR compile-time option.

Also allow multiple palette-definitions in the config file.
2024-04-13 12:01:43 +03:00
nhmall
15db874f71 CHANGE_COLOR palette option adjustments
It was too early to call the windowport change_color() routine
while processing the config file. The windowport was not yet
fully operational.

Now the palette option processing will just place the rgb
value into the appropriate ga.altpalette[CLR_MAX] entry.

init_sound_disp_gamewindows(void) [allmain.c] calls
change_palette() [coloratt.c] and it will call the windowport
change_color() function for each ga.altpalette[] entry that
has been set.

Notes:
The rgb values stored in ga.altpalette[] have the NH_ALTPALETTE bit set
so that the rgb value of 0 can be stored and be distinguishable from
a "not set" entry.

The NH_ALTPALETTE bit is cleared from the rgb value in change_palette()
prior to calling the windowport change_color() function.

The syntax for palette is colorname/r-g-b.
For example: palette:black/12-12-12

colorname must be one of the NH_BASIC_COLOR names or a suitable
alias for one of those 16 entries.

Some of the windowport CHANGE_COLOR functions had the wrong parameters,
perhaps due to bitrot. Those have been corrected to match the prototype.
2024-04-12 21:57:27 -04:00
Pasi Kallinen
f15035868c Change Nalzok and Minion of Huhetotl to bright red
Disambiguate them from all the other red major demons.
The tiles are already bright red.
2024-04-11 21:39:22 +03:00
PatR
7da370d74a experimental hitpointbar change
For tty, make hitpointbar blink if current HP falls to the critical
HP threshold.  Doesn't require status highlighting.  Not changed:
when status highlighting is active, use the HP color but force the
attribute to be inverse (plus blink if the criterium is met) rather
than whatever the HP highlight specifies.

For curses, do the same thing.  It used to honor HP attribute for
hitpointbar, now it behaves the same as tty:  always inverse, maybe
combined with blink.  The new code assumes that inverse and color
can be turned off without turning off active blink in the process.

I had intended to make hitpointbar be a full-fledged status field
(which happens to be rendered on top of title) so that it could be
highlighted differently from hit points (mainly so that one could
highlight up and down changes while the other showed percentages).
This is less versatile than that but much simpler.
2024-04-11 11:06:29 -07:00
Pasi Kallinen
f1c77aa2fd Pets avoid a location hero just kicked
If hero kicks a location, pets and peacefuls will avoid moving
into that location for that turn.
2024-04-11 18:05:18 +03:00
Pasi Kallinen
62b78ba037 Hero movement affects water bubble direction 2024-04-10 21:57:05 +03:00
PatR
fc56ca0767 barbded devil and ice devil difficulty ratings
I enabled 'extmenu' and went through all the extended commands under
curses and try to find out what github issue #1229 refers to and
didn't spot anything out of the ordinary, except for #wizmondiff
which reported that the calculated diffculty ratings for ice devil
and barbed devil didn't match the values in their definitions.  They
were each given an extra ability about 6 months ago and it was enough
to have a higher rating.

Issue #1239 remains open.
2024-04-08 15:59:05 -07:00
Pasi Kallinen
0c29f88d0e Move showdamage to Advanced options 2024-04-07 17:19:25 +03:00
Pasi Kallinen
7ecc778173 Curses: fix pile hilite background color
The curses colorpair rework I did changed the pile hilite background
color from blue to red. Change it back to blue, and use a function
to get the color pair instead of hardcoding the value.
2024-04-05 20:15:21 +03:00
Pasi Kallinen
969c87c0a1 Unblind telepathy range and carried artifacts 2024-04-05 09:44:52 +03:00
Pasi Kallinen
28ed8e7962 Unblind telepathy range
Unblind telepathy range depends on the number of telepathy granting
items worn.

Breaks saves.
2024-04-04 23:22:28 +03:00
PatR
ca5fd442b8 fix is_cmap_stairs() and is_cmap_lava()
A couple of predicates in sym.h didn't cover all the relevant map
symbols.

is_cmap_stairs() only affects the MS-DOS position-bar.  It appears
that it would have been overlooking the extra stairs to the mines
and to sokoban but I have no way to verify that.

is_cmap_lava() affects getpos() and #lookaround.  lava-wall wasn't
being treated as lava.
2024-04-04 06:44:23 -07:00
Pasi Kallinen
f0fdd3c371 Make hero polyed into fog cloud emit clouds
Also prevent cloud creation giving a message, if it was a single
cloud on hero and deals no damage.
2024-04-04 12:17:44 +03:00
Pasi Kallinen
e2d3368b0e Make hero polyed into hezrou also stink 2024-04-04 11:22:20 +03:00
Pasi Kallinen
defb5d5f80 Pets considered any noise made by hero as whistling
In 3.6.2 parts of the wakeup code were merged together, and this
caused pets consider any noise made by the hero - such as hitting
iron bars or digging - as whistling for them to come to the hero.

Change it to only consider actual whistling and ringing a bell.
2024-04-03 12:46:15 +03:00
Pasi Kallinen
c4d4bafb44 Fix NO_TERMS compile, rename func
... to match others, from tty_curs_set to term_curs_set
2024-04-02 14:31:33 +03:00
Pasi Kallinen
7030b0b9fe tty: hide cursor unless waiting for user input
Use vi (cursor_invisible) and ve (cursor_normal) to hide and show
cursor, if the terminal supports those.  This way on a slower
connection the cursor doesn't jump all over the place when doing
map or menu updates.
2024-04-02 10:28:20 +03:00
nhmall
e00e423262 remove leading period from Windows template file 2024-03-31 13:53:48 -04:00
Pasi Kallinen
c71e8ec8d4 Sunsword can be invoked to create a blinding ray 2024-03-31 19:43:33 +03:00
nhmall
a1a1049890 follow-up for an apparent conflict in Qt5 2024-03-29 16:10:33 -04:00
nhmall
af3a0db083 onefile fix 2024-03-29 07:02:04 -04:00
PatR
e4ffda7386 blanking novels
Simplify converting novels into blank spellbooks via water damage.
Since that can occur, update cancellation to do it too.
2024-03-28 23:44:34 -07:00
nhmall
80fb1b5f54 provide way for developer to verify custom colors and symbols in effect
' #wizcustom
2024-03-25 20:42:48 -04:00
nhmall
7f2af9698f put wintty.c and termcap.c logic to previous 2024-03-25 09:38:54 -04:00
nhmall
e3409fd4af reinstate 256 color 2024-03-24 23:47:24 -04:00
nhmall
29495f77f7 runtime toggle of ENHANCED_SYMBOLS customsymbols 2024-03-24 19:39:36 -04:00
nhmall
0b35079acc add customcolors option
customcolors (default) and !customcolors toggle whether the
custom colors get applied to the glyphmap.
2024-03-24 16:55:23 -04:00
nhmall
d15ab932e7 more code moves
move an ENHANCED_SYMBOLS function from glyphs.c to utf8map.c
2024-03-24 15:36:19 -04:00
nhmall
750cf7f619 rename glyphmap nhcolor field to customcolor 2024-03-24 11:04:31 -04:00
nhmall
ec8f237960 config.h comment update 2024-03-24 10:27:42 -04:00
Pasi Kallinen
f131942dd2 Another tamedog message
Give a different message when a peaceful creature was tamed.
Allow suppressing this and the previous message, when the caller
handles messaging.
2024-03-24 10:48:29 +02:00
PatR
d2928ce2ba symset customization warning fixes 2024-03-23 13:39:23 -07:00
nhmall
ba00dc9066 sever extracolors from utf8map and ENHANCED_SYMBOLS
move the custom color data into its own field in the glyphmap
and disassociate it from the unicode/utf8 stuff.

move the glyphcache stuff during options processing and parsing
into new file glyphs.c and out of utf8map.c, and make it
general, and not part of ENHANCED_SYMBOLS.

Do the groundwork for allowing glyph color customizations to
work when any symset is loaded and not restrict it only to
the enhanced1 H_UTF8 symsets.

The customizations in effect are still affiliated with a particular
symset.

Also closes #1224, but the PR itself references a data structure
made obsolete by this commit. The curses comment from the PR was
added into the code.

The PR also made several suggestions, but only the first
one has been included in this commit (and no longer based on
the handler), that being:
"allow defining colors if other symbol handling modes are used
(possibly limited to the standard 16 colors)."

FredrIQ also wrote the following suggestions in PR#1224:

Something I was also contemplating, unrelated to implementation of this
support in curses, would be the ability for the following:

allow defining colors if other symbol handling modes are used (possibly limited to the standard 16 colors)
allow defining attributes (for example: glyph:G_pet_female_kitten:U+0066/red/underline)
allow specifying glyphs as wildcards for defining global color/attribute changes

Something I also want to see are keywords for "don't change the current defined data". If this
were to be added, you could for example do this:
OPTIONS=glyph:G_*_fox:U+0064/blue
OPTIONS=glyph:G_statue_*:basechar/gray/underline
for "make all foxes use a blue color, make all statues gray with underline" without needing
to specify the relevant character for every statue. This ("basechar", "basefg", etc)
should perhaps also be added for MENUCOLORS and statushilites, so that you can, for
example, underline all items being worn without needing to specify a bunch of
near-duplicate rules for combining BUC colors + underline worn items
as per #1064
2024-03-23 15:36:22 -04:00
PatR
ef17c7ac2b unix check_panic_save
Inspired by self-recover, sort of.  Enabled for unix by default; can
be disabled by commenting out '#define CHECK_PANIC_SAVE' in unixconf.h.

When starting the game, if there is no save file to restore and no
lock/level files to recover, check whether a panic save file exists.
If there is one, tell the player that it's there and that it might be
viable, then ask whether to start a new game.

It doesn't convert the panic save into a reconverable one (rename by
nethack, then continue trying to restore) or tell the player how to
make it viable (rename to remove ".e" by game admin), just whether it
is present.  If player opts to start a new game, the panic save is
left alone and will trigger the "there's a panic save file" situation
again once the new game finishes and player starts another.
2024-03-23 10:11:35 -07:00
Pasi Kallinen
e0cb6e2206 Query menu for putting ring on left or right hand 2024-03-23 13:22:29 +02:00
Pasi Kallinen
9a870b5f06 Option to use a menu to answer yes/no prompts
Add a new boolean option 'query_menu'. If on, game will pop up
a menu for specific yes/no questions, instead of using an input prompt.
2024-03-22 19:19:57 +02:00
PatR
9ba0cf2ff0 fix memory leaks for #quit while in tutorial
The new change to reset discoveries and monster-stats when exiting
the tutorial used dynamic data which wouldn't be freed if player
used #quit and declined to resume the regular game.

It turns out that such a leak was already present for start-of-game
inventory that gets stashed away during the tutorial.

In both cases, it could happen at most once per game so wasn't a big
deal as far as memory leaks go.
2024-03-21 15:28:13 -07:00
PatR
826dab9425 artilist.h formatting
When bulk reformatting took place prior to 3.6.0, the
\#if 0 "Palandir of Westernesse" #endif
block was left as-is, making it different from all the ones that
changed.  Reformat it manually, a shorten a couple of wide lines.
2024-03-20 11:01:36 -07:00