Pasi Kallinen [Thu, 3 Dec 2020 14:38:17 +0000 (16:38 +0200)]
Fix stairs on oracle level bones
Recent change to the stairs structure now lets each stair keep
the destination level number and dungeon where the stairs go to.
When a level that can be on different depth (such as the Oracle)
became a bones level, and it was loaded in another game at different
depth, the stairs were still pointing to the old level number.
Save it as relative to the current level instead of absolute.
PatR [Thu, 3 Dec 2020 00:11:53 +0000 (16:11 -0800)]
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.
PatR [Wed, 2 Dec 2020 22:49:09 +0000 (14:49 -0800)]
saving followup
If attempting to checkpoint when changing levels discovered that
the alock.0 or 123wizard.0 file was missing and the game was
running in wizard mode, play continued after reporting trickery
but screen updating was left disabled. An early return in
savegamestateinlock() wasn't resetting the program_state.saving
flag to revert to normal screen updates.
I added a few return statements at the ends of void routines,
where they're optional, because it makes searching for early
returns easier. (Without these then when no early return is
present between current point and end of routine, the search
would move past the routine looking for 'return' later in the
file.)
save_stairs() was placed in between saveobj() and saveobjchn()
so I've moved it. (Has no effect on the recently reported stair
anomalies.) It was also accumulating the total stairway data
size in 'len' and never using that for anything, so I got rid
of it. (Ditto about anomalies.)
PatR [Wed, 2 Dec 2020 14:29:58 +0000 (06:29 -0800)]
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.
PatR [Tue, 1 Dec 2020 00:16:14 +0000 (16:16 -0800)]
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.
PatR [Mon, 30 Nov 2020 19:40:21 +0000 (11:40 -0800)]
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.
PatR [Mon, 30 Nov 2020 11:18:45 +0000 (03:18 -0800)]
Qt extended commands
When responding to '#', the Qt interface puts up a grid of buttons
labelled with the names of commands. Then if the user types
instead of clicking on a button, buttons which can no longer match
are removed rather than grayed out. The remaining ones keep their
same relative positions. Once whole rows or whole columns were
gone, it looked awful. With rows gone, the size of the grid
shrank but the popup stayed the same size, so the one-line prompt
area expanded to fill up the vacated vertical space. That caused
the prompt and partial response to move as they stayed centered in
their growing area. With columns gone, the width of the buttons
in remaining columns expanded and they spread out to take up
vacated horizontal space. Once the candidate commands were all
in one column, the buttons spanned the width of the grid. (That's
mostly my fault due to changing the grid from being row-oriented
[a b c]
[d e ]
to column oriented
[a d]
[b e]
[c ]
which resulted in columns going away a lot faster and possibly down
to one when the old layout always had at least two. But old layout
could drop to one row; the current layout always has at least two.)
Also, accept ^[ as ESC. Typing ESC when partial input is present
kills that input but keeps prompting. Typing ESC when no input
is present (none entered yet or a second of two consecutive ESCs)
cancels the operation.
Allow ^U to kill partial input. If used when no input is present,
nothing happens, similar to backspace. Unlike tty and curses, it's
hardcoded here. That shouldn't be a problem because ESC can be
used as a substitute if ^U isn't what the player normally uses.
PatR [Mon, 30 Nov 2020 00:58:56 +0000 (16:58 -0800)]
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.
PatR [Sun, 29 Nov 2020 04:15:30 +0000 (20:15 -0800)]
-Wshadow fix
Not caused by a hidden macro this time...
|mon.c:1549:10: warning: declaration shadows a variable in the
| global scope [-Wshadow]
| long flags = 0L;
| ^
|../include/flag.h:392:29: note: previous declaration is here
|extern NEARDATA struct flag flags;
PatR [Sat, 28 Nov 2020 10:19:28 +0000 (02:19 -0800)]
more "golem rust in peace"
Be prepared for life-saving to contradict "<mon> falls to pieces".
Purely hypothetically at present (with no plans to change) since
golems don't benefit from amulets of life-saving.
PatR [Fri, 27 Nov 2020 19:10:44 +0000 (11:10 -0800)]
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.
PatR [Fri, 27 Nov 2020 10:38:17 +0000 (02:38 -0800)]
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.)
PatR [Fri, 27 Nov 2020 02:47:45 +0000 (18:47 -0800)]
more options help
"Name of your starting pet when it is a kitten" could be
construed as meaning that it will no longer apply once the
kitten grows into a housecat. Use "if" instead of "when".
The 'other settings' were in alphabetical order except for
"status condition fields" which presumably started out as
"condition fields". Move it into proper place for current
description.
PatR [Thu, 26 Nov 2020 20:00:00 +0000 (12:00 -0800)]
options help
Add a few missing options to dat/opthelp (without worrying about
"if FOO was set at compile time"). No doubt there are lots of
others still missing.
Reword a few options in dat/opthelp and also in the dynamic help
derived from optlist.h, particuarly catname, dogname, horsename
whose descriptions have always been confusing or maybe confused.
PatR [Thu, 26 Nov 2020 10:20:00 +0000 (02:20 -0800)]
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.
PatR [Wed, 25 Nov 2020 22:33:14 +0000 (14:33 -0800)]
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.
PatR [Wed, 25 Nov 2020 18:21:43 +0000 (10:21 -0800)]
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.
PatR [Tue, 24 Nov 2020 18:43:12 +0000 (10:43 -0800)]
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.
PatR [Tue, 24 Nov 2020 17:45:55 +0000 (09:45 -0800)]
today's Qt status update: non-standard conditions
Qt's status highlighting was treating any change to hunger or
to encumbrance as "worse" (shown in red). That's wrong if you
go from weak to just hungry or from stressed to encumbered.
Comparing satiated with other hunger states is tricky. I've
ranked it between hungry and weak but that's fairly arbitrary.
Also, change the highlighting when Lev, Fly, and Ride are new
conditions from red to blue.
Pasi Kallinen [Tue, 24 Nov 2020 17:26:12 +0000 (19:26 +0200)]
Fixes and sanity checks for monster undetected and trapped states
Adds sanity checks for mtrapped and mundetected states.
Fixes cases where those were left in wrong state.
1. Trapped monster (eg. a nymph) teleported out of a trap
2. Monster was hiding under ball or chain, which then got removed
3. While restoring a level, a zombie corpse revived while monster
was hiding under it
4. A general case where the only object was deleted off floor and
a monster was hiding under it
Monsters hiding under ball or chain will now get revealed when
the b or c are moved.
PatR [Tue, 24 Nov 2020 01:45:44 +0000 (17:45 -0800)]
Qt status: highlights when toggling 'showexp'
During status update at the time the 'showexp' option gets toggled
on or off, prevent comparing Xp (level) against Exp (points) when
deciding whether the value has gone up or down. Xp/Exp (when
toggling on) or just Xp (when toggling off) will be highligthed in
blue (changed, neither better nor worse) rather than green or red.
PatR [Tue, 24 Nov 2020 01:39:00 +0000 (17:39 -0800)]
Qt font selection dropdown menu
In "Qt settings" (or "Preferences" for OSX), the current font size
would show "Medium" if that was the current setting. So far, so
good. However, if you clicked on the up/down arrows to get the
dropdown menu, it was truncated to "Mediu" there regardless of
current setting. Force the menu to be wide enough to show "Medium".
PatR [Mon, 23 Nov 2020 09:29:53 +0000 (01:29 -0800)]
Qt status again: unhighlight disabled fields
If 'showscore' has been On and gets toggled Off while Score is
highlighted, remove that highlight immediately instead of letting
it stick around a few turns until it times out.
PatR [Sun, 22 Nov 2020 10:36:10 +0000 (02:36 -0800)]
Qt paperdoll bit
For the tool tips shown if you let the mouse pointer hover over
any of the cells in the paperdoll (inventory subset showing
worn and wielded items), remove the trailing period and add a
leading space and a trailing space. Improves readability.
PatR [Sun, 22 Nov 2020 09:10:52 +0000 (01:10 -0800)]
Qt status bit
When Qt highlights a field that has gotten better, use the same
shade of green as is used for the green range of hitpoint bar.
The old value was too dull, like olive green seen in shadow.
Not trivial enough to avoid getting the details wrong. An old
commit log message (58137a608acf418700dd527bc69b2ad5a198495d,
June of 2006) claimed that this was fixed for bag of tricks but
that was for monsters in general; mimics could still be wrong.
PatR [Sun, 22 Nov 2020 02:21:16 +0000 (18:21 -0800)]
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...
PatR [Sun, 22 Nov 2020 01:37:01 +0000 (17:37 -0800)]
'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.
PatR [Sat, 21 Nov 2020 11:46:53 +0000 (03:46 -0800)]
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.)
PatR [Sat, 21 Nov 2020 02:56:35 +0000 (18:56 -0800)]
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.
PatR [Thu, 19 Nov 2020 12:48:15 +0000 (04:48 -0800)]
daily Qt status window update...
Highlight changes to dungeon location or alignment in blue instead
of green or red since neither the old value nor the new can be
classified as better than the other. Likewise when changing
between regular Hp and Xp (or Xp/Exp) to or from you-as-mon Hp and
HD when polymorph or rehumanization takes place.
When toggling Score On, start out highlighted in blue instead of
green. When toggling it Off, don't highlight the blank space
where it had been in red. At the moment there's a quirk here;
if it is highlighted in green (from recent change) or blue (from
having just been toggled on) at the time it gets toggled off, the
space stays green or blue until that highlight times out. (It has
occurred to me that the bogus red highlight might have been added
to deliberately overwrite stale green highlights. If so, a better
fix should be achievable.)
For the title (plname and rank or plname and monster-species),
capitalize the player name since core's botl() and at least some
other interfaces do that.
TODO: toggling Exp needs work. The field used for deciding
up/down changes gets swapped and the update in progress compares
apples and oranges. [This wasn't an issue in the original Qt
implementation where Xp and Exp were two separate fields.]
PatR [Thu, 19 Nov 2020 09:57:13 +0000 (01:57 -0800)]
rename #wizlevelflip to #wizfliplevel
Since ^V is dead key for me with Qt on OSX, I use #wizlevelport
instead. It's annoying to have to type all the way up to the
'p' for it to become distinct. Rename the biggest conflict,
\#wizlevelflip to #wizfliplevel. I still have to type as far
as the first 'e' for #wizlevelport but 6 characters are easier
to type than 10.
It wasn't in the Guidebook so I've left things that way. I am
adding it to 'wizhelp' though.
PatR [Wed, 18 Nov 2020 19:16:21 +0000 (11:16 -0800)]
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'.
PatR [Wed, 18 Nov 2020 16:56:20 +0000 (08:56 -0800)]
Qt: yet more status...
Fix the minor problem of the status lines moving up or down a
tiny amount when using the condensed (statuslines:2) layout and
the condition line changed from empty to non-empty or vice versa.
The widget used as filler when no conditions are shown needed to
have non-empty label text (single space suffices) and also has
to have its font set to the same value as the rest of status.
(I previously tried a label of " " and also "_" but had left the
font with its default value.)
The adjustments to the prefix string when the value of Xp/Exp
("Level" -> "Lvl" -> "L") or Score ("Score" -> "Scr" -> "S") was
too wide needed some fixing up. If shrinkage was needed, it was
setting the value multiple times and any extra times confused
field highlighting because it seemed to be assigning same value
rather than a changed one.
For condensed layout that moves Alignment to the Characteristics
line, add a vertical separator line between Charisma and Alignment.