Commit Graph

3949 Commits

Author SHA1 Message Date
PatR
197d8130d0 Qt extended commands enhancement
For Qt's pick-an-exetended-command dialog, allow a player to
toggle the grid layout from column-oriented to row-oriented
and vice versa and when in wizard mode to cycle the set of
shown (and typable) commands from 'all' to 'normal mode-only'
to 'wizard mode-only' back to 'all'.  The most recent values
are saved by Qt along with tile size, font size, and some other
stuff.  The extended command dialog has a Reset button to force
them (the two extended command values) back to their defaults.

The dialog layout has a slight change to conserve screen space
as well as three additional control buttons:
Was                                  Now
| [             Cancel            ]  | [Cancel] [Filter][Layout][Reset ]
|#                                   |#            Grid Title
|             Grid title             | [cmd 1] [cmd R+1] [cmd 2*R+1] ...
| [cmd 1] [cmd R+1] [cmd 2*R+1] ...  | [cmd 2] [cmd R+2]
| [cmd 2] [cmd R+2]                  |...
|...                                 | [cmd R] [cmd 2*R]
| [cmd R] [cmd 2*R]
'#' is the prompt where typed text gets echoed and 'R' is the
number of rows in the grid and varies by the set of commands
from the current filter.  Grid dimensions have been adjusted:
'all' is 13x9, 'normal' is 13x7, and 'wizard' is 7x4 or 4x7
depending on layout orientation.

The wizard mode-only filter setting probably isn't very useful
because you can only type--or click on--commands which are
visible.  So when set to wizard mode-only, you can't #quit for
instance.  (Via extended command; there are still menu choices
for that particular action.  And it's trivial to change filter.)
2020-12-06 02:58:05 -08:00
PatR
edefa14834 readable conical hats
Let tourists read cornuthaum ("WIZZARD") and dunce cap ("DUNCE").
One out of three will have those words, the other two will yield
"you can't find anything to read on this ___" where ___ is either
"conical hat" or "cornuthaum" or "dunce cap" depending upon hat
type and discovery status.

Even when a dunce cap says "DUNCE" it won't become discovered,
just offer the player an opportunity to apply a name.

Other roles still fall through to the "That's a silly thing to
read" feedback.

Not intended to be logical...
2020-12-05 12:29:38 -08:00
Pasi Kallinen
55b4946305 Fix AD_DCAY mhitm armor erosion type 2020-12-04 19:05:24 +02:00
PatR
0ba4184206 couple more command tweaks
Rename "seegold" to "showgold".  The character to invoke it ('$')
is similar to those for the various "seeXYZ" commands ('[','=',&c)
but unlike them, it isn't part of "seeall" ('*').

Expand or replace the one-line description of several commands
(shell, showgold, showtrap, suspend, versionshort).
2020-12-04 02:58:03 -08:00
Pasi Kallinen
d28489e55d Fixes bit for mhitm/uhitm/mhitu unification 2020-12-04 09:49:24 +02:00
PatR
3e7283e8fd Qt fix for typing "#version"
The #version command is a leading substring of the #versionshort
command and for Qt, it couldn't be executed by typing, only via
mouse click or one of the Qt-specific menus.  #version<return>
or #version<space> now works for that.

The #versionshort command ought to be renamed to something else.
2020-12-02 16:11:53 -08:00
PatR
4d6a140d34 saving vs ball&chain
I started activating new program_state.saving and discovered that
saving of ball and chain could access freed memory.  The change
for the former and fix for the latter are mixed together here (but
easily distinguishable).

The saving flag inhibits status updating and perm_invent updating,
also map updating that goes through flush_screen().  That should
fix the exception triggered after an impossible warning was issued
during a save operation.  impossible() goes through pline() which
tries to bring the screen up to date before issuing a message.
During save, data for that update can be in an inconsistent state.

The code to save ball and/or chain when not on floor or in invent
(I think swallowed is the only expected case) was examining the
memory pointed to by uball and uchain even if saving the level had
just freed floor objects and saving invent had just freed carried
objects.  So for the usual cases, stale pointer values for uball
and uchain would be present and checking their obj->where field
was not reliable.
2020-12-02 06:29:58 -08:00
nhmall
2c19db61aa daily cron update doc/Guidebook.txt 2020-11-30 20:22:18 -05:00
PatR
516af11dc7 reduce the number of #seeXYZ commands
Noticed while working on Qt's extended command handling, there
are an awful lot of "seeXYZ" commands.  Keep the inventory display
ones (named versions of ')' to show wielded weapon(s), '[' for
worn armor, '"' for worn amulet, &c) and rename the others:
| #seenv     -> #wizseenv     debugging command
| #seespells -> #showspells   '+' command
| #seetrap   -> #showtrap     '^' command

Also, expand the descriptions of #shell and #suspend a bit in
the Guidebook.  LaTeX version is untested.
2020-11-30 16:16:14 -08:00
PatR
f8fcab3400 move 'g.restoring' to 'g.program_state.restoring'
Move the core's global restoring flag (not the same as main()'s
local resuming flag) to a more logical place.  Add a saving flag
in the process, but it isn't being set or cleared anywhere yet.
(Once in use it will probably fix the exception during save that
was just reported, but before that it would be useful to figure
out what specifically caused the event.)

The program_state struct really ought to be standalone rather
than part of struct g but I haven't made that change.

Removing an unused variable for wishing and some reformatting
that whent along with it got mixed in.  Removes some trailing
whitespace in sfstruct.c too.

Only lightly tested...
2020-11-30 11:40:21 -08:00
PatR
69dd0485fb Qt message window: horizontal scrolling
Multiple stints of flailing about without a clue finally led to
a breakthrough.  When writing a new message to the multi-line
message window, force the view back to showing the starts of
lines if player has scrolled it to the side and left it that way.
Put another way, if it has been scrolled to the right, scroll it
as far as possible back to the left.
2020-11-29 16:58:56 -08:00
nhmall
0d6481ad8c spelling correction tidbit
Closes #415
2020-11-28 08:59:03 -05:00
PatR
daf1381cc2 autodescribe vs MSGTYPE
I was baffled about why moving the cursor across a fire elemental
kept putting up --More-- until I remembered that I once used
 MSGTYPE=stop "[Ff]ire"
to test Qt's handling for that.  Turns out that I left it in my
config file.  autodescribe feedback should not be honoring that;
honoring MSGTYPE=norepeat is not as clear-cut but this disables
it too.

User sounds were also kept enabled during autodescribe but I have
no way to test them.  Like norepeat, disabling just falls into
place.

The pline.c change is unrelated.  It just eliminates a wide line
(from adding 'g.') in the source by using a shorter variable name.
2020-11-27 11:10:44 -08:00
PatR
bb9df368af fix github issue #401 - roast/rust/rot in peace
This tries to fix the problem of the extra message when a tame
golem is completely destroyed (paper or straw golem burned, iron
golem rusted, wood or leather golem rotted) being issued at odd
times.  I basically punted on the visibility aspect since the
original logic was strange:  you had to be able to see both the
attacker's and defender's spots and at least one of those two
monsters.  Now mon-attacks-mon visibility requires that you be
able to see one of the two and if you don't see both, the unseen
one will be referred to as "it".  The "may the iron golem rust
in peace" message is independent of that and may be displayed
after "you have a sad feeling", but now that's intentional and
will refer to an unseen pet by name or monster type, not "it".

This needs a lot of testing and hasn't attempted to address
issue #402:  only some attacks that should compeletely destroy
a golem actually do so.  (So a hit by fire elemental against a
paper golem does, but passive fire counterattack when a paper
golem hits a fire elemental doesn't, nor does a wand of fire
or being hit by Firebrand.)

Fixes #401
2020-11-27 02:38:17 -08:00
PatR
ec153a27bd options help
The revamped options handling was't doing dynamic help properly.
After listing the booleans, it listed them again amongest the
compound options.  Since their description field is Null, that
could be a big problem.  sprintf(buf,"%s",NULL) on OSX produces
"(null)" but most sprintf()'s would probably crash instead.

The 'other' options (autopickup exceptions, menucolors, &c) were
not listed at all.  (I don't remember whether that was also the
case before the revamp.)  Now they're listed but not explained.

The 'msg_window' description was unhelpful; this replaces it.
A couple of others were longer than necessary so they've been
shortened.  The rest of optlist.h is reformatting wide lines.

Recently added 'safe_wait' option was included in the Guidebook
but not in dat/opthelp; add it.
2020-11-26 02:20:00 -08:00
PatR
2db51cf8bd fix #K3016 - kicking a bag of gold in a shop
Kicking a container that had gold in it took the gold amount
away from hero's credit or added to hero's debt, then didn't
give a refund if the container and its gold landed within the
shop.  Throwing behaved likewise, just less verbosely.

The problem is caused by addtobill() treating gold specially
and then subfrombill() not being able to perform a reverse
operation.  Actually, it may be possible for subfrombill() to
do that, but verifying all its uses is too much work.  This
moves the gold handling for drop+selling into its own routine
and adds calls to that for the throwing and kicking refunds.
The other calls to subfrombill() outside of shk.c appear to be
ok as-is.  (The calls inside that file are the ones that still
need evaluation if the gold handling is to move to there.)

bill_dummy_object() now uses the same o_id assignment for its
dummy object as split_object() does for its new partial stack.
I don't know whether the old code led to any price glitches.
2020-11-25 14:33:14 -08:00
PatR
6df9ebc1af add Guidebook description of rogue level
This is in response to the bug report we got however long ago
about the map display breaking when the [unfamiliar to player]
rogue level was reached.  It probably wouldn't have helped back
then since the subset of players who read the documentation is
about same subset as those who expect the Spanish Inquisition.

I wasn't sure whether appending "'s" to an italicized word
should be italicized itself and made it revert to the regular
font instead.  That should be changed if it's incorrect usage.
2020-11-25 10:21:43 -08:00
PatR
dde70b8d4a Guidebook bit: ascii_map and tiled_map
|ascii_map:
|If NetHack can, it should display an ascii character map if it can.
|tiled_map:
|If NetHack can, it should display a tiled map if it can.

Remove the "if {NetHack,it} can" redundancy and expand a little bit.

Also, alphabetize "tiled_map" as if the underscore were a space
instead of something that happens to collate after letters.

As usual, the Guidebook.tex changes are untested.
2020-11-25 09:15:20 -08:00
PatR
7e87abb66f wizard mode buglet: simultaneous Lev+Fly timeout
Noticed while working on Qt status highlighting:  if levitation
and flying timed out at the same time, first Lev timeout called
float_down() which reported
 You have stopped levitating and are now flying.
and then Fly timeout left stale "Fly" on the status line due to
an optimization which got subverted.  ('was_flying' flag was
False due to Fly being blocked by Lev; that's correct behavior,
but the flag is effectively a cached value that becomes stale
when the Lev timeout code executes.)

The bug was wizard mode only because #wizintrinsic is the only
way to get timed flying.
2020-11-24 10:43:12 -08:00
PatR
f43421ae3c create monster creating concealed mimic revisisted
commit 03d7d64d15:
| [...] but fixing this specific case is trivial.

Not trivial enough to avoid getting the details wrong.  An old
commit log message (58137a608a,
June of 2006) claimed that this was fixed for bag of tricks but
that was for monsters in general; mimics could still be wrong.
2020-11-22 00:32:11 -08:00
PatR
efea46a93d tty: selecting gold in menus
Requested by a beta tester nearly four years ago: '$' is both an
inventory "letter" and a group accelator.  The letter only works
if gold is on the current menu page and was taking precedence
over the group accelator.  Allow '$' to toggle selection of gold
regardless of the page.

curses already behaves this way.  X11 and Qt menus aren't
paginated so also pick gold even if the '$' entry in the menu
isn't visible at the time.  No idea about Windows GUI...
2020-11-21 18:21:16 -08:00
PatR
3e9d8f9aa5 'showscore' vs containers
When SCORE_ON_BOTL is enabled, you could tell how much gold is
inside a container with unknown contents by having 'showsore' On
and watching how much the score changed on the status line when
picking the container up.
2020-11-21 17:37:01 -08:00
PatR
d48e730700 ki-rin body parts
Use horse/unicorn body parts.  The result for HAIR is "mane"
which is appropriate.  There's no field for SKIN so the question
of whether to specify "scales" is moot.  (Snakes and dragons
describe HAIR as "scales" but that wouldn't be right for ki-rin.)
2020-11-21 03:46:53 -08:00
PatR
03d7d64d15 create monster creating concealed mimic
From an old bug report (sent directly to devteam, June of 2017):
wand or scroll of create monster becomes discovered if it makes
a mimic that is concealed as an object or as furniture within
the hero's view.  Fixing this in the general case [when does
seeing a mimic as something other than a monster mean that the
mimic is being seen?] is a massive can of worms, but fixing this
specific case is trivial.
2020-11-20 18:56:35 -08:00
PatR
27b93148c0 ki-rin's horn
Let ki-rin cure themselves (of being stunned, confused, or blinded)
with their own horn, and make them be poison resistant.  They
aren't unicorns but their horn is very much like a unicorn horn.
They're flagged no-corpse so this hasn't changed them to leave
behind a horn upon death.

They were flagged as animals who neighed but they are also spell
casters.  I took the animal flag off (they're still no-hands so
shouldn't be able to use items; also, unicorns aren't flagged as
animals either) and changed sound to 'ms_spell'.
2020-11-18 11:16:21 -08:00
nhmall
9aeb4db3b2 wasm-bug-fixes-2 github PR #412 2020-11-18 08:21:07 -05:00
nhmall
03d1eed0b5 daily cron doc/Guidebook.txt update 2020-11-17 09:14:47 -05:00
PatR
cb8baa1d1c Qt status overhaul: add support for 'statuslines'
Condense the Qt status slightly, moving Alignment field from the
Conditons line to the Characteristics line and the Time and Score
fields from their own possibly blank line to the HP,&c,Gold line.

That's for statuslines:2, which is the default.  statuslines:3
restores the previous layout.  I tried to make that become the
default for Qt but it got messy fast and I gave up.

I also tried to make changing 'statuslines' back and forth on the
fly work but failed.  I left the code in as #if DYNAMIC_STATUSLINES
but that isn't defined anywhere.  For the time being at least,
'statuslines' is config file or NETHACKOPTIONS only for Qt, not
changeable via 'O' like for curses and tty.

Change the option description for 'statuslines'.  That depended
upon whether curses was compiled in when it should depend on which
interface is active.  This moves the alternate info to Guidebook.
2020-11-17 05:07:09 -08:00
PatR
98075ebfe8 auto-cursing helmet vs perm_invent
I though that I noticed a problem but later couldn't reproduce
it, so this might not be redundant.  Update persistent inventory
when putting on a helmet causes it to become cursed.

Minor change:  if blind at the time, hero loses knowledge of BUC
state.
2020-11-16 18:08:02 -08:00
PatR
08310c8a71 Qt status
Try to set the initial window sizes to be big enough to show the
full welcome line in the message window when the Qt settings
(Preferences on OSX) specify Large font (Huge/Medium/Small/Tiny
seemed ok but I wasn't systematic about checking them).

While at it, I added a long comment about the status window format
and noticed a bug with experience formatting there.  Again only
seemed to matter for Large font but the change to fix ignores font
size.

Plus add a couple of Qt "issues", one old and one just discovered.
2020-11-13 17:15:04 -08:00
PatR
e647eab6dc fix github issue #410 - mon throwing c'trice egg
If a monster threw a cocktrice egg that hit and petrified another
monster, the hero would credit (experience) and blame (possible
alignment penalty, &c) for it.

Fixes #410
2020-11-13 16:52:45 -08:00
Pasi Kallinen
6ec55a3624 Rework stairs structure
Use a linked list to store stair and ladder information, instead
of having fixed up/down stairs/ladders and a single "special" (branch)
stair.

Breaks saves and bones.

Adds information to migrating objects and monsters for the dungeon
and level where they are migrating from.
2020-11-13 20:27:17 +02:00
PatR
e23f764d11 fix #K2924 - breaking a wand without free hands
Breaking a wand didn't require the hero to have free hands.
That's definitely a bug when they're both welded to the same
two-handed weapon.  It's debatable when welded separately to
a one-handed weapon and to a shield but simpler to pretend
there's no such distinction.

This also makes glass wand join balsa wand as "fragile".  Hero
doesn't need as much strength to break them as other wands and
the wording for breaking them is slightly different.

My fixes entry initially had a trailing space.  When I took
that out, I spotted a couple of others so take those out too.
2020-11-12 04:30:25 -08:00
PatR
ea0ef81ecd fix github issue #408 - stuck to distant mimic
Attacking a concealed mimic at range by applying a polearm
could make the hero be stuck to that mimic in addition to
bringing it out of hiding.  Only do that when adjacent.

This also adds a new sanity check when setting u.ustuck.
It may get triggered by other sticking activity since only
attacking has been tested.  The check must be explicitly
enabled by setting the wizard mode 'sanity_check' option.

Fixes #408
2020-11-08 16:07:42 -08:00
PatR
096511b509 github pull request #406 - polyfodder() macro
Some eggs and tins could cause an out of bounds index into the
mons[] array.  Post-3.6 bug: the faulty part of the test is only
relevant for 3.7 genetic engineer monster.  Earlier versions just
called pm_to_cham() which does it's own index validation.

Fixes #406
2020-11-05 16:03:05 -08:00
PatR
e4106bb161 Qt text windows
Text window search behaved very strangely:  at some point after
selecting [Search], entering a search string, having the string
entry popup go away, and having the search performed, but before
the result could be shown, the text window got pushed behind the
main window (map+messages+paperdoll+status).  Clicking on the
main window's minimize button hid the main window and gave access
to the text window behind it.  That was still functional even
after having been inaccessible; another search could be performed
and/or it could be dismissed.  I still don't know what causes
that or how to properly fix it, but using raise() is a workaround
to bring it to the front where it belongs.  Unfortunately you can
see it go away and come back so searching for text is distracting.

Allow <return> (when not searching) to dismiss all text windows
including RIP.  Accept ctrl+[ as ESC.

Make text window searching be case-insensitive.

Searching wouldn't find a match on the first line of text.  Now
it will.

This also includes an attempt to fix github issue #400 (typing a
pickup command while "things that are here" popup text window is
displayed seems to hang the program), but since I can't reproduce
that, I can't tell whether the fix works.  The issue description
says that pickup started executing and "things here" couldn't be
dismissed which is different from "things here" being behind the
map waiting for it to be dismissed.  The attempted fix is for text
window handling to tell Qt that it wants control of the keyboard,
so nethack shouldn't see any attempted pickup command.
2020-11-05 15:35:30 -08:00
nhmall
b37116b0f9 merge pr #403 wasm fixes
Closes #403
2020-10-31 09:30:38 -04:00
Pasi Kallinen
91c46ab54b Restful sleep regenerates hp
When sleeping due to wearing an amulet of restful sleep,
hit points will regenerate, one point faster than with normal regeneration.
2020-10-29 19:14:32 +02:00
PatR
70e4f5b197 Qt: new game vs saved game selection
If player got Qt's saved game selection widget at startup but
picked "new game" there, the save file for the last character
in the list of saved games would be clobbered with the new
character's game if a save was performed.  It wasn't necessarily
easy to spot because saved game selection shows the character
name from inside the file rather than from the file name, so the
next restore would look normal except for one older character
missing.

Noticed while testing:  when you used the character selection
widget (either by picking "new game" in saved game selection or
because there aren't any save files), if you blanked out the
name field or it was already blanked because a generic name like
"player" had been specified, then clicked on "play", the program
would get stuck in a loop somewhere.  I didn't try to figure out
where, just changed qt_askname() to revert to original name if
it ended up with a blank one.
2020-10-27 15:10:22 -07:00
PatR
14ec98a241 Qt saved game selection
This fixes the Qt popup widget for selecting among saved games.
The character name from each applicable save file is shown in a
button and clicking on one of those buttons restores corresponding
file.  Previously all the buttons were written on top of each
other so only the final name was visible and the button for the
initial name received the click.  The widget also has [quit] and
[new game] buttons.

This fixes restoring an existing save file if no character name
is supplied on the command line in the options.  It does not fix
the problem where picking [new game] remembers the file name of
the last saved game in the popup's list and overwrites that file
(after requesting confirmation to do so) if/when you eventually
save.  The resulting file will contain the character just saved
but be named for the earlier one.  It may not be obvious because
on subsequent restores it will list names from inside the files
rather than deduce those from file names, so the clobbered/
misnamed file will just show up as the former new character.
2020-10-26 22:37:40 -07:00
PatR
9c384ba867 Qt popup dialog input vs '&'
I'm not sure whether any yn_function() calls include ampersand
in the list of acceptable choices but if any did, the button
for that character would have shown up blank.  (Clicking on it
would have successfully produced '&' as player's input though.)
2020-10-26 12:44:40 -07:00
PatR
ec5772d6d2 Qt hitpointbar
Add support for the 'hitpointbar' to the Qt interface.  Rather
than rendering the status title (name+rank or name+monster_species)
using inverse video for leading substring to produce distinct left
and right sides, draw a horizontal bar above that field.

The left portion (current health) is thicker and uses red for <10%
or <5hp, orange for <25% or <10hp, yellow for <50%, green for <75%,
blue for <100%, and black for 100%.

The right portion (missing maximum health) is thinner and runs
from white (paired with red), light gray (paired with orange),
dark gray (with yellow), plain gray (which turns out to be darker
than dark gray, with green), dark blue (with blue), and black (but
black is never shown for injury portion because that's suppressed
when at full health).

Qt already supports a square frame around the hero's map tile that
changes color according to health.  Turning the hitpointbar option
Off or On has no effect on that.
2020-10-25 15:47:49 -07:00
Patric Mueller
4e1cf071ae List lamps and lanterns in charging prompt
Brass lanterns and oil lamps are always chargeable.
Magic lamps are only listed if they are not yet identified.
2020-10-25 19:25:39 +01:00
Pasi Kallinen
22ca1ae4da Fix monster hiding under hatching egg staying hidden 2020-10-24 18:32:08 +03:00
PatR
74c2716004 fix #K2622 - fire/frost horn feedback for monster
When a monster used a fire horn or frost horn to attack the hero,
the feedback claimed that the attack was being directed at itself.
The error occurred in code that was added to 3.7 during 3.6
development but wasn't present in 3.6.x so fixes entry is in the
"exposed by git" section.
2020-10-23 20:15:01 -07:00
PatR
0e713dc4e9 fix #K2617 - metallivores eating iron bars
Monsters with rust attacks (rust monster) and corrosion attacks
(black pudding, gray ooze) can eat or otherwise destroy iron bars
but xorns could only move through the iron bars spot without being
able to eat the metal there.  Change xorn to eat bars instead of
phazing through them.  Lets rock moles eat bars too.

Hero polymorphed into a rust monster would eat bars if trying to
move to their location but couldn't do so if already there (maybe
was in xorn form and now in rust monster form).  Xorns could pass
through them but not eat them.  Allow hero metallivores to eat
bars at the current location via 'e', similar to eating food off
the floor.  Hero as rock mole behaves like rust monster.
2020-10-23 19:43:10 -07:00
Pasi Kallinen
aeb0ea65e3 Mild Zombie Apocalypse
When a zombie (or lich) kills a monster in melee without a weapon,
the monster can rise few turns later as a zombie.

The only creatures that can be zombified are ones that actually have
a zombie counterpart monster. A zombie cannot turn a jackal into
a zombie, for instance. But it could turn a shopkeeper into a human
zombie, or a dwarf king into a dwarf zombie.

Zombies will fight with monsters that can be turned into zombies.

Originally this was a SliceHack feature, but this is based on xNetHack
version of it, with some modifications.
2020-10-23 19:47:10 +03:00
Patric Mueller
1cc26106bf Tossed upwards objects got two times half physical damage reduction 2020-10-23 11:04:29 +02:00
Pasi Kallinen
3a31587ca9 Prevent ghosts from being renamed
(via xNetHack)
2020-10-18 20:28:32 +03:00
Pasi Kallinen
f38cb63714 Spitting monsters try to stay away from melee range 2020-10-18 19:18:38 +03:00