Commit Graph

14096 Commits

Author SHA1 Message Date
PatR
1df88e4c65 fix #H3820 - vault guard's "I repeat" message
Reported seven and a half years ago:  if you are in a vault but not
carrying any gold and the guard arrives, you're told "Follow me."
Then if you pick up gold while the guard is still in the wall breach
rather than out in the corridor, you would be told "I repeat, drop
that gold and follow me!"  "Repeat" refers to the follow part but
sounds as if it refers to the drop-gold part which isn't actually
being repeated.  Keep track of whether the guard has issued a drop
gold demand and use that to vary the wording of subsequent "I repeat"
message.

Modifies monst->mextra->egd so save and bones files are invalidated.
2022-09-09 11:45:30 -07:00
Pasi Kallinen
a733004912 Remove the per dungeon level door limit
Number of doors in a room-and-corridor style level was fixed
at 120; now the doors-array is dynamically allocated when needed.

Breaks saves and bones.
2022-09-09 19:40:45 +03:00
nhmall
c6a8519fec Guidebook update 2022-09-09 10:16:45 -04:00
Pasi Kallinen
82867ccdaf Fix traps generated inside walls
When fuzzing, noticed a trap generated inside a wall. Culprit
was one of the themed rooms that generates a rectangular room and then
puts freestanding wall columns inside.  Note in somexy that it can
return a non-accessible location, and change the places that used
it and absolutely needed a space to somexyspace.
2022-09-09 12:03:12 +03:00
PatR
3ee6bcdf76 doset_simple() revisited
For a compound option's value that uses getlin(), cancelling with
ESC wasn't dismissing the menu and could eventually result in a
"No window slots!" panic.  Clean up properly after ESC.

doset() and doset_simple() were sharing a format string but those
weren't the same if the longest option name differed.  Stop sharing.

doset_simple() didn't support menu_tab_sep.  Now it does.  (Tested
with Qt; really needs to be tested with WinGUI.  Enabling that is
expected to produce strange looking results with tty or curses.)
2022-09-08 16:26:31 -07:00
nhmall
a4c4e75467 a couple of warnings in files.c
Warning	C6031	Return value ignored: 'rename'.	src/files.c	1240
Warning	C6031	Return value ignored: 'write'.	src/files.c	3879
2022-09-08 12:31:36 -04:00
PatR
1c90965555 Passes_walls
While testing the secret door message handling, I wanted to phaze
through solid rock to get near some secret corridors.  Instead of
polymorphing into a xorn, I used #wizintrinsic to get temporary pass
through walls.  That let me move orthogonally through rock but not
diagonally.  Polymorph to xorn did allow diagonal movement.  I think
the difference was gaining 18/100 strength in that form.

Have wall phazing override narrow diagonal checks.
2022-09-08 09:18:43 -07:00
nhmall
cebc9e9416 fix a grammar bit adjacent to recent spelling fix 2022-09-08 12:08:37 -04:00
PatR
097d225994 secret door detection feedback
When zapping a wand of secret door detection or casting spell of
detect unseem instead of displaying
|You reveal secret doors.
|You reveal a secret corridor.
|You reveal traps.
|You reveal a hidden monster.
show
|You reveal 2 secret doors, a secret corridor, 3 traps, and a hidden monster.
as a single message.

Detecting invisible monsters is still a separate message; those get
re-mapped as "remembered, unseen monster" but not actually revealed.
2022-09-08 08:53:02 -07:00
nhmall
c548fff9e4 some spelling corrections
The pull request included some changes that were neither accidental nor
unintentional, so only a subset of the changes from pull request #869
submitted by klorpa were manually applied.

behaviour  -> behavior
speach     -> speech
knowlege   -> knowledge
incrments  -> increments
stethscope -> stethoscope
staiway    -> stairway
arifact    -> artifact
extracing  -> extracting

The uses of "iff" were left alone.

Close #869
2022-09-08 10:54:11 -04:00
Patric Mueller
7a90cd3608 Document italic for menu headings and menu colors 2022-09-08 12:39:02 +02:00
Patric Mueller
487f1f7ccc room stocking would put multiple items on the same spot 2022-09-08 09:24:50 +02:00
PatR
fa320a0a5f doset_simple()
Move the guts of doset_simple() into a separate routine.  Initially
that was just to avoid having to increase indentation when replacing
'goto' with 'do { ... } until ()'.  It ends up making the flow of
control easier to see.

doset() and doset_simple() each had their own static flag indicating
whether 'fmtstr_doset' had been assigned a value.  Redundant
assignment produced the same value so it wasn't an actual problem.

doset_simple() probably needs to add menu_tab_sep support for WinGUI.
Qt is able to get by without it, but that's because it forces use of
fixed-width font when any line in a menu or text window has 4 or more
consecutive spaces.  I don't think WinGUI does that.
2022-09-07 14:37:08 -07:00
nhmall
feebb561d6 redundant comparison code watchman_canseeu()
m_canseeu() already includes couldsee() so redundant code was flagged.

: #define m_canseeu(m) \
:     ((!Invis || perceives((m)->data))                      \
:      && !Underwater                                        \
:      && couldsee((m)->mx, (m)->my))

static boolean
watchman_canseeu(struct monst *mtmp)
{
    if (is_watch(mtmp->data) && mtmp->mcansee && m_canseeu(mtmp)
        && couldsee(mtmp->mx, mtmp->my) && mtmp->mpeaceful)
        return TRUE;
    return FALSE;
}
2022-09-07 07:52:33 -04:00
Pasi Kallinen
e952f67f2c Add #wizcast command to cast any spell
Wizard-mode command to cast any spell without checks that would
prevent casting, and with no energy use.

Mainly to allow the fuzzer to exercise the spell code paths.
2022-09-06 22:58:28 +03:00
nhmall
4f2996758b follow-up 2022-09-06 10:12:19 -04:00
nhmall
0086e01967 return legal indexes for some display.h macros
Some static analyzers flagged the last-resort values as
out of bounds (which they were).

There's a small number of other complaint-suppression items in here too,
but nothing drastic.
2022-09-06 10:00:07 -04:00
nhmall
817b4686ce Revert "move struct propname to a header file"
This reverts commit 402b2bf5c8.
2022-09-06 08:01:50 -04:00
nhmall
402b2bf5c8 move struct propname to a header file
In doing so, avoid repeated layout declaration in cmd.c
2022-09-06 07:22:55 -04:00
PatR
1459f44f4e \#herecmdmenu tweak
The menu for #herecmdmenu includes "look at map symbol" but if you
choose that it auto-picks the hero's location.  Looking at your own
'@' isn't particularly useful so only include that menu option if
the symbol or tile being displayed isn't the normal one.
2022-09-05 14:58:55 -07:00
PatR
4aefe3dae0 curses A_ITALIC build fix
My /usr/include/curses.h has various A_attribute macros but A_ITALIC
isn't one of them.  Compiling cursmisc.c failed because one of the
uses of that wasn't guarded by #ifdef A_ITALIC.  Instead of adding the
ommitted #if, substitute A_UNDERLINE for A_ITALIC when that's missing.

The select attribute menu when adding a menu color or a status hilite
now shows an entry for italic that's underlined (as expected) but the
underline entry itself does not display any sort of attribute.  I
didn't pursue that.
2022-09-05 14:40:41 -07:00
Pasi Kallinen
e818395a55 Add tipping a container to herecmdmenu 2022-09-05 23:27:58 +03:00
nhmall
c825e6839f redundant comparison code
: #define is_weptool(o) \
:    ((o)->oclass == TOOL_CLASS && objects[(o)->otyp].oc_skill != P_NONE)
2022-09-05 11:16:43 -04:00
Pasi Kallinen
f58f43bd78 Cannot kick while squeezed on top of a boulder 2022-09-05 11:21:19 +03:00
Patric Mueller
8bf5654eed tty and curses: support italic as text attribute 2022-09-04 22:33:25 +02:00
Pasi Kallinen
601dba5279 Make glorkums emit impossible 2022-09-04 17:43:06 +03:00
PatR
82aaa289ef discarding migrating objects when entering endgame
Avoid potential impossible "obfree: deleting worn object" warnings
when entering the endgame.

The code to get rid of items migrating to non-endgame levels passes
those items to obfree().  It needs to clear obj->owornmask first
because that's used for migration flags (undelivered orctown loot
has a non-zero value).
2022-09-03 10:45:24 -07:00
Pasi Kallinen
f5a9901db1 Special levels: mkmap roomno cleanup and room removal after map
mkmap creates mines-style full-level maps, so it should wipe
out all the room numbers in the level away. Also, it uses
temporary rooms for making sure the map is fully joined together;
those temporary rooms were left on the map, but should've
been cleared away.

When putting down map-parts on the level, don't remove the room
data which would be under that map; the map may have holes in them
(using the "x" map char), so a room may still exist there.
I don't think it matters if there is any room data which doesn't
have any room numbers referring to it in the level.
(Usually the special levels use map right after level_init anyway,
so there wouldn't be any rooms in the level)
2022-09-03 19:10:45 +03:00
PatR
7100534c80 typo fix and comment update for #migratemons 2022-09-01 13:36:50 -07:00
copperwater
82782a1d6d Make des.mineralize use default probabilities
Calling des.mineralize() with no arguments was equivalent to calling it
and manually specifying gem_prob = 0, gold_prob = 0, etc. Which meant
that no mineralization would actually happen.

Instead, make this match the intuitive behavior, and pass in -1
probabilities as defaults -- which the mineralize() function interprets
as the caller wanting to use the standard probabilities for a level of
that depth, as if it were not a special level.

This change does not affect any special level files since des.mineralize
is not currently used in any of them.
2022-09-01 17:15:36 +03:00
copperwater
d8ada3d768 Fix inaccessible spaces and shop backdoors in Bustling Town
Perennial problem: since Bustling Town consists of a fixed map which was
shorter than the moveable area overlaid onto a cavern fill, sometimes
the cavern fill made spaces above or below the walled edges of the town,
which then got cut off when the town was placed. Since one of the valid
ways to generate a way out of an inaccessible space is to create a door
connecting it to an accessible space, this meant rooms in Minetown,
including shops, could get a second door leading into that tiny space.
And if it was a shop, the shopkeeper could not block exit from the
second door.

This fixes that issue by expanding the map vertically so that it will
overwrite the whole cavern fill in the town area of the map segment
where it might create cut-off spaces like this. (Not the whole area -
since we now have the 'x' mapchar to leave existing terrain in place,
areas adjoining open space where inaccessible pockets won't get
created can retain any existing fill to keep the town from being exactly
the same every time).
2022-09-01 17:11:50 +03:00
Pasi Kallinen
c447d091b1 Fixes entry 2022-09-01 17:09:26 +03:00
Michael Meyer
51d568319b Use const char * for read_simplemail 'mbox' param
Nothing about read_simplemail is incompatible with using const, and the
lack of const required some contortions (copying ADMIN_SERVER_MSG to
another buffer with nonconst() to prevent a compiler warning).

This was the last place nonconst() was used, so I removed it.
2022-09-01 17:02:30 +03:00
Michael Meyer
b18d768b26 Some minor read_simplemail improvements
Make admin message use urgent_pline so it's less likely to be skipped
and inadvertently missed, make ending punctuation conditional on message
itself not containing any (similar to what's done for T-shirt messages
in read.c), guard against printing an empty message (from a line like
"name:\n"; it does mean that subsequent messages in a single batch will
be discarded, but that's true of the existing guard against malformed
lines as well, and it should make the overwriting of characters past the
'msg' ptr safer).
2022-09-01 17:02:30 +03:00
PatR
282cc9383f more summon nasties
If the summon nasties spell creates a single monster, the feedback
changes from "Monsters appear" to "A monster appears" but if you
were invisible or displaced it still said "around".  Avoid
| A monster appears around a spot near you!
or
| A monster appears around your displaced image!
2022-08-31 17:23:55 -07:00
PatR
3862979e88 summon nasties feedback
Reported by entrez:  when a monster casts the "summon nasties" spell,
double feedback was given.  First it produced "a <monster> appears"
for each visible monster and then "<monsters> appear from nowhere" at
the end.  The latter would have been ok at the begining but made it
seem as if even more monsters were arriving when given at the end.

Skip the monster-by-monster feedback and just give the summary at the
end.  That's enough information for a blind player to know to check
the map for new monsters.

When summon nasties is performed as randomly chosen harassment after
killing the Wizard, it still gives the enumerated "a <monster> appears"
feedback but does not give the "from nowhere" message at the end.
2022-08-31 16:34:56 -07:00
PatR
2767f4b302 fake player creation on Astral
Reported by entrez:  fake player monsters on the Astral Plane level
were giving "<role> suddenly appears!" feedback if they could be
seen or sensed when the hero arrived on that level.

They're generated separately from the level itself so the message
suppression in place during level creation didn't guard against it.
2022-08-31 13:04:54 -07:00
copperwater
f71bff3285 Standardize all core and obj functions with relative coords
This is a large iteration on a previous implementation of making
nh.getmap() parse its coordinates as relative to the last defined map or
room rather than absolute to the entire level. Now, everything in the
nh.* and obj.* functions interprets coords as relative rather than
absolute. (By default; if no map or room has been defined, or if the lua
code is executing after level creation is done, they will interpret the
coordinates as absolute).

The general motivation is basically the same - routines that use
absolute coordinates are difficult to use in level creation routines,
because then the designer has to remember to convert the relative
coordinate to an absolute one (and that was impossible before
nh.abscoord was added, particularly in themed rooms). And once
nh.getmap() takes relative coordinates, it would be very strange to have
all the other functions (setting timers, burying objects, etc) remain
with absolute ones.

In a couple places, code is changed to account for coordinates that are
relative to a *room* (which uses g.coder->croom->[lx,ly] as an offset,
instead of relative to a *map*, which uses [xstart,ystart].
Specifically, selection.iterate did not account for this, and without
this the ice themed room timer was not being started in the proper
place.

All tests are updated to respect the new behavior. Most of the modified
functions are not actually used anywhere in level files; the one
exception is starting a timer in a themed room, and that has been
adjusted.

Documentation updated as well to clarify when various things are tossing
around relative and absolute coordinates, both in comments and in
lua.adoc.
2022-08-31 18:26:05 +03:00
copperwater
a30a45be46 nh.getmap() returns information relative to the most recent des.map
There are many possible use cases for nh.getmap during level creation,
but it's rendered mostly unusable by virtue of always returning data
about the exact x,y coordinate in g.level.locations. (In particular,
it can't currently be used in themed rooms at all, because the themed
room could be anywhere on the level.) This is inconsistent with how most
other coordinate-based functions work following a des.map, which use
coordinates relative to the 0,0 point of the map.

This changes it so that during level creation only, if nh.getmap is used
following a des.map statement, it will look up the coordinates relative
to the origin of the map, consistent with the other functions.
2022-08-31 18:26:05 +03:00
Michael Meyer
93842fbb1b Fix: overwriting stairs in movement tests
Like some of the other coordinates in testmove.lua (addressed in
70008fc), the attempt to overwrite the stairs was targeting a spot
one space to the left of the actual position of the stairs, causing it
to have no effect (discussion suggested this may have been a result of
99715e0).  Update it so the stairs are properly erased and won't
interfere with movement tests by stopping a running/rushing hero early.
2022-08-31 18:24:26 +03:00
PatR
d4f0450afe fix the tty message spacing anomaly for messages \
delivered across level change checkpointing

Reported by entrez.  Simplest test case:  give level 1 a short
annotatation, level teleport to level 2, and level teleport back to
level 1.  The message window will show

|You materialize on another level.  You remember this level as <note>.

but ^P message history will show

|You materialize on another level.
|  You remember this level as <note>.

Spaces inserted to separate two messages that fit together on the
top line become part of the second message when saving a checkpoint
during level change flushes the top line into message history.

Change insurance checkpointing to record the full message history
without flushing the current top line so that toggling 'checkpoint'
doesn't affect what shows up on the screen or in message recall.
2022-08-30 15:01:49 -07:00
PatR
ed7e60f661 decl.c warnings
Fix a bunch of "suggest braces around initialization of subobject"
warnings from clang.  If gcc didn't warn about these before, it might
start complaining about too many braces now.

It doesn't attempt to do anything about missing field initializers
because I'm not seeing any warnings for those.
2022-08-30 14:56:40 -07:00
nhmall
26e61f30c8 follow-up
Revert the sys/unix/hints/include/compiler.370 for now
while a couple of warnings still exist in role.c
2022-08-29 14:35:39 -04:00
nhmall
443dc429e7 warning-free build without -Wno-missing-field-initializers
Also removes a GCC_WARN usage and the need for
#pragma GCC diagnostic ignored "-Wmissing-braces"
for src/decl.c when using gcc.
2022-08-29 14:06:12 -04:00
PatR
5ef8454771 lev_by_name() formatting bits
Formatting became strange when '#ifdef WIZARD' became unconditional
several years ago, then the bitmask testing code itself became a bit
strange when amnesia got changed a couple of years ago.
2022-08-28 16:57:42 -07:00
PatR
11ae37b358 pull request #857 - levelport destination by name
Pull request from entrez:  specifying a level teleport destination
by level name allowed non-wizard mode controlled level teleport to
move across dungeon branchs.

Does not affect wizard mode '^V ?' or 'm ^V'.

Closes #857
2022-08-28 15:35:58 -07:00
Michael Meyer
a345fc8dfb Fix: levelport by name to unconnected branch
(unconnected to the current dungeon branch, that is)

Level teleporting allows you to type in the name of a level instead of
its number.  This normally only works for levels within your current
dungeon branch (main dungeon <-> Gehennom levelports are the exception):
entering "medusa" as a destination won't work while the hero is in the
Gnomish Mines, but it will work fine to get to the Medusa level from
elsewhere in the main dungeon.

Teleporting to a particular branch entrance didn't apply the same
restriction.  The teleport would still happen even if the destination
branch was unreachable from the current branch, and in such a case the
game would just try to get the hero to the depth of the branch entrance,
within the current branch.  For example, entering "quest" as a
destination within the Gnomish Mines would bring the hero to Mines' End,
since that's the closest depth-wise it's possible to get to the quest
portal level.  Apply the same rules to branch entrances as exist for
named levels, excluding destinations that are unreachable from the
current branch.
2022-08-28 15:33:47 -07:00
PatR
a20a33ea54 pull request #863 - chronicle disclosure
Pull request from entrez:  move the 'Major events' listing (subset
of #chronicle output) later in final dumplog.

Closes #863
2022-08-28 14:34:15 -07:00
Michael Meyer
fe04b4a632 Move 'major events' section in dumplog
The sections of the dumplog can be broadly organized into two
categories: 'current state' and 'game overview'.  Current state includes
information about what exactly was happening when the game ended: the
map, recent messages, current inventory, and current attributes.  Game
overview is more like a history of the game up to that point: vanquished
monsters, extinct species, conducts, and dungeon overview.

All the current state sections are listed first, followed by the game
overview sections -- I'm not sure if this was a deliberate move to break
the dumplog into two distinct 'chapters', but it's convenient for
readers who may only want to know the circumstances of a death without
seeing the nitty-gritty details of the entire game up to that point.

The one section that wasn't ordered with its category was major events,
which was positioned near the top of the 'current state' group, above
the inventory listing.  This commit moves it into the 'game overview'
group.  I put it at the top, since it can serve as a sort of summary of
the game for those who are interested but don't care about some of the
details of monsters killed, etc.
2022-08-28 14:32:47 -07:00
Pasi Kallinen
a9c91d5744 fixes entry 2022-08-28 18:48:01 +03:00