Commit Graph

2841 Commits

Author SHA1 Message Date
Pasi Kallinen
b635160297 Minor ranged attack tweak
Make monsters with magic and gaze attacks avoid hero,
just like spitters and breathers already did.
Some small code cleanup related to the ranged attacks.
2022-08-07 22:33:47 +03:00
Pasi Kallinen
83f8ec1c43 Give pyrolisk a bite attack 2022-08-06 10:55:04 +03:00
PatR
a84025c36c more abandoned migrations when entering endgame
The earlier commit just removed monsters from migrating_mons and left
them orphaned.  Also it ignored migrating objects.

Actually release the monsters that can no longer arrive at their
migration destinations.  Release their inventories too.

Release objects that can no longer arrive at migration destinations.
2022-08-05 16:55:05 -07:00
PatR
dc381d0560 discard migrating monsters when entering endgame
When the hero enters the planes branch, all the rest of the dungeon
gets discarded since it can no longer be reached.  At the time that
that takes place, throw away any migrating monsters waiting to arrive
on any of those levels.
2022-08-05 14:36:11 -07:00
Pasi Kallinen
fa1b326e31 Save changed key binds to config file 2022-08-05 13:07:26 +03:00
Pasi Kallinen
45613ea771 Experimental #saveoptions command
Add a #saveoptions extended command, to allow saving configuration
settings from within the game. This is still highly experimental,
and gives plenty of warnings before asking to overwrite the file.

Lack of option saving is one of the biggest complaints new players
have, so this should help with it.  More experienced players with
highly customized config file should not use this feature, as it
completely rewrites the file, removing all comments and non-config
lines.
2022-08-05 10:33:55 +03:00
PatR
e5ddf400c6 'O' tweaks
Reformat most of optlist.h.  In the process, fix a couple of
conditionally included items which were mis-classified as set_in_game
when excluded.  Add "permablind" as an alias for the "blind" option.
[I don't understand the size value of 70 for #if BACKWARD_COMPAT
{curses,DEC,IBM,Mac}_graphics but didn't alter that.]

Include 'pickup_types' in the behavior section; it's useful from
turn 1 and does get adjusted from time to time during play.

Include 'color' in the map section, but hide it for wc_tiled_map.

Include 'showscore' and 'statuslines=2|3' in the status section.
I didn't rebuild with SCORE_ON_BOTL enabled so the showscore part
hasn't been tested.
2022-08-04 16:53:31 -07:00
Pasi Kallinen
4ff9537b0d Rudimentary key rebinding in game options
Currently shown only in the full options list, as it's not
quite complete. (For example, it doesn't handle movement commands,
or the getpos keys)
2022-08-04 14:42:45 +03:00
Pasi Kallinen
bfd262ebe8 Add optionsfull extended command
This is the previous, full options list. Adding it as
an extended command, so users can do

BIND=O:optionsfull

to go back to the old behaviour.
2022-08-03 19:18:44 +03:00
Pasi Kallinen
f3591ea07d User-friendly options menu
Make the default options menu only show the most important
options, split into categories. The full, traditional menu
can be accessed by using the m-prefix.
2022-08-03 14:08:31 +03:00
Pasi Kallinen
f4d0e99fad Reset map x/y start/size in single place 2022-08-02 17:02:25 +03:00
PatR
8a9dc00cde don't negate new moon with a lizard corpse
The only effect of a new moon was to make hearing a cockatrice's
hissing (whichs happens with 1 in 3 chance) always start the turn to
stone sequence instead just having a 1 in 10 chance to do so, but
that was negated by carrying a lizard corpse.

Keep the hiss-always-starts-petficiation part and remove the
carrying-a-lizard-corpse-negates-that part.  So the effect of a new
moon no longer gets controlled by the contents of hero's inventory.
2022-07-31 16:12:40 -07:00
Pasi Kallinen
05761bada6 Holes and trapdoors have predetermined exit level
Same hole/trapdoor will always take you to the same level.
2022-07-27 22:51:17 +03:00
Pasi Kallinen
0da356c540 Enable migrating mons debugging 2022-07-27 12:21:07 +03:00
PatR
75abc65bab pull request #817 - merge scimitar skill w/ saber
Pull request from Kufat:  combine a pair of single item skills into
one skill by changing scimitar to use saber skill and removing no
longer used scimitar skill.

I don't think skill values end up in save files but decided to
increment EDITLEVEL to be safe.

Closes #817
2022-07-23 23:14:12 -07:00
Kufat
296a3ac246 Merge scimitar skill into saber skill
Deleted scimitar skill, changed scimitar to use saber skill.
Adjusted Barbarian's max saber mastery basic->skilled for consistency
with former scimitar skill.
2022-07-23 23:11:13 -07:00
Pasi Kallinen
82f0b1e8ea Scared hostile monster which cannot move away will attack 2022-07-21 20:21:10 +03:00
Pasi Kallinen
b1a5a9c390 Demonbane changes
Demonbane is now a mace, the first sac gift for priests,
and gets an invoke ability to banish demons.
2022-07-19 21:23:26 +03:00
Pasi Kallinen
d713c1826b Buzz macros and related stuff
Add macros to convert AD_foo, WAN_foo, and SPE_foo to relative values
for passing to BZ_U_foo and BZ_M_foo macros.

Change some return values in monster spellcasting function from
magic numbers to MM_MISS or MM_HIT.

Make buzzmu consider hero resistances - previously the
monster with innate zapping ray (Angels and Asmodeus) would
just keep doing that attack, but they will now just curse if
it saw the hero resist the attack.
2022-07-19 15:14:55 +03:00
Pasi Kallinen
0bca93be87 Large monster can knock back smaller ones
When a monster at least two sizes larger hits another one,
there's a chance the smaller defender will be knocked back.

This applies also to hero, attacking when polymorphed to
a large monster, or defending from a large monster.

Most of the monsters that can knock back are giants and dragons.

Idea and some of the code from EvilHack.
2022-07-18 23:01:11 +03:00
Pasi Kallinen
aa09f3eef5 Use macro unhideable_trap 2022-07-18 13:27:39 +03:00
Michael Meyer
cc46da90e0 Fix #812: recovered stair dlevel
Stair dlevels weren't being restored with the correct values when
recovered after the game crashed, apparently because they weren't being
reset back to their 'absolute' level from a 'relative' level.  I'm not
totally sure of why this affected only recovered games (maybe that's the
only time when the 'relative' stair values are used?) but this fix seems
to work.

Fixes #812
2022-07-17 16:12:39 -07:00
Pasi Kallinen
7c96825525 Demote elf-queen to a lady 2022-07-17 21:47:32 +03:00
Pasi Kallinen
823a6f247b Unify picking crawl goodpos 2022-07-17 21:37:31 +03:00
Pasi Kallinen
6fe0f7c132 Unify impaired movement direction checks 2022-07-17 12:23:49 +03:00
nhmall
3fb45dfa4c comment typo 2022-07-16 20:38:00 -04:00
PatR
3ce02fedc8 glyph macro formatting
Change some more
  (first_line <op> \
   second_line)
to
  (first_line \
   <op> second_line)
for various values of <op> besides '&&' and '||'.  Also clean up some
indentation and backslash+newline alignment.

For object_is_piletop() don't bother to validate that an object which
is classified as being on the floor is actually on the floor at its
specified map coordinates.  That check was propagating to expansions
of multiple macros and if it ever failed it would just be hiding a
very serious bug without helping to fix that.
2022-07-16 15:36:25 -07:00
Pasi Kallinen
94c1e94d20 Move mtrack push and clear to separate functions 2022-07-16 18:43:22 +03:00
PatR
b37f922cf7 viz_array[][] type
viz_array[][] is indexed by coordinates but the data it contains has
nothing to do with them so it shouldn't have been changed to coordxy.
'char' was sufficient; 'uchar' would have been better; this invents
'seenV' instead.  This led to a cascade of required changes.  The
result is warning free and seems to be working but my fingers are
crosssed....
2022-07-15 13:48:29 -07:00
PatR
b14b830b49 simplify glyph_is_cmap()
I captured preprocessor output while debugging vault guard changes
and noticed that glyhp_is_cmap() was expanding to an excessive amount
of code.  Simplify it.

Also, a bunch of the cmap macro definitions were using old
 (foo && \
  bar)
instead of current
 (foo \
  && bar)
so this changes those.
2022-07-14 14:46:32 -07:00
Pasi Kallinen
486ed29077 Blessed potion of polymorph asks user for monster to poly into
... unless there's some other form that would override the choice,
such as a worn dragon armor, lycanthropy, or vampirism.

The polymorph will be in effect for 10-24 turns.
2022-07-14 14:04:27 +03:00
PatR
aba500b482 fix #K3633 - vault guard parked at <0,0> brought \
back into play with bad data

I don't have a test case to verify the fix, and I'm not absolutely
certain that the cause has been correctly diagnosed, but I think the
problem was caused by a guard being sent into limbo because the map
was too full to place it, then while it was on the migrating monsters
list waiting for a chance to come back the fuzzer executed #wizmakemap.
If the hero left the level and subsequently returned, the guard would
arrive back but monst->mextra->egd contained data for the previous
incarnation of the level that's invalid for wizmakemap's replacement.

Treat any shopkeeper, temple priest, or vault guard who is not on his
'home' level like the Wizard has been treated since 3.6.0.  When
leaving the level they're on, put them on the migrating monsters list
scheduled to return to present position instead of stashing them in
the level's data file.  That way they can be accessed from any dungeon
level, so wizmakemap can pull ones for the level it's replacing off
the migrating monsters list when removing the old level's monsters,
handling both migration-pending and already-arrived-on-another-level.

Bonus fix:  put monsters who are on the migrating_mons list solely in
order to be accessible from other levels back first when returning to
the level they're on so that pets and the hero can't hijack their spot
when those arrive.  The Wizard has been vulnerable to that.

Not fixed:  #wizfliplevel command needs to flip parts of shk->mextra->
eshk and priest->mextra->epri for shk or priest on migrating_mons.
Vault guards don't contain anything flippable when migrating, but do
have coordinates that need fixing up while they're maintaining a
temporary corridor to/from the vault.
2022-07-13 15:19:51 -07:00
Pasi Kallinen
a1ca981907 Grid bugs don't have hands
Fixes #799
2022-07-13 11:21:21 +03:00
PatR
0059ced578 bump EDITLEVEL
The most recent "simulated mouse" commit included changes to 'struct u'
that should have been accompanied by an increment in EDITLEVEL.  Do the
missing increment now.
2022-07-10 15:43:49 -07:00
PatR
fed367ccbd simulated mouse again
Change u.{dx,dy,dz} from schar to int and get rid of unused u.di.

Remove just added getdir_ok2click; it was declared as int but being
assigned booleans.  Rename getloc_click to getdir_click and have
getdir() use it for both input and output.

A simulated mouse is becoming quite a nuisance for something which
will probably never be used by anyone in actual play.
2022-07-10 11:14:10 -07:00
PatR
6ac5525239 restore getdir simulated mouse click
When getdir is given '_' as a direction, it calls getpos to get a
map location rather than just a direction.  Have getdir()'s caller
explicitly enable that so using '_' for other than #therecmdmenu
doesn't produce a delta that's farther than one step away.
2022-07-10 06:55:16 -07:00
nhmall
c84e0ba6e1 rework TTY_PERM_INVENT; update window port interface
Change the inner workings of the experimental TTY_PERM_INVENT.

Switch to delivering the content to tty for the experimental perm_invent
via the existing window port interface (start_menu(), add_menu(), end_menu).

This also adds a new window port interface call ctrl_nhwindow() for
delivering information to the window port, and/or obtaining specific
information from the window port. The information and requests can
be extended as required. To be documented later once the changes settle
down.

Due to the intrusive nature of these changes and the possibility of
some bugs in the new code, I'm going to leave TTY_PERM_INVENT commented
out in the repository for a day or two.  Anyone wishing to test it out
can do so by uncommenting TTY_PERM_INVENT in config.h.
2022-07-03 00:35:32 -04:00
nhmall
75c5f3713f a couple of follow-ups 2022-07-02 09:21:58 -04:00
nhmall
3004cf2d34 be more consistent with coordinates 2022-07-02 09:10:03 -04:00
PatR
dda4cd0530 regex handling
Change the regex_error_desc() interface.  Have the caller pass in
a pointer to a buffer of at least BUFSZ characters and have
regex_error_desc() populate that.  No need for static buffers or
extra dynamic alloction.

Also, change it to never return Null.  None of its callers were
checking for that and could have passed Null to config_error_add()
or raw_print().  printf("%s", NULL) produces "null" on OSX but other
systems would probably crash if a Null result ever actually occurred.

The error explanation returned by cppregex included a trailing period.
config_error_add() adds one, so the message ended up with two.  Have
regex_error_desc() check for final period and strip it off if found.
(My test case used a menucolor pattern of "[" which triggers an error
about mismatched brackets.)

Reformat cppregex.cpp; treat 'extern "C" {' as if it isn't introducing
a nested block.  Fix the '#include <hack.h>' that 'make depend' was
ignoring.
2022-07-01 13:08:43 -07:00
nhmall
84baa5d7d4 comment update 2022-07-01 08:36:03 -04:00
nhmall
465db21c79 typedef follow-up 2022-07-01 08:23:31 -04:00
nhmall
30b557f7d5 change xchar to other typedefs
One of the drivers of this change was that screen coordinates require a
type that can hold values greater than 127. Parameters to the window
port routines require a large type in order to be able to have values
a fair bit larger than COLNO and ROWNO passed to them, particularly for
their use to the right of the map window.

This splits the uses of xchar into 3 different situations, and adjusts
their type and size:

                        xchar
                          |
               -----------------------
               |          |          |
            coordxy     xint16     xint8

coordxy: Actual x or y coordinates for various things (moved to 16-bits).

xint16:  Same data size as coordxy, but for non-coordinate use (16-bits).

xint8:   There are only a few use cases initially, where it was very
         plain to see that the variable could remain as 8-bits, rather
         than be bumped to 16-bits.  There are probably more such cases
         that could be changed after additional review.

Note: This first changed all xchar variables to coordxy. Some were
reviewed and got changed to xint16 or xint8 when it became apparent that
their usage was not for coordinates.

This increments EDITLEVEL in patchlevel.h
2022-06-30 23:48:18 -04:00
nhmall
43941afe19 Revert "follow-up 3"
This reverts commit cd57dfa5ff.
2022-06-30 22:36:45 -04:00
nhmall
cd57dfa5ff follow-up 3 2022-06-30 13:27:46 -04:00
nhmall
f228fefabd updated window_procs
Add a non-string identifier to window_procs for use in runtime
identification of the current window port being used.

Use a macro WPID to add the identification at the top of the
various existing window_procs declarations. It expands to the
existing text string, as well as the newly added field wp_id
with a wp_ identifier.

For example, WPID(tty) expands to: "tty", wp_tty

The generated wp_tty must be present in the wp_ids enum at
the top of include/winprocs.h.

The WINDOWPORT(x) macro has been updated to expand to a simple
value comparison (port.wp_id == wp_x), instead of a
string comparison.
2022-06-29 23:21:19 -04:00
nhmall
a518d82c54 no quotes in WINDOWPORT macro invocation 2022-06-29 22:13:28 -04:00
nhmall
af58acccd2 some tty perminvent follow-up() 2022-06-27 08:13:37 -04:00
nhmall
2770223d10 interface groundwork for core-side color decisions
(user-side decisions really, but as it stands right now
user-side decisions/options are made and processed by the core)

add a parameter to add_menu so color can be passed
2022-06-25 13:21:51 -04:00
PatR
cde9b7e481 streamline the tty perm_invent bounder box set up
For the tty perm_invent boundary box initialiation, instead of doing
one of many assignments that do glyph lookup, do one of many symbol
assignments and one glyph lookup.  No change in observable behavior.

Also, use the main dungeon's walls for box rendering instead of
selecting ones for whatever branch the hero happens to be in at the
time perm_invent gets enabled.
2022-06-24 23:35:26 -07:00