Commit Graph

15844 Commits

Author SHA1 Message Date
nhmall
7beef848c4 fix a strange bug with option menu
It was impossible to select entry 62 in the allopt[] array
from the 'm O' menu, apparently because of a collision with
the ascii value of a question mark.

Entry 62 was currently the guicolor option.
2023-11-16 07:56:01 -05:00
nhmall
d76176c41b pass menu_headings not test value for title 2023-11-16 06:01:07 -05:00
nhmall
bc2c2f5138 follow-up to correct syntax error in Windows build 2023-11-16 00:12:41 -05:00
nhmall
86067dcffd use ctrl_nhwindow() for menu prompt style
This implements the mechanics to use the ctrl_nhwindow() interface
capability to pass down a setting change from the core to the active
window port, without resorting to accessing a core global variable
from within the window port, and without altering the interface..

The passed setting is honored in the tty and curses window ports.

X11 and mswin receive and store the values, but no implementation
to change the menu prompt style is there yet.

Qt does not store the values or have an implementation.

The setting change is done in allmain.c immediately after
creating the WIN_INVEN window.
2023-11-16 00:10:06 -05:00
nhmall
657d0f6105 fix an incorrect ESC sequence (cut and paste err) 2023-11-15 21:19:02 -05:00
nhmall
a08b2e254a get rid of a warning during our pdcursesmod build
../lib/pdcursesmod/dos/../common/dosutil.c:36:15: warning: comparison of integer expressions of different signedness: 'long int' and 'long unsigned int' [-Wsign-compare]
   36 |     while( ms > MAX_NAP_SPAN)
      |               ^

It isn't something that we can actually resolve within NetHack,
so just suppress the submodule build warning.

This commit will trigger the CI to carry out a test of the build.
There could be some follow-up after the results.
2023-11-15 13:28:50 -05:00
nhmall
c85900320c fetch dos extender from a different location
CI was having difficulty connecting
2023-11-15 12:33:07 -05:00
nhmall
97ddfd9355 curses menu_heading repairs 2023-11-15 11:11:55 -05:00
PatR
fc52f0ef42 'menu_headings' option
If the value is "no color&none" report it as "no-color&none" in 'm O'
and for #saveoptions.

Allow "OPTIONS=menu_headings" without any color or attribute value to
mean "no-color&inverse" as it once did before the player could choose
which attribute or color was supported, and matching the default used
when 'menu_headings' hasn't been specified at all.

Accept "OPTIONS=!menu_headings", meaning "no-color&none".

Explicitly reject "OPTIONS=!menu_headings:anything".  It was rejecting
that due to blanket rejection of negated option, but reporting "can't
both have a value and be negated" whether there was any value present
or not.

For preselected menu entries when interactively choosing a new value
via the submenu of 'm O', use the current color and attribute rather
than NO_COLOR and ATR_NONE.
2023-11-14 21:33:09 -08:00
Pasi Kallinen
830168f26e Update comment 2023-11-15 07:26:21 +02:00
PatR
d748dbaa12 more menu headings
Simplify suppression of highlighting for menu header lines during end
of game disclosure.  Didn't actually affect as many things as I was
expecting.

Plus a bit left out of the optfn_dogname() parsing commit.
2023-11-14 17:51:27 -08:00
PatR
b8063ee07c option parsing
Get rid of all the unnecessary 'if (!opts)' checks if the optfn_xx()
routines.

Replace the replicated contents of optfn_catname(), optfn_dogname(),
and optfn_horsename() with a common routine.  optfn_dogname() was
different from the other two for no discernable reason.  Player can
no longer assign the name "none" to an initial pet via RC file,
although there's nothing preventing doing so with C/#name command.
2023-11-14 12:59:30 -08:00
PatR
c36d614c3a pull request #1132 - unnecessary options test
Pull request from argrath:  optfn_pickup_types checks 'opts' for
whether it is Null after having already used it without checking.
Remove the unnecessary test.

Closes #1132
2023-11-14 11:43:43 -08:00
SHIRAKATA Kentaro
51042bb0df remove unnecessary condition on optfn_pickup_types()
`opts` here is always non-null, otherwise it leads segv at earlier code.
2023-11-14 11:40:34 -08:00
PatR
88e2ee192d perminv_mode: fix menu coloring
The submenu of 'm O' for recently added option 'perminv_mode' didn't
have color 0 changed to NO_COLOR.  On tty the entries came out blue,
on X11 they were nearly invisible.  Qt and curses didn't seem to care.

I checked all the add_menu() calls in src/*.c and managed to refrain
from the impulse to reformat, mostly.
2023-11-13 23:32:38 -08:00
nhmall
d064ac2cda more cast style consistency 2023-11-13 20:31:02 -05:00
nhmall
ee732d4054 leading tab to spaces 2023-11-13 19:40:49 -05:00
nhmall
a7242760f7 consistent cast syntax 2023-11-13 19:28:19 -05:00
nhmall
b4bb3b92a2 replace E with extern in the last file like that 2023-11-13 15:00:44 -05:00
nhmall
6e91482be0 hands_obj follow-up 2023-11-13 14:20:54 -05:00
nhmall
5b2ec5d6ee minor optomization - explicity avoid menucolors 2023-11-13 14:00:02 -05:00
Pasi Kallinen
d2ca1794df Move other add_menu routines to windows.c 2023-11-13 20:12:47 +02:00
nhmall
4b79baa55b add_menu follow-up, part 2 of interface adjustment
Remove menu_color support from the window port side of the interface.
The window port just has to honor the color parameter that was added
to the add_menu() interface definition in June 2022 commit
2770223d10, and let the core-side of
the interface handle things.

To that end, this does the following:

Removes the #define of add_menu() from include/winprocs.h and add a
real core-side add_menu() function to windows.c which acts as a
trampoline to the window port win_add_menu() function, while providing
a single location to adjust the parameters passed to the window port
function. get_menu_coloring() is now called in there.

Moves get_menu_coloring() from options.c into windows.c and makes it
static.

Removes all the calls to get_menu_coloring() from the tty, Qt, X11,
curses, and win32 interfaces and adjusts their code to simply honor
the color parameter in add_menu, similar to what the menu_headings
change from earlier today did.
2023-11-13 12:56:38 -05:00
PatR
59a74a00fd pull request #1131 - wand explosion
Pull request from argrath:  eliminate some 'goto's by splitting the
explosion portion of wand-breaking into a separate routine.

Closes #1131
2023-11-13 07:32:05 -08:00
SHIRAKATA Kentaro
4250dd91d8 split wand explosion into separate function 2023-11-13 07:24:15 -08:00
nhw_cron
86914f03f0 This is cron-daily v1-May-8-2022. 005guidebook updated: doc/Guidebook.txt 2023-11-13 08:26:36 -05:00
nhmall
31a46e72c0 Guidebook date stamp 2023-11-13 07:46:17 -05:00
nhw_cron
62d8d5858f This is cron-daily v1-May-8-2022. 005guidebook updated: doc/Guidebook.txt 2023-11-13 07:39:05 -05:00
nhmall
682ae10f51 missing prototype warning ifndef TEXTCOLOR
../win/tty/wintty.c: In function ‘set_item_state’:
../win/tty/wintty.c:1174:9: warning: implicit declaration of function
‘term_start_color’; did you mean ‘term_start_attr’?
[-Wimplicit-function-declaration]
 1174 |         term_start_color(item->color);
      |         ^~~~~~~~~~~~~~~~
      |         term_start_attr
 ../win/tty/wintty.c:1178:9: warning: implicit declaration
 of function ‘term_end_color’; did you mean ‘term_end_attr’?
 [-Wimplicit-function-declaration]
 1178 |         term_end_color();
      |         ^~~~~~~~~~~~~~
      |         term_end_attr
2023-11-13 07:26:04 -05:00
Pasi Kallinen
f74f7988ff MSDOS: implement valid location highlighting
... for VGA and VESA tiled map.
2023-11-13 12:40:10 +02:00
Pasi Kallinen
dd5ca5b058 Change menu_headings to accept color and attribute
Instead of just accepting an attribute, it's now possible to
use a color, or both color and attribute, for example:

OPTIONS=menu_headings:inverse
OPTIONS=menu_headings:red
OPTIONS=menu_headings:red&underline

Default is still just inverse.
This lets the player change the menu heading color without
needing to use menu colors for them.

Also makes it so the core uses NO_COLOR instead of 0, for all
the menu lines which don't have any prefedefined color.

Tested for tty, curses, x11, qt, and win32
2023-11-13 07:33:56 +02:00
PatR
dd6c249a8c remove obsolete comment 2023-11-12 10:26:59 -08:00
PatR
fcf1a42cac fix for two empty-handed hits
When using bare-handed combat or martial arts at better than 'basic'
skill, don't attempt a second hit if wearing a shield.
2023-11-12 10:21:51 -08:00
nhmall
76d328d86a gi.invalid_obj -> hands_obj 2023-11-11 19:49:38 -05:00
nhmall
47bca92e6c follow-up Install.dos: consistent sample dir path 2023-11-11 12:27:03 -05:00
nhmall
7b2bf56f40 update Install.dos 2023-11-11 12:01:28 -05:00
nhmall
e0e60cb97e remove a cast from assignment to same type 2023-11-11 08:12:17 -05:00
PatR
ce79cb519c fixes entry for PR #1129 - using up ammo/missiles
Pull request by entrez:  have monsters and the hero use the same code
when deciding whether to destroy a missile that hits a monster after
being thrown or shot.

Closes #1129
2023-11-11 01:25:49 -08:00
Michael Meyer
d42564bacd Better align drop_throw with hero ammo breakage
There is a comment above the function indicating that it should be
aligned with hero ammo breakage, but this wasn't the case.  One big
difference is that any monster-thrown or -shot object would be deleted
unconditionally if it hit another monster trapped in a pit.  I don't
know why that was in there, but it's not present in hero ammo breakage
chances, and it meant that a monster could sling the Mines luckstone at
the hero, hit a monster in the pit, and permanently lock the hero out of
getting the luckstone (as just happened to a player during the current
tournament).  This pulls the hero breakage rules out into their own
function and uses that for monster breakage as well, to make sure they
are aligned.  I also refactored drop_throw a bit to reduce the number of
separate variables tracking whether the object was deleted (was create,
objgone, and retvalu), and changed its (and ohitmon's) type to boolean.
2023-11-11 01:17:54 -08:00
nhmall
ee0247ac5f follow-up u.uswallow 2023-11-10 19:01:16 -05:00
PatR
b03e5c1ad7 ^G of unseen monster
I used ^G to create a monster and specified "invisible owlbear".  I
then got "An owlbear appears next to you."  Except it didn't; it was
invisible and I lacked see-invisible.  I imagine that newsym() was
called for the new-yet-invisible monster, but that remained buffered
and was gone overridden by the time pending map update got flushed
at some point after the monster was made invisible.

Add a new makemon() flag to turn a newly created monster invisible
during its creation, before "monster appears" message is delivered.
Since that message will now be suppressed in this situation, use the
cursor-flash hack that indicates where the new, unseen monster got
placed.  Creating "1000 invisible <mon>" is something you probably
won't do twice.
2023-11-10 15:43:02 -08:00
nhmall
088c15b3cd improve x_monnam results when swallowed
This addresses one of the scenarios that had previously been discussed
in the comments under pull request #979.
2023-11-10 17:01:46 -05:00
nhmall
f360cb24b1 allow monster that has swallowed hero to be named 2023-11-10 16:35:43 -05:00
PatR
4512ae5bbe warning fix
Adding U suffixe to ELF_WT lead indirectly to comparing signed rn2()
with macro specifying an unsigned magic constant.
2023-11-10 10:33:50 -08:00
PatR
a758e88246 PR #1125 - more disturbing buried zombies
Pull request from entrez:  hero walking over a zombie's burial site
will only disturb it if meeting a minimum weight threshold.

Update several weight macros to be 'unsigned', matching mons[].cwt.
[I'm not sure about this one.  'unsigned short' promotes to 'signed
int' these days on most platforms.]

Closes #1125
2023-11-10 10:33:11 -08:00
nhmall
f97ff175de bring a couple of comments up to date 2023-11-10 13:17:09 -05:00
Pasi Kallinen
c44906b28e Put random room engravings on room locations only
Another case of engraving going on a cloud.
2023-11-10 20:08:45 +02:00
Michael Meyer
392295d770 Require min body weight for step to wake zombies
A newt or something probably isn't disturbing anything buried 6 feet
below the ground.  WT_ELF/2 is the size of a dingo or goblin.
2023-11-10 10:04:07 -08:00
Michael Meyer
de2c3f033a Make WT_foo defines unsigned
These are meant to be 'cwt' values and directly comparable to a
particular pm->cwt, which is an unsigned short.  My concern here was
signed/unsigned comparison warnings like the one fixed in 1538b40, but
I'm not sure if this is actually necessary: there is already a
comparison between cwt and WT_HUMAN in max_mon_load() which apparently
doesn't produce the warning...
2023-11-10 10:04:06 -08:00
PatR
069855eefc yet more #1112 - slippery hands vs sink
Fake object used for 'hands' has an address, so checking for a Null
pointer won't recognize it.
2023-11-10 09:38:40 -08:00