Commit Graph

13442 Commits

Author SHA1 Message Date
nhmall
d486270ec9 warning fix 2022-05-10 21:10:02 -04:00
PatR
97d884585c redo magic whistle feedback
Give more information when magic whistle is already discovered and
applying it affects multiple pets, without much increase in verbosity.
For each of the three categories
 1) was already in view and moves to another spot still in view,
 2) was out of view and arrives at a spot within view,
 3) was in view but gets sent to a spot out of view,
show the pet by name (which might be "your <monst>" if it hasn't been
named) when there is just one, or "two creatures", "three...", "four...",
"several...", or "many..." when there are more than one.  The first
category with more than 1 says "creatures".  When there are additional
categories with more than 1, their part of the message says "others" if
prior part(s) already mention "creatures", or it says "other creatures"
if the prior part(s) only list pets by name.

For example
|Three creatures appear.
|Fido shifts location and Fang appears.
|Your pony shifts location and two other creatures appear.
|Many creatures shift locations, several others appear, and two others
disappear.
|Two creatures appear and two others disappear.
2022-05-10 15:53:24 -07:00
nhmall
6d15142250 fix one more lua file header 2022-05-10 11:30:30 -04:00
nhmall
0602a3b89f update lua file headers 2022-05-10 11:26:52 -04:00
nhkeni
e5648584b3 update headers on Lua files 2022-05-10 07:44:26 -04:00
nhmall
6c12b85a0e missed a reference in README 2022-05-09 17:58:26 -04:00
nhmall
4f851e0165 update README to reflect a recent file name change 2022-05-09 17:55:49 -04:00
nhmall
718365cf03 Merge branch 'pr758' into NetHack-3.7 2022-05-09 17:16:30 -04:00
nhmall
c87f779755 split getting kick damages into separate function
Closes #758 by argrath
2022-05-09 17:15:31 -04:00
SHIRAKATA Kentaro
4da4584633 split getting damages with a kick into separate function 2022-05-10 05:45:39 +09:00
nhmall
b53e76813d bump patchlevel 2022-05-09 09:15:17 -04:00
nhmall
4951cca84e Merge branch 'pr757' into NetHack-3.7 2022-05-09 09:06:50 -04:00
nhmall
a01a26f0a7 split adjusting attributes into separate function
Closes #757 by argrath
2022-05-09 09:05:58 -04:00
nhmall
81528b2853 Merge branch 'fix-do-wear' of https://github.com/argrath/NetHack into pr757 2022-05-09 09:04:56 -04:00
nhmall
7c2d528202 Merge branch 'pr754' into NetHack-3.7 2022-05-09 09:04:22 -04:00
nhmall
011405a15c split kicking empty space into separate function
Closes #754 by argrath
2022-05-09 09:03:24 -04:00
nhmall
c8a866cc14 Merge branch 'fix-kick' of https://github.com/argrath/NetHack into pr754 2022-05-09 09:02:01 -04:00
nhmall
9db8bd93df Merge branch 'pr748' into NetHack-3.7 2022-05-09 08:56:19 -04:00
nhmall
d3f98917e9 fixes entry for pr748 2022-05-09 08:55:40 -04:00
nhmall
200302e15f Merge branch 'altarmask-sanctum-bit' of https://github.com/entrez/NetHack into pr748 2022-05-09 08:47:02 -04:00
nhmall
17cb7646c2 follow-up bit in utf8map.c 2022-05-09 07:46:54 -04:00
SHIRAKATA Kentaro
037683581f split adjusting attributes into separate function 2022-05-09 20:38:15 +09:00
nhmall
0aaa114a46 rgbstr_to_uint32() -> rgbstr_to_int32()
Closes #756
2022-05-09 07:31:30 -04:00
PatR
da83c9324a magic whistle fix
Restore old behavior of magic whistle causing pets to be moved to
different locations even when already adjacent to the hero.

This lets rloc() give its relatively new, more verbose messages if
a magic whistle isn't discovered yet but suppresses those when
already discovered in order to issue its own message.  For a single
pet that starts within view and arrives elsewhere within view it says
"shifts location" rather than "vanishes and reappears".  For multiple
pets, it gives one summary message instead of a separate one for each
pet affected by whistling.
2022-05-09 03:21:53 -07:00
nhmall
2047d42bc6 regression in process_text_window()
original code:

     if (linestart && (*cp & 0x80) != 0) {
         g_putch(*cp);
         end_glyphout();
         linestart = FALSE;
     } else {
         (void) putchar(*cp);
     }

new code:

    if (linestart) {
        if (SYMHANDLING(H_UTF8)) {
            /* FIXME: what is actually in that line? is it the \GNNNNNNNN or UTF-8? */
            g_putch(*cp);
        } else if ((*cp & 0x80) != 0) {
            g_putch(*cp);
            end_glyphout();
        }
        linestart = FALSE;
    } else {
        (void) putchar(*cp);
    }

The new code didn't output a character if linestart was true and the character did
not have bit 0x80 set.

fixed code:

    if (linestart) {
        if (SYMHANDLING(H_UTF8)) {
            /* FIXME: what is actually in that line? is it the \GNNNNNNNN or UTF-8? */
            g_putch(*cp);
        } else if ((*cp & 0x80) != 0) {
            g_putch(*cp);
            end_glyphout();
        } else {
            (void) putchar(*cp);
        }
        linestart = FALSE;
    } else {
        (void) putchar(*cp);
    }
2022-05-08 20:27:00 -04:00
nhkeni
c6c61a1419 Lua sandbox
Change table format to handle functions never to be included.
Clean up bit masks and tables of functions.
Remove some old comments and out-of-date code.
2022-05-07 17:45:36 -04:00
nhmall
b74ba33eed tile.c must match target for crosscompile 2022-05-07 15:06:43 -04:00
nhmall
3101727fc0 more preprocessor and multiplatform cleanup
in wintty.c
2022-05-07 15:00:11 -04:00
nhmall
e4f85df216 Revert "some follow-up for MSDOS build"
This reverts commit 36d3b64326.
2022-05-07 14:34:06 -04:00
nhmall
36d3b64326 some follow-up for MSDOS build
The preprocessor directives in win/tty/wintty.c were crossed-up
under MSDOS build. I think I got them straightened out now.

For a crosscompile situation, the tilemap utility (which runs on
the host) needs to produce an output src/tile.c that is compatible
for the target platform.

Don't use ENHANCED_SYMBOLS under MSDOS, for now anyway.
2022-05-07 13:08:02 -04:00
PatR
4fbda9ea34 dochugw(mon, X)
Reverse the sense of dochugw()'s new 'X' argument. Use True for the
usual case and False for the special case rather than the other way
around.

Call the special case variant when a monster teleports so that hero
stops occupation if the monster jumps to a position where it becomes
a threat.
2022-05-07 09:11:09 -07:00
nhmall
0a171bb862 clear a warning during build with vs project
src/nhlua.c(93,16): warning C4324: 'nhl_user_data': structure was padded
due to alignment specifier
2022-05-07 11:34:24 -04:00
nhmall
12773da1b5 Guidebook.txt cron daily update 2022-05-07 11:27:05 -04:00
nhmall
eb802a8371 Visual studio project updates 2022-05-07 11:19:59 -04:00
nhmall
47b2eb29c1 Clean up CI build for Windows 2022-05-07 11:00:13 -04:00
nhmall
4b7c547dcd trailing blank removal 2022-05-07 10:40:21 -04:00
nhmall
cb0c21e91d ENHANCED_SYMBOLS
A new feature, enabled by default to maximize testing, but one which can
be disabled by commenting it out in config.h

With this, some additional information is added to the glyphmap entries
in a new optional substructure called u with these fields:
    ucolor          RGB color for use with truecolor terminals/platforms.
                    A ucolor value of zero means "not set." The actual
                    rgb value of 0 has the 0x1000000 bit set.
    u256coloridx    256 color index value for use with 256 color
                    terminals, the closest color match to ucolor.
    utf8str         Custom representation via utf-8 string (can be null).

There is a new symset included in the symbols file, called enhanced1.

Some initial code has been added to parse individual
OPTIONS=glyph:glyphid/R-G-B entries in the config file.

The glyphid can, in theory, either be an individual glyph (G_* glyphid)
for a single glyph, or it can be an existing symbol S_ value
(monster, object, or cmap symbol) to store the custom representation for
all the glyphs that match that symbol.

Examples:
   OPTIONS=glyph:G_fountain/U+03A8/0-150-255

(Your platform/terminal font needs to be able to include/display the
character, of course.)

The NetHack core code does parsing and storing the customized
entries, and adding them to the glyphmap data structure.

Any window port can utilize the additional information in the glyphinfo
that is passed to them, once code is added to do so.

Also, consolidate some symbol-related code into symbols.c, and remove it from
files.c and options.c
2022-05-07 10:25:13 -04:00
SHIRAKATA Kentaro
317bc9b3c2 split kicking empty space into separate function 2022-05-07 21:12:01 +09:00
PatR
132e1d433a fix comment (copy/paste victim) 2022-05-07 00:38:44 -07:00
PatR
7d140c6a70 fix github issue #752 - characteristics init
Issue #752 by vultur-cadens:  initialization of characteristics had
off by one errors when reducing over-allocation and when increasing
under-allocation, biasing Str over Cha.

This simplifies the code very slightly but it still seems somewhat
confusing to me.

A couple of reformatting bits are included.

Closes #752
2022-05-07 00:25:03 -07:00
PatR
6ccb56638a autounlock parsing confusion
For char *next; don't compare (next = index(...)) != '\0'.
'\0' has value 0 and 0 used in a pointer context is a null pointer.
So the code worked as intended even though it wasn't written as
what was intended.  Fix: take off the char decoration.
2022-05-06 18:41:54 -07:00
PatR
f2f2644e30 busy hero ignoring monster threat
Fix the problem reported by entrez of a zombie corpse reviving and
crawling out of the ground while the hero was busy doing something
(searching, digging, &c) and having the hero fail to react and just
keep doing whatever the thing was because the zombie was already
inside the range where a monster changes from no-threat to threat.

Done in the monster creation routine so any new monster (including
one revived from a corpse) that is visible,&c will cause the hero's
action to be interrupted.  Teleport arrival probably needs this too.

Only interrupts an occupation, not other voluntary multi-turn
actitivy such as running or traveling.  That would be trivial to
change ['if (g.occupation...' to 'if ((g.occupation || multi > 0)...']
but I'm not sure whether it ought to be extended to that.
2022-05-06 18:30:06 -07:00
PatR
02207b967a autounlock:untrap
Implement 'untrap' as an 'autounlock' action.  Quite a bit more work
than anticipated.  The new documentation is rather clumsy; too many
if-this and if-not-that clauses have intruded.

I'll be astonished if all the return values are correct....

[A couple of places were checking for (rx != 0 && ry != 0) to decide
whether they were performating an autounlock action at <rx,ry> but
that erroneously excludes the top line of the map if the current
level extends that far.  Just check rx for zero/non-zero.]
2022-05-06 14:44:57 -07:00
PatR
a31dd26d8a minor trapped container changes
When probing a trapped container, report that it is trapped.
Done with a one-line message in the zap code and also in the title
of the contents display if it isn't empty.

For wizard mode wishing, if both "trapped" and "broken" are specified,
produce an untrapped container with a broken lock.

Also for wizard mode wishing, ignore "trapped" if player wishes for
"trapped secret door".
2022-05-06 13:27:11 -07:00
Michael Meyer
ba871d44bc Fix coloring of unaligned temple altars
They were showing up as gray/neutral, rather than red/unaligned.
2022-05-05 10:27:04 -04:00
Michael Meyer
0585fee5ff Designate high altars with dedicated altarmask bit
High altars and normal temple altars had identical altarmasks, so
there was no way to distinguish between the two based on the altarmask
alone.  Instead, anywhere it was necessary to determine whether an altar
was a high altar included a check whether the hero was currently the
Astral Plane or Moloch's Sanctum, and assumed any temple altar was the
high altar.

Since there's an extra, unused bit in altarmask anyway, use it to
explicitly mark high altars -- the lua level files already distinguish
between normal temple altars and so-called 'sanctum' altars anyway, so
rather than throwing away this distinction when generating the level,
keep it in the altarmask and use it in place of various u.uz checks.

I think this would require incrementing EDITLEVEL again...
2022-05-05 10:26:58 -04:00
PatR
44d5be6eb4 autounlock overhaul
This gives the player more control over what autounlock does.  It is
now a compound option rather than a boolean, and takes values of
  autounlock:none
  !autounlock or noautounlock (shortcuts for none)
  autounlock:untrap + apply-key + kick + force (spaces are optional
    or can be used instead of plus-signs, but can't mix "foo bar+quux")
  autounlock (without a value, shortcut for autounlock:apply-key).
Default is autounlock:apply-key.

Untrap isn't implemented (feel free to jump in) so is suppressed from
the 'O' command's new sub-menu for autounlock.  It's parsed and
accepted from .nethackrc but won't accomplish anything.

[Just musing: it should be feasible to kick in direction '.' to break
open a container or #force to an adjacent spot to break open a door.
If that was done, autounlock:kick+force (or more likely autounlock:
apply-key+kick+force when lacking a key) would resort to force if hero
couldn't kick due to wounded legs or riding.

This changes struct flags so increments EDITLEVEL again.

This includes pull requests #750 from entrez and #751 from FIQ but was
entered from scratch rather than using use their commits.

Closes #750
Closes #751
2022-05-04 19:13:28 -07:00
PatR
d1b14e08c4 skipinvert handling in tty menus
Select all and unselect all were passing the wrong third argument to
menuitem_invert_test().  Select page and unselect page had it right.
2022-05-04 14:19:16 -07:00
nhmall
721b1cc9b9 unreferenced local variable warning 2022-05-04 08:48:56 -04:00
PatR
4c3d5e9db4 pull request #749 - MSGHANDLER for #if WIN32
github pull request #749 by argrath:  add support for MSGHANDLER for
WIN32 using spawn() rather than the fork()+exec() used on UNIX.

Closes #749
2022-05-03 14:43:44 -07:00