Commit Graph

6555 Commits

Author SHA1 Message Date
Bart House
a588541a27 Win32GUI: Gather raw_print text and display it all in single dialog
Defined strbuf_t and related routines to support dynamically sized
strings. Modified strip_newline() to strip the last newline in a string
instead of the first.

Simplified splash window code using new strbuf_t.

Prior to exiting game, re-enable getreturn and call wait_synch() in
case there is buffered raw prints that must be displayed to user.
2017-10-25 10:34:27 +03:00
Pasi Kallinen
b02dae91a1 Fix status hilites parsing from config file 2017-10-25 09:59:17 +03:00
PatR
defde3d332 description of #therecmdmenu
The extended command added to test handling for adjacent mouse clicks
had a description which was too long.  In the list from '#?', white
space for column alignment got squeezed out to make it fit (at least
for tty, where it ended up looking awful).

The new description isn't a complete sentence any more, but I don't
think anyone will care.
2017-10-24 14:29:38 -07:00
PatR
5a50bb6445 more achievement tracking
The code that checked for and complained about having more than one
'prize' object on the mines' end or sokoban end level uses static
counters and would complain if you used #wizmakemap to recreate the
level.  (Or if a game got far enough that either of those levels was
created and then started over--I'm not sure what state support for
that has reached.)  So re-init those counters each time any special
level gets created; that's sufficient for what they track.

I also changed several variables in sp_lev.c from global to file
scope since they aren't used anywhere else.
2017-10-24 14:17:25 -07:00
PatR
58477b33f4 more fix for #H5056 - achievement tracking
The followup message about the fix for #5056 was trapped by the spam
filter so didn't reach us for a while.

xlogfile has an extra field to track various achievements made during
the game it logs, two of which are fully exploring the gnomish mines
and fully exploring sokoban.  Those are accomplished by finding the
special 'prize' item on the final level of their branch:  luckstone
for mines and bag of holding or amulet of reflecition for sokoban.
3.6.0 had a bug where any item of the target type found anywhere in
the dungeon resulted in achieving the relevant goal.  A post-3.6.1 fix
for that required that the item be found on the end level of the branch
and attempted to require that it an item explicitly placed there by the
special level loader, but the latter aspect had a bug which meant that
random items of the appropriate type placed on final level would count
as the prize.  Chance of extra luckstones on mines' end is fairly high,
so potential for false completion of the achievement was also high.

The second complaint was that since the achievement was only recorded
if the special prize item was found on final level, then if a monster
took it to another level then the achievement became impossible.  (Not
true, the player could take it back, drop it, and pick it up again, but
that is admittedly a pretty silly hoop to jump through.)  On the other
hand, if a monster removed the item before the hero found it, then a
case could be made that the hero hadn't really fully explored the
level.  However, this fix records the achievement no matter where the
hero picks up the item.  The final level must be entered--otherwise no
monster could possibly acquire and transport the item--but it isn't
guaranteed to have been fully explored.  Big deal....

The prize could also be acquired in bones data.  Before the second
portion of this fix, that wouldn't have mattered.  But now it does, so
clear the prize indicator when saving bones unless it happens to be the
same level where that item is created (impossible for sokoban, where no
bones are left; not sure offhand about mines' end).  The former prize
stone or bag or amulet becomes an ordinary one of its type.

This can all be done in a much cleaner fashion once we give up on the
current save file compatability.  Putting obj->o_id values into new
context.mines_prize and context.soko_prize, plus a hack to mkobj() to
not reuse those two values if the o_id counter ever wraps back to 0,
would cover most of the details.  Adding an achievement tracking flag
to lev_comp's object handling for use by the special level loader
would cover most of the rest.
2017-10-24 00:37:21 -07:00
PatR
a8fb18d6fe more #adjust: '$' and '#' handling
The recent fix to prevent #adjust from letting the player move things
into slot '-' (if compactify() reduced any sequence of consecutive
letters to x-y, introducing dash into the string of characters that
could be chosen from) was triggering a complaint about mixing &&
and || without parentheses.  Fixing that was trivial, but I ended up
making a much more substantial change.

If the '#' overflow slot is in use, you can move something into it
even when you no longer have all 52 regular slots in use.  (When it
isn't already in use, you can't access it.  Previously you could swap
from '#' to any letter but not vice versa.)  If you manage to get
gold in multiple slots or in some slot other than '$', you can move
or merge it into the '$' slot.  And when that situation isn't present
(if even possible--I had to force it with a debugger to test), then
gold will no longer be listed among the inventory letters to adjust.
(That became an issue when GOLDINV came into use, but either nobody
ever noticed or at least never reported.  "Adjust what? [$abd]",
then pick '$' and be told you can't adjust gold.  Prior to GOLDINV,
'$' wasn't included in the list of candidates.)
2017-10-21 16:02:48 -07:00
PatR
08a3297f64 boulder pickup: contradictory message sequence
Poly'd into a giant with a full inventory that already contains at
least one boulder, moving onto a boulder (that can't be pushed due
to a wall or other obstacle) yielded

 You try to move the boulder, but in vain.
 However, you can easily pick it up.
 You are carrying too much stuff to pick up another boulder.
 You see here a boulder.

The second and third statements contradict each other.  Make the
code that dishes out the second message smarter.  If autopickup is
set for it and you will pick up the boulder:
 However, you easily pick it up.
If autopickup is not set for it but would have worked if it was:
 However, you could easily pick it up.
If your inventory is full and you have a boulder (or are in Sokoban)
 However, you easily push it aside.

That last one is instead of "however, you can squeeze yourself into
a small opening" that you'd get if not a giant and not carrying much.
2017-10-20 18:31:07 -07:00
Pasi Kallinen
0bf824a81e Prevent adjusting items to the dash inventory letter
The #adjust command allowed, due to compactified buf, putting
items into the '-' inventory letter, which is usually reserved
for "empty hands", zeroobj. This caused problems down the line
when user was allowed to pick that letter for dropping.
2017-10-20 16:22:57 +03:00
PatR
4fad1ba3cc fix #H6285 - speaking vs strangulation
Reading a scroll while blind is permitted if you know its label, but
message is "as you pronounce the words, the scroll vanishes" unless
you are poly'd into a form which can't make sounds, in which case you
"cogitate" rather than "pronouce".  Switch to the cogitate variant if
you are suffering from strangulation.

Casting spells didn't even have the distinction; you could cast them
without regard to speech capability.  Check for that.  Unlike with
scrolls, now you can't cast if you can't speak (or grunt or bark or
whatever) instead of having a variant description of the action, so
this is a bigger change.
2017-10-19 23:08:46 -07:00
PatR
da9c3f0ed4 X11 role selection: gender-specific role names
A wishlist/TODO item:  when "female" is highlighted, change "caveman"
to "cavewoman" and "priest" to "priestess".  If it gets toggled to
"male", change them back.
2017-10-16 22:19:35 -07:00
Pasi Kallinen
7e28cc64f6 X11: Capitalize the main window correctly 2017-10-16 17:34:29 +03:00
Pasi Kallinen
491b40897f Ignore Qt specific config options silently
If the binary wasn't compiled with Qt, don't complain
about Qt specific config options.
2017-10-16 12:47:07 +03:00
Pasi Kallinen
28061e98dc Qt4: Use pixel-perfect tile scaling
SmoothTransformation (bilinear filtering) causes artifacts
at tile edges, and the blurry tiles look even worse.
2017-10-16 10:35:36 +03:00
PatR
ab04d12ccb X11 player selection - wishlist and reformatting
Add a comment about potential changes to make the X11 player selection
dialog.  Also, a bunch of minor formatting tweaks.
2017-10-15 16:24:02 -07:00
Pasi Kallinen
f1618fe6dd X11: Put yn prompts into message history 2017-10-15 21:48:42 +03:00
Pasi Kallinen
1af921274e More Makefile verbosity 2017-10-15 18:00:56 +03:00
Pasi Kallinen
612a0cb909 Make boulder dropping noise wake up monsters
Also, don't bother waking up monsters who would end up dead anyway.
2017-10-14 21:29:20 +03:00
Pasi Kallinen
7d8ba1d46f Monsters hit by a boulder from your scroll of earth should get angry 2017-10-14 21:00:47 +03:00
Pasi Kallinen
1b42b1499b X11: player selection dialog tweaks 2017-10-14 18:07:09 +03:00
Pasi Kallinen
87b94230b5 X11: player selection enter should obey button active state 2017-10-14 17:38:06 +03:00
Pasi Kallinen
1ff4dfee85 Reduce *nix Makefile verbosity
Instead of showing all the CFLAGS and whatnot, just show "[CC] allmain.c"
or whatever. The verbose output can be switched back on with VERBOSEMAKE=1
2017-10-14 15:56:03 +03:00
Pasi Kallinen
1caa212bd9 Fix warnings 2017-10-14 13:48:44 +03:00
Pasi Kallinen
04b08298a3 Use the same macro for output in tile2x11 2017-10-14 13:10:34 +03:00
PatR
1e3c00d760 fix #6187 - attempting to eat inedible artifact
Rearrange the tests for edibility of non-food so that touching an
artifact won't happen unless the object could be eaten.

Add a bit of bulletproofing for rust monsters trying to eat a
rustproofed item and spitting it out.  Wishing for rustproof iron
ring, cursing it, wearing it, and attempting to eat it as a rust
monster would remove the rustproofing and spit it onto the floor,
ignoring the cursed state as far as taking it off goes.  That was
an issue in 3.4.3 and probably in 3.6.0, but in current code the
'rustproof' part of the wish would be ignored for an item which
isn't subject to erosion damage, so hero-as-rust monster will
successfully eat the ring instead of spitting it out.
2017-10-14 02:09:43 -07:00
Pasi Kallinen
8723742015 Don't output x11 tile compilation info into stderr 2017-10-14 09:15:07 +03:00
PatR
842c66750a X11 player selection compile warnings
This eliminates nearly 40 warnings, most by suppressing complaints of
used function arguments but a few for unused local variables.  There's
also some reformatting thrown in....

There are still 18 warnings about uses of XtSetArg(), about assigning
const to non-const.
2017-10-13 17:56:25 -07:00
PatR
7f019d8115 suppress 'unused arg' warning for !DUMPLOG 2017-10-13 16:35:39 -07:00
Pasi Kallinen
1d8aea1ca3 Qt4: Don't use version string directly 2017-10-14 01:33:56 +03:00
Pasi Kallinen
9ec7e961d3 Fix copypaste error in Qt4 and X11 plsel dialogs 2017-10-13 23:34:44 +03:00
Pasi Kallinen
7b156bf704 X11: add new player selection dialog
The dialog shows the player's name, race, role, gender, and
alignment in a single window, similar to the Qt4 dialog.
Also allows randomizing the character selection.

Use the dialog by setting OPTIONS=player_selection:dialog
2017-10-13 22:41:43 +03:00
PatR
20d8cb4238 options: ascii_map vs tiled_map
X11 supports both ascii map and tiled map and is able to switch back
and forth during play.  'O' shows both of them as boolean options, but
toggling ascii_map did nothing since tiled_map retained whatever value
it had at the time.  For core options handling, make toggling either
ascii_map or tiled_map also set the other one to the opposite value,
so ascii on forces tiled off and vice versa.
2017-10-12 15:21:00 -07:00
PatR
601bff5159 X11 WC_ flags
Add a few windowing capability flags that were omitted for X11.  There
may be others which ought to be set too; I don't understand a bunch of
them.
2017-10-12 15:18:26 -07:00
Pasi Kallinen
b340e783f5 Qt4: Remove extra empty space from player selection 2017-10-12 13:43:46 +03:00
Pasi Kallinen
11e50e8ca2 Qt4: Add Random button to player selection 2017-10-12 13:37:52 +03:00
Pasi Kallinen
b586d58dbb Qt4: Gender, not Sex. TOURIST is unconditional. 2017-10-12 12:42:32 +03:00
Pasi Kallinen
55143cd66e Qt4: Add NetHack version to player selection popup 2017-10-12 12:33:04 +03:00
PatR
ffeabfdf3b X11 default resources - macro expansion
The X11 interface reads file NetHack.ad (after cd'ing to the playground
directory, where 'make install' puts a copy) and feeds the contents to
X Windows for use as default resources to override the compiled in
defaults.  When use of #define was introduced into NetHack.ad (back in
September, 2016) this was severely hobbled and startup spit out a lot
complaints to stderr about invalid resource values.  This implements
rudimentary macro expansion for '#define name value' within the data
stream that's fed to X, getting back decent default values and
eliminating the invalid value complaints.
2017-10-11 17:29:55 -07:00
Pasi Kallinen
46217bbda2 Qt4: Put yn queries in message history
When using OPTIONS=popup_dialog, or compiling with USE_POPUPS,
the yes/no -questions weren't put into the message history.
2017-10-11 09:50:22 +03:00
PatR
5d1f77301a context menu tweaks
Fix several warnings about using 'void *' for a function pointer and
a couple of unused variables.  Add a_nfunc for 'int NDECL((*func))'
alternative for union anything.  Make the enum list of union anything
types actually match the alternatives (field a_uchar was missing from
enums, enum mask32 had no corresponding a_mask32 field).

Add another command, #therecmdmenu, so that the context menu for an
adjacent spot can be tested without mouse support.  It revealed that
you could get an empty menu if nothing applicable was at target spot.

Add a few adjacent actions:  lock/unlock door if carrying suitable
implement, search door for traps, examine known trap (door/ceiling,
not door), #untrap known trap, mount saddled critter, remove saddle.
Make "kick door" be the last choice for closed door instead of first.

Add one 'here' action:  dismount.

Both #herecmdmenu and #therecmdmenu interact strangely with ^A, but
differently from each other.  I didn't make any attempt to solve this.

There's no documentation for #therecmdmenu.
2017-10-10 15:56:18 -07:00
Pasi Kallinen
76a47b5e34 Qt4: Save message history to dumplog 2017-10-11 01:06:07 +03:00
Pasi Kallinen
c6f0058e3d Qt4: Handle saving/loading message history 2017-10-11 00:32:39 +03:00
Pasi Kallinen
2fcf1ad139 Qt4: put and get message history 2017-10-10 22:55:30 +03:00
Pasi Kallinen
4dff3a707e Qt4: Pile mark 2017-10-10 21:47:35 +03:00
Pasi Kallinen
dbacc98a1d Qt4: Fix wrong condition in search blocking 2017-10-10 21:13:37 +03:00
Pasi Kallinen
257f17f8df Qt4: Don't segfault with QT_COMPACT 2017-10-10 20:18:04 +03:00
Pasi Kallinen
2fa61f9038 Qt4: Use generic putmixed routine 2017-10-10 19:56:51 +03:00
Pasi Kallinen
4f95d19ab7 Qt4: Prevent selecting all in pick-one menus 2017-10-10 19:28:03 +03:00
Pasi Kallinen
f06cf62a35 Qt4: Allow clicking anywhere in menus
Instead of requiring clicking on the checkbox, allow clicking
anywhere in a selectable line to select it.
2017-10-10 19:19:20 +03:00
Pasi Kallinen
76d223c178 Qt4: handle menu page selector keys
Qt4 doesn't do menu paging, so handle the select page, invert page,
and unselect page like selecting, inverting or unselecting all.
2017-10-10 18:20:34 +03:00
Pasi Kallinen
e2b367102a Complain if hints file does not exist 2017-10-10 17:50:39 +03:00