Commit Graph

15156 Commits

Author SHA1 Message Date
Pasi Kallinen
82bb61532c Bigrm-4 fix and variation
The "butterfly" shaped bigroom was missing the four fountains
in the corners of the room - this was due to my copy-paste error
when converting the bigrooms from des to lua.

Also add some variation to the bigroom.
2023-04-09 11:09:53 +03:00
PatR
bbd76562b0 redo fix for issue #1003 - energy drain
The fix in commit 14d003c4ba prevented
current energy from ending up 1 point above maximum energy but it
didn't preserve the intent of splitting the drain with up to half
coming out of maximum and the remainder out of current.  This restores
that intent but now only does so when maximum is more than the full
drain amount rather than when it is more than the up-to-half portion,
becoming less harsh when hero's max energy is very low.  If current
is also very low then max energy will be reduced anyway, but by less.

Some unrelated formatting of invent.c has gotten mixed in.

Revises #1003
2023-04-08 16:40:21 -07:00
Pasi Kallinen
b61aa235c7 Items thrown by monsters landing on an altar 2023-04-08 21:24:10 +03:00
Pasi Kallinen
ce1f4788cd Angering monsters hit by items from exploding bag of holding 2023-04-08 18:25:45 +03:00
Pasi Kallinen
3296fc729e cmd_from_func prefers printable key over ctrl combination
If command is bound to multiple keys (like #kick), cmd_from_func
prefers to return the key in the printable range over a ctrl-key
combo.
2023-04-08 11:25:07 +03:00
PatR
14d003c4ba fix github issue #1003 - anti-magic field energy
Issue reported by vultur-cadens:  when trap effect of an anti-magic
field reduced maximum energy, the result might end up with current
energy being one point higher than new maximum.

Fixes #1003
2023-04-07 23:34:19 -07:00
Pasi Kallinen
6c2d7c3695 Tutorial: twoweapon and swap weapons 2023-04-06 19:30:54 +03:00
Pasi Kallinen
a39716ae13 Hellfill: multiple prefabs per level 2023-04-06 13:54:40 +03:00
Pasi Kallinen
916aefc78c Hellfill: vertical breaks 2023-04-06 13:30:48 +03:00
PatR
c82c50a57b pull request #1007 - avoid free(emptystr)
Pull request from argrath:  save_luadata() sets 'lua_data' to
'emptystr' if the fetch variables routine returns Null, and later
passes 'lua_data' to free() unconditionally.  Freeing 'emptystr'
won't work and might crash (if the fetch routine ever returned Null,
which might never happen).

Fixes #1007
2023-04-06 02:18:08 -07:00
SHIRAKATA Kentaro
3b567dd74e prevent free()ing static buffer on save_luadata() 2023-04-06 02:17:31 -07:00
PatR
0d31bb8c88 change program_state.getting_a_command
to program_state.input_state

Rename program_state.getting_a_command and give it an int value
instead of treating it as boolean.  Start using to it for Qt to
suppress commands initiated from the drop down menus in the title bar
if nethack isn't expecting to get a command from the user.  Those menu
choices inject extended command text into the input stream and should
be avoided when entering text or waiting for a menu to be dismissed.

These menus would be better if they grayed out unavailable choices
when pulled down instead of accepting any choice and then treating
that no good.  I'm not going to try to figure out to do that with Qt.
And this workaround for the menus doesn't have any affect on the
toolbar buttons below the title bar.  Those execute core commands
directly and when I tried to use jacket routines instead, the tool bar
stopped showing up so I've given up.

This won't fix the reported problem of getting stuck in a loop.
2023-04-06 01:56:08 -07:00
PatR
4927527493 get rid of warnings when building tty interface
My guess about NCURSES_CONST was right; it expands to nothing in the
/usr/include/term.h on my old OSX system.  There aren't any levers or
knobs available to avoid that so this adds casts of string literals
to avoid warnings about passing a literal to something that expects
non-const.

There's a lot of conditional code in termcap.c and the nhStr("foo")
(hidden cast) changes only got tested for my default configuraiton.
I tried to avoid typos but I attempt such all the time and we know
how that tends to go.

Are we sure that systems which need to install a curses development
package have term.h without that?  A tty-only build shouldn't require
that.
2023-04-06 01:18:39 -07:00
Pasi Kallinen
697ef9760c Curses: partial stack unselecting
In curses, selecting a partial stack, then unselecting the entry,
and then selecting it normally, the entry still kept the quantity
from the partial selection. Make it behave like all the other
windowports by resetting the quantity when the entry is unselected.
2023-04-05 19:50:43 +03:00
nhw_cron
5ac4221d6a This is cron-daily v1-May-8-2022. 000files updated: Files 2023-04-05 12:28:41 -04:00
nhmall
2185d325c4 header file changes hack.h, decl.h/.c, system.h, wintty.h
- Move secondary preprocessor defines down further in config.h
so that they can be overridden via [platform]conf.h which is
included from global.h, specifically:
    LIVELOGFILE when LIVELOG is defined
    DUMPLOG_FILE when DUMPLOG is defined

- Minimize platform-specific, or compiler-specific code in hack.h and decl.h.

- reorganize src/decl.c to align with include/decl.h.

- a new header file cstd.h added, containing calls to C99
standard header files.

- hack.h, decl.h, and decl.c have been cleaned up and had code
moved so that things line up as follows:

     hack.h     defines values that are available to all
                NetHack source files, contains enums for use in all
                NetHack source files, and contains a number of
                struct definitions for use in all NetHack source files.
                It does not contain variable declarations or variable
                definitions.

     decl.h     contains the extern declarations for variables that
                are defined in decl.c. These variables are global and
                available to all NetHack source files. The location of
                the variables within decl.h was random, so give it some
                order for now.

     decl.c     contains the definition of the variables declared in
                decl.h, and initializes them where appropriate. The
                variable definitions are laid out in much the
                same order as their declarations in decl.h.

- wintty.h: There were some varying terminal-related prototypes in
system.h, and that was the only thing left that demanded that
system.h be included. Those have been replaced by an #include
<term.h> in include/wintty.h to get the more current (and hopefully
more correct) prototypes, rather than hardcoding them in NetHack
sources.

For edge-case platform compatiblity, there is no #include <term.h>
if the build defines NO_TERMCAP_HEADERS. In that case one set of
hardcoded prototypes is still used in include/wintty.h.

The added #include "term.h" is also bypassed for NO_TERMS builds (builds
that don't link to terminfo/termcap at all, but still present a tty
interface using platform or window-port specific functions to fulfill
the same role as that of terminfo/termcap).

- some scattered, unnecessary #include "integer.h" were removed from
various files, since that's always included in current NetHack-3.7
sources, either directly from config.h or indirectly from #include
"hack.h".

- system.h references removed.

- new cstd.h added; the #include "system.h" references in Makefiles
and project files (Xcode, visual studio), were replaced
with #include "cstd.h" references. A "make depends" is probably
warranted.

Also:

 - Use of <term.h>, which defines clear_screen() as a macro, conflicts
with an actual function with that name in win/tty/termcap.c. The most
straight-forward course of action was to rename the NetHack function,
and change the references to it, from clear_screen() to
term_clear_screen(), so that was done.
2023-04-05 11:49:09 -04:00
nhmall
ddca5650ea qt comment bit 2023-04-04 14:25:24 -04:00
PatR
2f997645f3 warning fix for !DUMPLOG 2023-04-04 09:30:14 -07:00
Pasi Kallinen
12dd5323c8 Tutorial: eating food
Also document the lua timers a bit more.
2023-04-04 13:04:39 +03:00
Pasi Kallinen
201ee8383e Improve m_search_item
Previously when monster was interested to pick up an item,
the code went through the whole object chain, so going through
all the items on the level. This caused problems with some games,
for example where the player created thousands of meatballs
in separate stacks.

Changed the code so it now looks at the map locations inside
the search radius, and the stacks in those map locations,
skipping locations as early as possible.
2023-04-03 21:03:20 +03:00
nhmall
f1ac29d42f fix build when SYSCF is not defined 2023-04-02 17:45:04 -04:00
Pasi Kallinen
48dccdb5cb Split config file line parsing into separate functions
This should have no difference in behavior, except on Amiga;
as it is no longer supported, I removed all the amiga-specific
config-line handling. If anyone steps forward to support
that platform in the future, it shouldn't be too hard to
add those back.
2023-04-02 11:11:03 +03:00
Pasi Kallinen
52f5f6b11a Juiblex level temperature 2023-04-01 17:48:03 +03:00
Pasi Kallinen
ba60bfac25 Themeroom: buried zombies
- add a themeroom with random buried zombifying corpses
- disturbing buried zombies makes them revive much faster
- lua des.object() now returns the object it created
2023-04-01 14:05:18 +03:00
copperwater
4542d14d23 Make "cookie-only" rumors explicit in rumors file
The prior behavior was an ugly kludge that treated rumors as
only-eligible-to-appear-from-fortune-cookies if they contained the
string "fortune" or "pity". This commit gets rid of that system and
introduces a system where each rumor can be specified as such by
prefixing it with "[cookie]".

In order to avoid changing existing behavior, I have applied the
[cookie] prefix to all the rumors which were affected under the old
rules. However, several rumors seem like they were misclassified under
the old rules, and I am in favor of changing them as follows:

Should be made cookie-only (they only really make sense in context of
eating a fortune cookie):
- "Ouch. I hate when that happens."
- "PLEASE ignore previous rumor."
- "Suddenly, the dungeon will collapse..."
- "Unfortunately, this message was left intentionally blank."

Should be made non-cookie-only (they make sense if they appear as
engravings, Oracle messages, or artifact whispers):
- "They say that a gypsy could tell your fortune for a price."
- "They say that fortune cookies are food for thought."
2023-04-01 10:13:01 +03:00
copperwater
4126eb3cbe Remove the manual 50% vertical swap of doors in Baalzebub level
This was added before level flipping, and its purpose effectively was to
randomize the interior secret door layout (and thus the entire level,
because the rest is vertically symmetric) by manually flipping it.
Now that the entire level can be flipped and produce this same effect,
this is no longer necessary.
2023-04-01 10:10:34 +03:00
copperwater
886394c9c7 Give a message when a monster is zapped with make invisible
Every other case I'm aware of where a visible monster that the hero can
see turns invisible has some associated message, but not when zapping it
with the wand of make invisible and lacking see invisible. This adds a
message "[monster] vanishes!" in this case, which is the same as the
most common message one gets for zapping a monster with teleportation,
by design to keep the wand's identity ambiguous.

Technically, prior to this commit, there was a leak of information if
one zapped a wand that made a monster disappear: the identity of the
want could be determined immediately by the presence or absence of a
vanishing message. Practically, though, it was easy to check if there
was a new invisible monster in the same spot or not.

Also, zapping teleportation at a monster and having it land somewhere
visible to the hero now has attention explicitly drawn to it with a
message (in prior versions it didn't, so it could potentially be a
different monster appearing by some other means), so I additionally made
the wand of teleportation automatically identify itself when the hero
sees the monster appear as a result of their zap.
2023-04-01 10:00:57 +03:00
PatR
82fc66da0e wands zapped by monsters
Reverse part of commit 4021a63bcf
"wand/spell/breath killer reason" so that wand of magic missile
zapped by a monster isn't ambiguous about who is responsible.
2023-03-31 10:59:48 -07:00
nhmall
9250d85eaa comment bit 2023-03-30 13:10:20 -04:00
Pasi Kallinen
dc12f4f86c Protection from shape changers via wizintrinsics
Setting protection from shape changers via wizintrinsics
caused a sanity error on the next turn, if any monsters affected
by it were in changed shaped on the level.

Call rescham after setting the timeout, so the monsters will
immediately revert to their own form.
2023-03-30 19:56:04 +03:00
nhmall
85feda8774 comment out WANT_ASAN=1 for now
encountered an error testing it on macOS
2023-03-29 22:09:19 -04:00
nhmall
d783afbda1 support WANT_ASAN=1 on make command line in linux.370 and macOS.370
When the address sanitizer is in use for gcc, clang, or visual studio,
(-fsanitize=address) define the NetHack preprocessor symbol USING_ADDRESS_SANITIZER.
2023-03-29 21:39:44 -04:00
PatR
cc2410e349 freeing objects and monsters
Making the zeroing out of memory used by an object that is about to
be freed unconditional, and do the same for monsters.  Should never
matter aside from an undetectable amount of extra overhead.
2023-03-29 15:18:25 -07:00
PatR
dad67436e6 fix #K3895 - 'o' at own spot during pass-walls
If standing at the location of a closed door while having Passes_walls
ability, attemping to open that door with 'o' reported "you don't find
anything here to loot".

Using 'o' to loot for direction ./>/< is intentional but it ignored
the possibility of there also being a closed door present.  When the
latter applies, only switch from open to loot for direction '>' so
that '.' (and '<') will open the door.  Doesn't matter for creatures
that can ooze under a closed door--trying to use 'o' gets rejected for
them because they lack hands.

Also allow hero in Passes_walls form to use 'c' when at open door spot.
(For creatures that ooze under doors, 'c' is rejected just like 'o'.)

Unrelated:  fix a typo in a recently added comment.
2023-03-29 13:48:42 -07:00
Pasi Kallinen
4194b01c17 Tutorial: run prefix 2023-03-28 20:30:53 +03:00
Pasi Kallinen
5c39096fd4 Prevent infinite loop making Medusa statues
While fuzzing, the game got stuck here trying to generate
a random stoneable monster for a Medusa level statue.
I didn't investigate deeper why it failed to find a matching
monster type.
2023-03-28 19:55:39 +03:00
PatR
0532eae7d2 feedback when escaping lava
Fix the duplicate feedback given when landing on one or more items
after teleporting out of lava.

This also avoids "you find yourself back on solid water" if you are
able to survive at a water location and safe_teleds() puts you on one.
2023-03-27 17:08:18 -07:00
nhmall
2855f71764 ceiling and surface relocations and adjustments
relocate surface(), ceiling(), and avoid_ceiling() to dungeon.c
adjacent to has_ceiling() etc.

astral and fire, like airlevel and waterlevel return FALSE
for has_ceiling()

if a caller does happen to call ceiling() on fire level,
return "flames above"

if a caller does happen to call ceiling() on quest level,
return a more-generic "expanse above", instead of the
word "ceiling"

add "stairs" return to surface()

remove recent update to engrave.c to special-case "stairs"
since surface() will return that now
2023-03-27 18:09:58 -04:00
PatR
f74628b9d1 shrieker summoning purple worm
Consolidate a couple of makemon() calls.  I thought that this would
end up being clearer but it isn't actually much of an improvement.
Should be no change in behavior.
2023-03-26 22:56:50 -07:00
nhmall
be3659d731 restrict where the engraving symbol shows up
rooms and corridor locations that have been seen
don't hide stairs
2023-03-26 17:32:54 -04:00
PatR
a3d8557ea6 pet->meating doesn't imply helplessness
The overly simplistic fix to prevent pets from picking up objects
while they were busy eating had unwanted side-effects, making them
seem to be paralyzed in some situations such as #chat.  Reverse the
recent change done in commit 754e9333f5
("fix pet picking something up while eating") and handle it in the
pet pick-up code instead.
2023-03-25 12:47:17 -07:00
nhmall
c70c9ec793 Guidebook datestamp to most recent Guidebook commit 2023-03-25 12:12:20 -04:00
nhmall
de64ae538c update tested versions of Visual Studio 2023-03-25 2023-03-25 11:38:36 -04:00
nhmall
106d6ec406 capitalization bit 2023-03-25 10:57:58 -04:00
nhmall
ddd6cfdf96 catch up on some fixes3-7-0.txt updates 2023-03-25 10:51:05 -04:00
PatR
aa821006de curses: message window border again
This is a better workaround for the missing message window border when
when restoring with align_status:left.  Unlike the previous hack, this
may even be the correct way to handle it in the first place.

I haven't tracked down when the problem started.
2023-03-25 00:57:28 -07:00
PatR
e0e9d1d8b2 curses: message window border w/ align_status:left
This fixes the missing message window border when restoring with
align_status:left (which narrows and forces that window to the right).
It can't possibly be the correct way to fix things but does work.

This was not a problem with 3.6.4 (the most recent pre-3.7 playground
I have on hand) but I don't have the energy to use 'git bisect' to
track done when it started to whether the cause is discernable.  The
message history is put into place without going through putstr() so
differs from normal message handling.
2023-03-24 17:51:21 -07:00
PatR
8a0484321e add flags.silent handling to X11_nhbell() 2023-03-24 14:23:30 -07:00
nhmall
07ba3904fd window-ports should respect flags.silent setting
Like tty_nhbell() in termcap.c, window-ports really should
respect the flags.silent setting.
2023-03-24 12:23:19 -04:00
nhmall
a136dbac06 comment update in win/curses/cursmisc.c 2023-03-24 11:54:47 -04:00