Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen b1fd7344e3 Poly into fire elemental, eat flammable items 2023-01-20 18:56:01 +02:00
Pasi Kallinen b998a368c7 Random sink effect: noxious gas cloud 2023-01-20 17:39:04 +02:00
Pasi Kallinen 93d7d79fca Fix mouse menu movement
When using mouse to move to a location next to the hero,
the test_move result was reversed, causing the click to fall
in to the travel case instead of normal movement.
2023-01-20 14:37:01 +02:00
Pasi Kallinen af1bd84766 Add hell_tweaks to Orcus' level 2023-01-20 14:08:34 +02:00
Pasi Kallinen 6e49372d8f Mindless monsters are not scared of music 2023-01-19 22:18:52 +02:00
Pasi Kallinen 242a7ba796 Boomerang hitting a sink is noisy 2023-01-19 19:59:19 +02:00
Pasi Kallinen e260aa5877 Digging is noisy 2023-01-19 19:55:47 +02:00
Pasi Kallinen 1113373892 Fix vibrating square
The Gehennom changes broke the vibrating square, allowing hero to go
down into the Sanctum via stairs without performing the invocation.

Fix this by making the hellfill lua check for invocation level, and
placing down the vibrating square trap, instead of stairs.
2023-01-19 12:15:46 +02:00
Pasi Kallinen bb8656c190 Move familiar level message into function 2023-01-18 23:33:21 +02:00
Pasi Kallinen 2511637169 Make plane of fire hot 2023-01-18 10:50:32 +02:00
Pasi Kallinen bb8c144809 Level temperature
Allow setting a per-level "temperature": hot, cold, or temperate
via special level flags. Currently it only affects some messages
in Gehennom, but it could be expanded to ice melting, water freezing,
or monster generation, for example.

Invalidates saves and bones.
2023-01-17 20:11:45 +02:00
Pasi Kallinen bd267c0c61 Add a cold, watery gehennom filler maze 2023-01-16 19:17:19 +02:00
Pasi Kallinen b5fe7415cf fixes entry 2023-01-16 10:45:23 +02:00
Pasi Kallinen 3ee54d1c4e Fix deleting worn object
When going down stairs while punished, if you had quivered a mirror
and the mirror was dropped because you fell down the stairs, it would
not have been unequiped.
2023-01-16 09:41:43 +02:00
Pasi Kallinen 6abb12aee0 Lua: Persistent variables
Add a way for the lua scripts to set and retrieve variables
that are persistent - saved and restored with the game.

Invalidates saves.
2023-01-15 10:34:45 +02:00
Pasi Kallinen eacb68666e Deadly afflictions and resistances for safe_wait
Amend the safe_wait so it still waits if you have a deadly property,
even if you have a resistance to it.

External resistances do not protect against already existing
deadly properties, for example becoming deadly ill is not cured
even if you wear a green dragon scale mail.
2023-01-12 23:19:28 +02:00
Pasi Kallinen 698ac27146 Avoid magic numbers in tile2bmp 2023-01-12 17:34:58 +02:00
Pasi Kallinen 9bf6d837ad More Gehennom filler level variance 2023-01-12 12:37:08 +02:00
Pasi Kallinen 4af086be73 More interesting Gehennom levels
Instead of just plain old boring mazes, spice up Gehennom by
occasionally adding lava, iron bars, or even mines-style levels
(with lava, of course).

Of the fixed Gehennom levels, only Asmodeus' lair has been changed
to add some random lava pools.

Also some lua fixes and changes:
- Fixed a selection negation bounding box being wrong.
- Fixed a selection negated and ORed returning wrong results.
- des.map now returns a selection of the map grids it touched.
- When using des.map contents-function the commands following the
  map are not relative to it.
2023-01-10 12:20:21 +02:00
Pasi Kallinen 48ae4f6d30 Another valgrind uninitialized bytes complaint 2023-01-07 17:28:14 +02:00
Pasi Kallinen 8eb3b3d8d1 Silence valgrind uninitialized bytes complaints
Just zero out the allocated memory.

Explicitly setting struct field values isn't enough, because field alignment
means there can be several unused bytes which are written to savefile.
2023-01-07 13:25:07 +02:00
Pasi Kallinen c68b21d735 Fix lua selection logical-or bounds 2023-01-07 10:55:09 +02:00
Pasi Kallinen 27e2c79e12 Free command queues at end of game
At end of game, the disclose prompts put commands into the queue,
but those weren't freed.
2023-01-06 16:40:58 +02:00
Pasi Kallinen 030fc0036a Remove NO_VSNPRINTF
Affects only ancient VMS where vsnprintf wasn't available.
2023-01-06 15:53:06 +02:00
Pasi Kallinen 37f6eee147 Add themeroom filler "Storeroom"
Contains mostly mimics (pretending to be chests), and possibly some chests.
2022-12-22 21:47:13 +02:00
Pasi Kallinen 5e47afed4f Typofix 2022-12-19 18:20:31 +02:00
Pasi Kallinen 32bbf84ee1 Add strangled to safe_wait
... and ignore vomiting from sickness.
2022-12-18 12:36:34 +02:00
Pasi Kallinen d7e90fbae2 Expand safe_wait to deadly status afflictions
Searching or waiting with safe_wait on will now consider
sliming, stoning, or deadly illness to be hazardous and prevent
the command.
2022-12-18 00:40:38 +02:00
Pasi Kallinen 85137bb76a Fix skipping attacks if hero moved away
Recent change by me caused a bug where a monster was trying
to attack after hero was moved away by the previous attacks.
2022-12-07 21:51:50 +02:00
Pasi Kallinen 81fb185cea Recalc mon-hits-you distance variables
When a monster could first knock you back and then grab you,
the game would emit impossible, because the knockback moved you
but the distance variables used for the grab attack were not
updated.

Update the range variables within the loop iterating through
the monster attacks.
2022-12-01 19:57:24 +02:00
Pasi Kallinen 47c194fd56 Avoid segfault when null obj passed to water_damage 2022-12-01 13:29:52 +02:00
Pasi Kallinen 60252cd28b Remove leftover debug pline 2022-10-07 11:44:03 +03:00
Pasi Kallinen ef093d0b30 Fix curses cursor keys
My change to allow fuzzer run in curses caused the cursor keys
to not work (eg. paging through menus with left and right cursor),
so fix that.
2022-09-24 10:40:38 +03:00
Pasi Kallinen fbb32ea7fa Curses: enable debug fuzzer 2022-09-22 13:10:19 +03:00
Pasi Kallinen ccaadaa00e Prevent trapdoors and holes dropping you into Sanctum 2022-09-20 12:07:37 +03:00
Pasi Kallinen 2368c59f69 Knockback requires solid physical hit
Exclude unsolid monsters - air, water, and fire elementals.
2022-09-18 17:56:04 +03:00
Pasi Kallinen bb3dc379bc Themerooms: Engraving hints the location of buried treasure
Add two new themeroom functions that are called when generating
the level: pre_themerooms_generate and post_themerooms_generate,
calles before and after themerooms_generate.

Allow the buried treasure -themeroom to put down an engraving
anywhere on the level, hinting at the location of the treasure.

des.object contents function now gets the generated object passed
to it as a parameter.
2022-09-18 12:45:16 +03:00
Pasi Kallinen d4c28b3ab5 Prevent impossible lighting a massive stack of candles 2022-09-16 19:55:49 +03:00
Pasi Kallinen 48bd67a25f Fix CI warning 2022-09-15 18:55:15 +03:00
Pasi Kallinen 3605f18a8e Split themeroom shape from themeroom contents
Previously, the tetris-shaped rooms were always either
normal rooms, or turned into shops or other special rooms
in NetHack core. Now, the themed room lua code first picks
the themed room (which can be a themed or shaped), and some
of those will then pick a random filling (eg. ice floor,
traps, corpses, 3 altars).

Adds a new lua binding to create a selection picking locations
in current room.

The content-function in special level regions now get passed
the room data as a parameter.
2022-09-15 18:09:40 +03:00
Pasi Kallinen 99e45e6daa Allow suppressing debugfuzzer warnings 2022-09-13 13:41:27 +03:00
Pasi Kallinen d7abdb96c4 More damageum return values 2022-09-11 21:52:46 +03:00
Pasi Kallinen a3ba958728 Use define in damageum return value check 2022-09-11 21:30:54 +03: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
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
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
Pasi Kallinen e818395a55 Add tipping a container to herecmdmenu 2022-09-05 23:27:58 +03:00
Pasi Kallinen f58f43bd78 Cannot kick while squeezed on top of a boulder 2022-09-05 11:21:19 +03:00
Pasi Kallinen 601dba5279 Make glorkums emit impossible 2022-09-04 17:43:06 +03: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
Pasi Kallinen c447d091b1 Fixes entry 2022-09-01 17:09:26 +03:00
Pasi Kallinen a9c91d5744 fixes entry 2022-08-28 18:48:01 +03:00
Pasi Kallinen 1acd8fd549 Fix migrating monster throwing a potion
When a monster did something trying to get out of a boulder fort,
it usually meant teleporting or going down stairs or a hole.
The code didn't check for the action return value, and resulted
in a migrating monster being able to throw a potion at hero.
2022-08-28 18:29:21 +03:00
Pasi Kallinen b4c45a4b8e Fix hang when getting an input prompt
When you were busy with an occupation, such as digging with
a pickaxe, and a prompt showed up to ask you enter something,
the game just hung with infinite loop.

Remove the occupation check returning a NUL from the input
function. I didn't notice any side effects, but I would not
be surprised if something comes up ...

I didn't investigate which commit caused this, but I suspect my
rhack or parse changes.
2022-08-28 14:09:09 +03:00
Pasi Kallinen 723ee6d1f6 Expose selection bounds to lua 2022-08-26 13:07:52 +03:00
Pasi Kallinen 5e9ed7a290 Some selection optimizations
- Add bounds, so that we don't process any locations outside
  as those locations are known to be unset
- The bounds are only recalculated if needed
- Replace instances of selection_not where we actually want
  a new selection with all locations set
2022-08-26 12:43:40 +03:00
Pasi Kallinen 36f2dedeb6 Adjust couple therecmdmenu entries
- Don't show attacking a peaceful or tame monster, as
  that is actually swapping places with them - so add that.

- Don't show naming a hostile monster - it's usually not
  wanted, and this way when clicking a hostile monster, the
  only entry is the attack, so will be executed automatically.
  This makes it much more usable.
2022-08-25 18:10:50 +03:00
Pasi Kallinen 51ac21bc88 Make mouse clicklook report only the specific tile
Previously the mouse clicklook mentioned every tile that matched
the character symbol, leading to overload of information and
if playing with tiles, it was mostly useless. Also the most
important bit - the tile info - was last in the text.

Now mouse clicklook only reports the exact tile information
that was clicked on.
2022-08-25 17:17:42 +03:00
Pasi Kallinen 2da4d92751 Fix room array overflowing into subrooms
If the map is big enough so that makerooms generates the maximum
allowed number of rooms for the level, the last room will "overflow"
into the subrooms array.

The rooms array assumes the last entry has hx = -1, and add_room
changes the next room hx to -1 but because the subrooms array
is right after the rooms array, this change actually touches
the first subroom on the level.

This has been present since who knows how long, but because
the levels are normally small enough, the room limit is never hit.
2022-08-24 21:30:46 +03:00
Pasi Kallinen 48db75fabc Add some hallu monsters 2022-08-24 18:40:27 +03:00
Pasi Kallinen 7c8ccb8ccd Prevent getpos queueing mouse commands
My change to allow binding the mouse buttons made getpos
push the mouse commands into a command queue, so when you
were asked for a map location, clicked on it with a mouse,
you'd first get the expected effect, and then (most likely)
immediately traveled there.

Change getpos to clear the commands bound to the mouse buttons,
and restore the binds afterwards.
2022-08-24 14:21:27 +03:00
Pasi Kallinen 282b2a7bbe Make explosions give feedback message
... even when the explosion doesn't hit anything.
2022-08-24 13:26:44 +03:00
Pasi Kallinen 6766943455 Add boulder pushing to therecmdmenu 2022-08-24 12:53:04 +03:00
Pasi Kallinen edae8273b9 Explicitly list the random breath types 2022-08-24 10:29:59 +03:00
Pasi Kallinen 50b91bdcfa Make sink symbol match fountain in IBMgraphics 2022-08-23 23:36:41 +03:00
Pasi Kallinen c42e73fd9c Allow binding mouse buttons
Instead of hardcoding mouse button actions, allow the user to
bind mouse buttons to extended commands.  For example the new
defaults are:

BIND=mouse1:therecmdmenu
BIND=mouse2:clicklook

Currently a bit rudimentary; the defaults should be OK, but
documentation is bit lacking, and in-game binding and option
saving are missing.

Allowed commands to bind are "nothing", "therecmdmenu", "clicklook",
and "mouseaction". Clicklook replaces the "clicklook" boolean option,
and mouseaction does what mouse 1 button used to do - a context sensitive
action.
2022-08-23 23:27:21 +03:00
Pasi Kallinen 3a255e86c4 Some lua selection userdata code cleanup 2022-08-23 17:34:29 +03:00
Pasi Kallinen d39b2f3a23 Remove extra definitions 2022-08-23 16:52:05 +03:00
Pasi Kallinen 4cfefb056a Clear or copy whole selectionvar 2022-08-23 14:39:39 +03:00
Pasi Kallinen 4a84fb5b9d Monsters can blind you with a camera 2022-08-22 13:32:12 +03:00
Pasi Kallinen a9ca23e8f9 Random figurines are of harder monsters 2022-08-21 13:23:16 +03:00
Pasi Kallinen 2b163d89b0 Rename command to #debugfuzzer, add some z and doc 2022-08-21 12:10:08 +03:00
Pasi Kallinen fcf5c1ea50 Monsters see and remember when others trigger traps
No longer will there be a conga line of hill orcs stepping into
the same arrow trap one after another.
2022-08-21 11:51:19 +03:00
Pasi Kallinen 953d43f5ac Monster known traps bit twiddling 2022-08-21 11:36:39 +03:00
Pasi Kallinen b0f3371147 Monsters try to escape from boulder forts
If a monster cannot move, for example because it's being
blocked off by boulders or walls, it will try to escape by some
method - such as a wand or scroll of teleportation.
2022-08-20 21:49:55 +03:00
Pasi Kallinen 54bff58598 Make #wizgenesis ignore debug_mongen blocking
Explicitly creating monsters in wizard-mode should go through
and not get blocked by the debug_mongen flag.
2022-08-20 21:45:26 +03:00
Pasi Kallinen 7ab1ac0a19 Split soldier-finding into separate function 2022-08-20 19:33:53 +03:00
Pasi Kallinen caaa527d45 Fix some #saveoptions issues
The #name default key was 'N', but that gets bound to #runsoutheast
when not using number_pad. Swap around the default #name key to M-n,
and bind the 'N' to it in commands_init instead.

The number_pad option wasn't getting saved because it has a separate
handler - mark the option as changed even if the value did not change
so it will be saved to the config.
2022-08-20 17:09:23 +03:00
Pasi Kallinen 535eb9327a Fix the corpse taste adjectives
Use proper grammar, and just go with randomized, not fixed by corpse type.
2022-08-20 16:35:31 +03:00
Pasi Kallinen ac5aadf0e3 Add #fuzzer wiz-mode command
Move the debug_fuzzer boolean out of the full options menu
and turn it into #fuzzer extended command
2022-08-20 08:34:52 +03:00
Pasi Kallinen c05a6f3199 Expose some debug flags in options
Show and allow changing the debugging flags in options:

debug_fuzzer: turn on the fuzzer
debug_hunger: prevent hunger
debug_mongen: prevent monster generation
debug_overwrite_stairs: allow level generation overwrite stairs

These are wizard-mode only, cannot be set via config file,
and the fuzzer cannot change these either.
2022-08-17 20:17:30 +03:00
Pasi Kallinen 1900a30323 Return early from mon_has_friends 2022-08-16 14:49:25 +03:00
Pasi Kallinen d7d4ed3dfe Monsters using wands of teleportation more
Previously monsters used wands of teleportation at hero, if hero was
standing on top of stairs, or on a scary thing (eg. Elbereth or
scroll of scare monster).

Allow monsters to recognize when hero is behind a chokepoint and
monster has friends with them, hopefully teleporting the hero
out of the chokepoint.
2022-08-16 12:17:58 +03:00
Pasi Kallinen d0b11fd2c0 Change poison instakill to damage with attrib and maxhp loss 2022-08-15 10:51:17 +03:00
Pasi Kallinen f156b0f660 Turn statushilites on automatically if any are defined 2022-08-14 22:32:09 +03:00
Pasi Kallinen 9be2e581b7 Macros for checking is object artifact 2022-08-12 19:37:34 +03:00
Pasi Kallinen fc3729d249 Better feedback for monster falling into a hole
... or a trap door. The trap is immediately identified anyway,
so just name the trap in the message.
2022-08-12 18:17:31 +03:00
Pasi Kallinen 1a5cd08b32 Turn on menucolors automatically if any are defined 2022-08-12 17:34:21 +03:00
Pasi Kallinen d062f4c4d8 Fix repeating untrapping
... or any that use getdir to ask direction.
2022-08-12 12:02:52 +03:00
Pasi Kallinen db1ef8172e Fix Windows compilation 2022-08-11 17:07:43 +03:00
Pasi Kallinen 1952050fae Remove comment 2022-08-11 08:46:20 +03:00
Pasi Kallinen 649fc7f9b3 Monsters "remember" noteleport levels
... using the same hack when zapping themselves: If the level is
no-teleport, the monster will learn of teleport traps, and if
it knows about them, won't try using teleportation again.
2022-08-11 08:43:40 +03:00
Pasi Kallinen c855b04a57 Fixes entries 2022-08-11 08:28:15 +03:00
Pasi Kallinen 121d79ab6b Random item artifact chances
The chance that randomly generated item is an artifact will
now depend on the number of already existing artifacts.
2022-08-10 18:18:18 +03:00
Pasi Kallinen d91915dba3 Migration-safe monster movement iteration
The monster knockback could mess with the monster linked list while
the code was going through it for monster movements. (For example,
a monster knocked back another into a level teleport trap)

Add iter_mons_safe, which first grabs all the monster pointers in
the list into an array, and goes over that array instead of relying
on the "next monster" pointer. This is possible because dead monsters
are not removed from the linked list until after all the monsters
have moved.

Testing is very minimal, and I'm not sure the vault guard check
for migration is correct - it should probably check for more states?

Also the iterator could be improved by not continually allocating
and freeing the monster pointer array.
2022-08-10 11:04:04 +03:00
Pasi Kallinen fd9745f9c6 Command repeating by using cmd queues
This replaces the old pushq/saveq arrays (which were used to save
the keys pressed by the user for repeating a previous command)
with a new command queue.  This means there's no hard-coded limit
to the saved keys, and it can repeat extended commands which are
not bound to any key.
2022-08-09 11:54:45 +03:00
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
Pasi Kallinen 3eb2192d75 Make pyrolisk gaze effect match other fire effects 2022-08-06 10:46:27 +03:00
Pasi Kallinen 0a3d02b9d4 Pyrolisk stops gazing if it sees you resist 2022-08-06 10:45:11 +03:00