Commit Graph

102 Commits

Author SHA1 Message Date
PatR
e8184663e0 extra traps followup
"add glyphs+tiles for door+chest traps",
commit d1217b9f25,
missed a couple of S_vibrating_square references, resulting in
screwed up rendering of zaps and explosions.
2022-04-27 15:43:18 -07:00
Pasi Kallinen
074476758c Change map terrain changing from macro to function
The function handles setting lava lit, and removing ice melt timers.
2022-03-16 20:59:58 +02:00
Pasi Kallinen
5786ddadbb Use IS_WATERWALL and is_waterwall 2022-02-23 12:53:09 +02:00
PatR
d9bbad8e6e fix github issue #606 - shop wall repair
triggering an impossible warning about "wall_angle: unknown" due
to the known conflict between door state and wall info which both
overlay the flags field for map locations.

Reported and diagnosed by vultur-cadens:  if a shop's wall was dug
open, followed by use of locking magic to plug the gap with a door,
and then unlocking that door, the D_CLOSED door flag was left as
invalid wall_info when shop damage was repaired.  Map re-display
complained.  Leaving the door locked or opening it after unlocking
did not result in any complaint because the values for those door
states do not conflict with wall angle values.

The problem was reproducible and is now fixed by adding an extra
field to the shop damage structure.  A similar change has been
made to the vault guard's 'fake corridor' structure but I have no
test case for that so don't know whether it makes any difference.
At least it doesn't seem to have broken anything.

Existing save and bones files are invalidated by the fixes.

Fixes #606
2021-10-15 15:43:23 -07:00
nhmall
2baadd6a29 header files sym.h and defsym.h
There were multiple symbol-related lists that had to be kept
in sync in various places.

Consolidate some of that into a single new file
    defsym.h
with a set of morphing macros that can be custom-called from
the various places that use the sym info without maintaining
multiple occurrences. Most maintenance can be done there.

Rename monsym.h to sym.h since it looks after some
symbols not related to monsters now too.

The defsym.h header file is included in multiple places to
produce different code depending on its use and the controlling
macro definitions in place prior to including it.

Its purpose is to have a definitive source for
pchar, objclass and mon symbol maintenance.

The controlling macros used to morph the resulting code are
used in these places:
  - in include/sym.h for enums of some S_ symbol values
    (define PCHAR_ENUM, MONSYMS_ENUM prior to #include defsym.h)
  - in include/objclass.h for enums of some S_ symbol values
    (define OBJCLASS_ENUM prior to #include defsym.h)
  - in src/symbols.c for parsing S_ entries in config files
    (define PCHAR_PARSE, MONSYMS_PARSE, OBJCLASS_PARSE prior
    to #include defsym.h)
  - in src/drawing.c for initializing some data structures/arrays
    (define PCHAR_DRAWING, MONSYMS_DRAWING, OBJCLASS_DRAWING prior
    to #include defsym.h)
  - in win/share/tilemap.c for processing a tile file
    (define PCHAR_TILES prior to #include defsym.h).
2021-08-10 13:35:25 -04:00
Pasi Kallinen
267ac5add2 Add colored branch stairs
Different color for stairs that go to another dungeon branch.

Adds four new glyphs, S_br{up,dn}{stair,ladder}, which use the
same character as normal stairs/ladders, but yellow color.
In tiles, the up/down arrow is yellow-green instead of while-blue.

This feature has been around a lot and is in several different
variants, but this is implemented from scratch so tiles work too.
2021-07-27 17:21:01 +03:00
nhmall
f963c5aca7 switch source tree from k&r to c99 2021-01-26 21:06:16 -05:00
Pasi Kallinen
deb730d9b5 More hypothetical type mismatches 2020-11-15 13:51:47 +02:00
Pasi Kallinen
6ec55a3624 Rework stairs structure
Use a linked list to store stair and ladder information, instead
of having fixed up/down stairs/ladders and a single "special" (branch)
stair.

Breaks saves and bones.

Adds information to migrating objects and monsters for the dungeon
and level where they are migrating from.
2020-11-13 20:27:17 +02:00
nhmall
01c4a50f98 warning and a bit of alignment-related header consolidation 2020-10-30 09:08:23 -04:00
PatR
f20a6bb491 special level's lit state when changing terrain
Part of pull request #308:  when using des.terrain to set terrain,
default for lit state becomes 'unchanged' rather than 'unlit'.
des.replace_terrain already operates that way.  Replace lit state
magic numbers -1 and -2 with SET_LIT_RANDOM and SET_LIT_NOCHANGE.

Also change SET_TYPLIT() to not operate on map column 0 and move
it from rm.h to sp_lev.h.  It never belonged there, is only used
in sp_lev.c, and now because of the SET_LIT_ macros it couldn't be
used anywhere else unless sp_lev.h gets included too.
2020-09-06 16:17:33 -07:00
nhmall
ac9ba38449 file header bump from "NetHack 3.6" to "NetHack 3.7" 2020-08-03 22:07:36 -04:00
PatR
4ca707ecf4 fix -Wmissing-prototypes warning
drawing.c doesn't include extern.h, so the def_char_... functions
it defines aren't preceded by a prototype.  Having such guaantees
that code in other files sees the same argument types as in the
defining code.
2020-05-09 15:51:38 -07:00
Pasi Kallinen
d78dcdcb9b Allow matching any wall map terrain in lua scripts
When matching a terrain, allow using a "w" placeholder that matches
any solid wall:

For example:
   local s = selection.match([[w.w]]);
would match all floor locations with a wall to the left and right of it.
The walls can be solid stone, horizontal, vertical, etc.

This applies to selection.match(), selection.filter_mapchar(), and
des.replace_terrain()
2020-04-13 20:00:34 +03:00
Pasi Kallinen
5f9714bf92 Remove workarounds for ancient compilers 2020-04-03 08:21:08 +03:00
nhmall
d37fa196b2 make a distinction between rock and unexplored area
This adds a pair of new glyphs: GLYPH_UNEXPLORED and GLYPH_NOTHING

GLYPH_UNEXPLORED is meant to be the glyph for areas of the map that
haven't been explored yet.

GLYPH_NOTHING is a glyph that represents that which cannot be seen,
for instance the dark part of a room when the dark_room option is
not set.  Since the symbol for stone can now be overridden to
a players choice, it no longer made sense using S_stone for the
dark areas of the room with dark_room off. This allows the same
intended result even if S_stone symbol is mapped to something visible.

GLYPH_UNEXPLORED is what areas of the map get initialized to now
instead of STONE.

This adds a pair of new symbols: S_unexplored and S_nothing.

S_nothing is meant to be left as an unseen character (space) in
order to achieve the intended effect on the display.

S_unexplored is the symbol that is mapped to GLYPH_UNEXPLORED, and
is a distinct symbol from S_stone, even if they are set to the same
character. They don't have to be set to the same character.

Hopefully there are minimal bugs, but it is a deviation from a
fairly long-standing approach so there could be some unintended
glitches that will need repair.
2020-02-08 00:48:03 -05:00
PatR
c911446188 more wizard mode wishing for terrain
Try a lot harder to keep terrain/level flags in a sane state.  They're
overloaded so it's not simple.

Creating a fountain or sink incremented the corresponding counter (for
controlling ambient sounds) but removing one by wishing for something
else in its place didn't decrement.

Allow wish for "disturbed grave" to create a grave with the 'disturbed'
flag set, similar to existing "magic fountain" and 'blessedftn' flag.
(I didn't add "looted throne", "looted tree", and several other things
that use the 'looted' overload of 'rm.flags'.)

Automate block_point (tree, cloud, secret corridor, or secret door in
open doorway) and add unblock_point (use Pass_wall to move into wall
or tree or stone, or just walk onto a cloud, then make iron bars or
almost any other wishable terrain to replace the blocking feature).
2020-01-26 12:23:50 -08:00
PatR
8853d0e566 wizard mode wishing for secret doors
Allow wishing for secret doors and secret corridors.  It's a bit
more strict about where the wish is performed than wishing for
furniture.  Implemented in order to test drum of earthquake effects.

I spent a lot of time figuring out SDOOR details that somebody
already knew at some point but evidently didn't document--you can't
specify D_CLOSED for them or the display code will issue impossible
warnings about wall mode angles.
2020-01-05 13:13:21 -08:00
nhmall
18f6af1466 Merge branch 'NetHack-3.6' 2019-11-16 18:27:50 -05:00
PatR
2a07924063 rename S_player_override to S_hero_override 2019-11-16 14:31:57 -08:00
nhmall
6213c37d0b Merge branch 'NetHack-3.6' part 2 2019-10-28 00:59:44 -04:00
nhmall
34d38dcf82 Merge branch 'NetHack-3.6' 2019-10-28 00:45:56 -04:00
nhmall
a399151d01 some symbol tweaks
A few symbol-related modifications:

- fulfill a request from a blind player to allow them to
  specify a unique/recognizable character for all pets and/or
  the player in the config file for use when using a screen
  reader (S_player_override, S_pet_override). Requires sysconf
  setting ACCESSIBILITY to be set to have an effect, although
  they can still be specified in the config file.

- Config file SYMBOLS entries were not working properly on
  the rogue level. Allow ROGUESYMBOLS as well as SYMBOLS to be
  specified in the config file independently.

- When values are moved into showsyms[], the overriding SYMBOLS
  or ROGUESYMBOLS entry from the config file is used if there is
  one; if there is no overriding value for a particular symbol,
  the loaded symset value is used; if there is no symset entry
  loaded for the symbol then a default symbol is used.
2019-10-27 23:12:11 -04:00
nhmall
3ccc6e5308 Merge branch 'NetHack-3.6' 2019-10-17 20:52:10 -04:00
PatR
6182b014ca github pull request #235 - curses symbol set init
Fixes #235

For initial options under curses, specifying 'DECgraphics' as a
boolean rather than as 'symset:DECgraphics' wasn't overriding the
new default 'symset:curses'.  Since previously DECgraphics was
rejected for curses, it's possible that no one noticed.
2019-10-17 14:38:45 -07:00
PatR
3e368b9a51 symbol set reorganization
Change the way symbol sets are loaded to make them have the same order
as they appear in the symbols file rather than being reversed.

Revise dat/symbols so that the new ordering yields a result similar
to the old ordering, more or less.  I've added a few set descriptions.
The only substantive change is marking DECgraphics as primary-only
(not available on rogue level) and adding new set DECgraphics_2 which
is commented out near the end.

Define symbol handling H_MAC since one of the sets specifies
'handling: MAC'.  All H_MAC is used for now is to avoid showing
MACgraphics as a symset when compiled without MAC_GRAPHICS_ENV (which
was used for pre-OSX Mac by the old code in sys/mac/), so it will be
hidden for everyone.

I left handling H_CURS even though curses doesn't implement anything
for it.  It could do something when rendering the map or assign a
function to 'cursesgraphics_mode_callback' for special init or both
but hasn't needed to.  Since curses is now supporting DECgraphics,
define 'decgraphics_mode_callback' for it.  No value is being
assigned so that doesn't do anything; curses seems to be setting up
the primary character set as text and secondary one as line-drawing
without the need for that hook.

With the added set descriptions, 'O's symset menu looked horrible for
curses due to the way curses decides to set the width of menus and
the resulting line wrapping which took place because of a too-narrow
menu.  I've added a chunk of code to the options handling code which
shouldn't really be there but makes the menu much easier to read.

Lastly, do some formatting cleanup in files.c.
2019-10-17 05:00:58 -07:00
PatR
d0c4d27a50 githib pull request #232 - curses symset
This time I'm putting things in as-is before making a few tweaks.

The pull request was three or four separate changes.  I used the
patch instead so they've been collected into one commit.
2019-10-16 15:52:00 -07:00
nhmall
d0210d9c90 Merge branch 'NetHack-3.6' 2019-06-08 09:38:27 -04:00
PatR
c741d6c7c9 missile light sources
Throwing or kicking a lit lamp, lit candle, or lit potion of oil
wasn't giving off any light as it travelled to its destination.
Now it does, and dungeon features, objects, or monsters that are
temporarily seen as it moves from square to square till appear on
the map.  In the monster case, they go away as soon as the light
moves beyond range, but when it finishes moving the "remembered,
unseen monster" glyph will be drawn at their location.  I think that
part has some room for improvement, but mapping temporarily seen
terrain features is the primary impetus for this change.

Also, any message delivery while the "lit missile" travelled still
showed its light around the hero.  Noticeable for lamps or stacks
of sufficient candles if hero has no other light source.

This cannibalizes the monst->mburied bit for temporarily seeing a
monster.  It has been present but unused for ages.  I needed to
replace a couple of vision macros to make sure they didn't examine
it any more so that overloading for transient lighting doesn't
introduce any vision oddities.  For version $NEXT, monst->mtemplit
can be given its own bit.  It is only set during bhit() execution
and cleared by the time that returns, so has no effect on save files.
2019-06-08 04:50:40 -07:00
nhmall
034ce7e8bd Merge branch 'NetHack-3.6.2' 2019-01-12 01:09:17 -05:00
PatR
8b02e5b32b enum values
Give the enum lists in several header files explicit values.  Adding
or removing new entries will be more tedious, but doing that is rare
and being able to grep the headers for numeric values in addition to
names is very useful.

rm.h also has a bunch of tabs replaced with spaces.
2019-01-11 17:18:48 -08:00
Bart House
be5cdcf77a killer, level and rooms move to instance globals. 2018-12-24 19:50:08 -08:00
Bart House
572ee347b9 Another round of instance globals changes. 2018-12-24 16:43:50 -08:00
Bart House
74edf42f1c Moved decl.c globals into instance globals. 2018-12-22 18:44:22 -08:00
Bart House
3645e415e3 Moved more globals to instance_globals. 2018-12-19 20:01:55 -08:00
Bart House
912886a73f First set of changes to move globals to instance_globals. 2018-12-19 20:00:35 -08:00
nhmall
ca84486133 clean master after moving of newer content to feature branch 2018-12-10 22:16:08 -05:00
nhmall
f147d692e2 Merge branch 'NetHack-3.6.2' 2018-11-24 16:11:58 -05:00
PatR
cc5bb44a9a fix #H7591 - migrating monsters vs full levels
During level change, when a monster from mydogs (monsters accompaying
hero, usually pets) couldn't be placed because the level was full, it
was set to migrate to that level (in order to get another chance to
arrive if hero left and returned).  The code sequence
 mon_arrive()-> mnexto()-> m_into_limbo()-> migrate_to_level()-> relmon()
tried to remove the monster from the map, but it wasn't necessarily on
the map (depending upon whether it couldn't arrive at all, or arrived
at the hero's spot and couldn't be moved out of the hero's way).  The
EXTRA_SANITY_CHECKS for remove_monster() issued impossible "no monster
to remove".  relmon() now checks whether monster is already off the map.

While investigating that, I discovered that pets set to re-migrate
to the same level to try again on hero's next visit didn't work at all.
migrating_mons gets processed after mydogs so moving something from
the latter to the former after arrival failure just resulted in
immediate second failure when the more general list was handled during
the hero's current arrival.  And failure to arrive from migrating_mons
would kill the monster instead of scheduling another attempt.

The sanest fix for that turned out to be to have all monsters who
can't arrive be put back on the migrating_mons list to try again upon
hero's next visit.  Pets still fail twice but are no longer discarded
during the second time, and now do arrive when hero leaves and comes
back provided he or she has opened up some space before leaving.  If
there's still no space on the next visit, monsters who can't arrive
then are scheduled to try again on the visit after that.

Recent fix for invalid corpses becomes moot.  Monsters aren't killed
during arrival failure so there are no resulting corpses to deal with.
2018-11-24 01:45:09 -08:00
nhmall
7ad3f32e16 Revert "Renamed instance_variables to global_variables and iv to g."
This reverts commit f9a0db6c44.
2018-11-23 22:17:07 -05:00
Bart House
f9a0db6c44 Renamed instance_variables to global_variables and iv to g. 2018-11-23 15:22:53 -08:00
Pasi Kallinen
80d1aae8a5 ifdef, not if 2018-11-23 15:15:04 +02:00
nhmall
1ac28dd6de Merge branch 'NetHack-3.6.2' 2018-11-20 22:50:52 -05:00
nhmall
03ef9da591 Merge branch 'macosx-curses-fall2018' into NetHack-3.6.2-beta01 2018-11-20 21:01:48 -05:00
Pasi Kallinen
b54dda5624 More monster location sanity checks
Placing a monster over already existing one will now complain.
Define EXTRA_SANITY_CHECKS to check monster removal too.
2018-11-19 22:38:16 +02:00
nhmall
cb43061076 curses changes to existing files 2018-11-16 20:51:22 -05:00
nhmall
3c25703576 Merge branch 'NetHack-3.6.2' 2018-09-26 17:39:20 -04:00
PatR
3a62075070 fix #H7136 - iron bars vs non-diggable walls
Iron bars can be destroyed in some circumstances (hit by yellow
dragon breath or thrown potion of acid, being eaten by rust monser
or black pudding, or by poly'd hero in those forms) and should act
like walls for diggable/non-diggable purposes.  But they aren't
walls, so the non-diggable flag was not being set for them by the
special level loader.  Even once that was changed, they weren't
being handled consistently.  Some places checked for non-diggable
directly (zap_over_floor of acid breath, potion of acid hitting bars)
and started working as intended, others used may_dig() to check
non-diggable (poly'd hero attempting to eat iron bars) but it doesn't
handle iron bars, and still others didn't check at all (bars-eating
monster who moved onto bars location in expectation of eating those
next).
2018-09-25 16:43:06 -07:00
nhmall
0e2555881a Merge branch 'NetHack-3.6.0' 2018-04-25 18:15:49 -04:00
keni
d8c49ec9d1 Add updated copyright lines, part 1. 2018-04-25 15:00:13 -04:00