Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 2e144e814d Change repeat into extended command 2022-01-17 17:13:59 +02:00
Pasi Kallinen 89cfea0085 Fix up/down movement
I broke these in the recent commit changing the movement commands.
2022-01-16 21:46:46 +02:00
Pasi Kallinen e7fa065203 Change special keys into extended commands
Changes most of the special keys used in the main input loop
into extended commands:

- movement keys are now bound to extended commands, eg.
  #movewest and so on.

- m-prefix is now #reqmenu extended command, still bound to
  the 'm' key.

- run, rush, and fight are now extended commands, still bound
  to the same keys as previously.

- nopickup and runnopickup keys are removed.
  Nopickup was using 'm' key, the same as the m-prefix, so
  allow #reqmenu to modify movement commands to disable pickup.

- multiple prefix commands are allowed. This lets user to
  use #reqmenu, followed by #run, followed by movement to simulate
  runnopickup behaviour. (If necessary, adding runnopickup back
  as an extended command would be easy)
2022-01-16 14:48:24 +02:00
Pasi Kallinen 1f2d16082e Fix shopkeeper Kop summons causing segfault
... if it happened on a level with no downstairs, such as the tourist quest.
2022-01-11 22:55:43 +02:00
Pasi Kallinen e36145082a More "user canceled" extended command return values 2022-01-10 17:37:48 +02:00
Pasi Kallinen 6ffcdac45f Use visctrl like in other places 2022-01-09 19:27:47 +02:00
Pasi Kallinen a990eae8ec perm_invent update when applying a bag of tricks 2022-01-09 16:40:35 +02:00
Pasi Kallinen 68b822e4dc Add "user canceled" as extended command return value
Instead of returning ECMD_OK, the commands now return ECMD_CANCEL
when user declined to pick a direction or an object to act on.

Note that this can be ORed with ECMD_TIME, if the command still
took a turn.

For now this has no gameplay meaning.
2022-01-08 20:04:57 +02:00
Pasi Kallinen bcccfaaeac Remove useless variable 2022-01-08 19:15:02 +02:00
Pasi Kallinen 9176589b59 tty: document the termcap codes
some of the termcap codes were missing document comments.
2022-01-07 17:41:39 +02:00
Pasi Kallinen 4133b6a2b0 Fix a brain fart when ORing MM_NOMSG 2022-01-07 07:24:21 +02:00
Pasi Kallinen a77e1602f1 Apply a wielded bullwhip with fire-command 2022-01-06 17:12:30 +02:00
Pasi Kallinen 5b02ad521d Don't autoquiver aklys
... even though it is a throwing weapon, it's meant to be wielded
and fired instead of fired from quiver.
2022-01-06 14:39:32 +02:00
Pasi Kallinen c300f9f084 Fixes entry 2022-01-06 14:34:33 +02:00
Pasi Kallinen 48bca11d67 Accessibility: give message for created monsters
Always give a message when creating a detected monster
during gameplay (as opposed to during level creation).
To prevent the message, use the MM_NOMSG flag for makemon.

Most places already handled their own messaging, but there
were some, such as bag of tricks, create monster magic
and random monsters created during gameplay that didn't.
2022-01-06 14:06:49 +02:00
Pasi Kallinen 66368d7ea2 Add missing article 2022-01-05 18:00:28 +02:00
Pasi Kallinen e5ee580961 Allocate rects dynamically
... instead of hard-coding them to 50. New allocated value is
(COLNO*ROWNO)/30, which is slightly higher (56), and that formula
seems to work for hypothetical larger maps too.
2022-01-05 17:35:33 +02:00
Pasi Kallinen 7238622621 Fix segfault in hypothetical case of huge COLNO 2022-01-05 13:51:44 +02:00
Pasi Kallinen 84af696627 Fix X11 tombstone string overflow 2022-01-04 22:28:16 +02:00
Pasi Kallinen 07451ca32c Update lua api docs 2022-01-04 21:29:06 +02:00
Pasi Kallinen f065cf01c1 Mark extended commands accepting m-prefix in the command flags 2022-01-04 19:29:18 +02:00
Pasi Kallinen c54c857372 Reuse code to limit look region 2022-01-04 13:10:33 +02:00
Pasi Kallinen 711a12afc3 Add a false rumor 2022-01-04 11:14:12 +02:00
Pasi Kallinen 03b55a6fa0 Make the adventurer ghost asleep 2022-01-04 10:55:09 +02:00
Pasi Kallinen dbd1f7a33b Improve wizmode-only command unavailability reporting 2022-01-03 18:06:11 +02:00
Pasi Kallinen 76381815f3 Add theme room: Ghost of an Adventurer 2022-01-02 19:51:32 +02:00
Pasi Kallinen f405d3bfbc Add few hallu colors 2022-01-02 15:10:32 +02:00
Pasi Kallinen 3e620e06eb Define extra sanity checks if not a release 2022-01-02 01:14:16 +02:00
Pasi Kallinen 1cc31f3cba Init variable just in case 2022-01-01 16:58:34 +02:00
Pasi Kallinen 0f132470c7 Allow tipping container directly into another 2022-01-01 16:15:29 +02:00
Pasi Kallinen 8db18275a6 Define engulfing_u, making clearer code 2021-12-31 21:12:21 +02:00
Pasi Kallinen 2591a21cf0 Leprechauns bury their gold after teleporting 2021-12-31 18:48:44 +02:00
Pasi Kallinen d53cd28d46 Make extended commands return defined flags
Instead of returning 0 or 1, we'll now use ECMD_OK or ECMD_TURN.
These have the same meaning as the hardcoded numbers; ECMD_TURN
means the command uses a turn.

In future, could add eg. a flag denoting "user cancelled command"
or "command failed", and should clear eg. the cmdq.

Mostly this was simply replacing return values with the defines
in the extended commands, so hopefully I didn't break anything.
2021-12-30 19:16:33 +02:00
Pasi Kallinen fa41d5fe66 Apply a wielded polearm with fire-command
Wield a polearm and use 'f'ire to automatically hit with it,
if there's a single valid target.
With fireassist-option, will swapweapon to a polearm.
This only applies if quiver is empty and autoquiver is off.
2021-12-29 19:40:26 +02:00
Pasi Kallinen ea0c488178 Split leprechaun avoidance into separate function 2021-12-28 19:11:30 +02:00
Pasi Kallinen 4b525374d0 Make vrocks emit a poison cloud when they flee 2021-12-25 10:51:20 +02:00
Pasi Kallinen b1ed92abad Apply runmode to multiturn actions 2021-12-21 17:37:48 +02:00
Pasi Kallinen 8f366c725e Minor linewrap and comment fix 2021-12-21 16:25:21 +02:00
Pasi Kallinen 54bba21dd9 Give message for genod shifter changing shape
For accessibility, give a message when a monster changes shape
due to the previous shape being genocided.
2021-12-21 13:10:07 +02:00
Pasi Kallinen 81a7157d7d Vampire in a genocided shape
When you genocided a monster a vampire was shapeshifted into,
the vampire might've stayed in the genocided form.
Always revert back to vampire form if we tried to pick a genocided form.
2021-12-21 11:18:48 +02:00
Pasi Kallinen ef1eeed755 Give dragon armor extra effects
Dragon scales and dragon scale mails will provide some extra effects
when worn:

 - blue:   very fast speed
 - black:  level-drain resistance
 - green:  sickness resistance
 - gold:   hallucination resistance
 - orange: free action
 - red:    infravision
 - white:  slow digestion
 - yellow: stoning resistance

gray and silver don't have extra effects - those two are already the
best ones, so don't need any.
2021-12-20 23:30:27 +02:00
Pasi Kallinen e251bb6a82 Decouple mon state adjustment from find_roll_to_hit
If you have a function named like that, and it goes and
changes the monster state, that's just wrong.

Move waking up the monster from the hit into separate function.
2021-12-15 22:11:22 +02:00
Pasi Kallinen f6b7be49f4 Accessibility: give a message when teleporting a monster
Teleporting a monster only updated the map. Give a message
so blind players can get the same information.
Making a monster invisible gives the same message, if you
cannot detect invisible.
Several other places where monsters teleported themselves
now also give the same message.
2021-12-12 16:50:49 +02:00
Pasi Kallinen 176d5b8463 Bones piles can be ransacked by adjacent monsters
If a bones file is created, any object-liking monster next to
where hero died has a chance of grabbing objects from hero's
inventory.

This comes from xNetHack by copperwater <aosdict@gmail.com>.
2021-09-19 21:20:32 +03:00
Pasi Kallinen 5d3e237ffc Izchak occasionally stocks wands/scrolls/spellbooks of light
This comes from xNetHack by copperwater <aosdict@gmail.com>
2021-09-19 20:52:19 +03:00
Pasi Kallinen b23ff20c6a Gas clouds expand around terrain rather than being rhomboid
The gas will expand from its chosen center point via breadth-first
search instead of hardcoding a diagonal shape. The search is performed
with a randomized list of directions, and has 50% chance of not spreading
to a space it otherwise would have spread to. This has the effect of fuzzing
the cloud edges in open areas, helping the clouds on, for instance,
the Plane of Fire not be big rhombuses.

Also some other code refactoring related to stinking clouds in read.c

This comes from xNetHack by copperwater <aosdict@gmail.com>
2021-09-19 13:57:47 +03:00
Pasi Kallinen 12800bf84b Walking near buried zombifying corpses wakes them up
Moving without stealth will reduce the zombifying timeout
of buried corpses under and around hero's location.
2021-09-18 21:24:52 +03:00
Pasi Kallinen 2dce29e965 Move Pw regen into separate routine 2021-09-18 20:23:20 +03:00
Pasi Kallinen b30061b5ad Allow dropping just picked up items
When using a menu to drop or put in items into a container,
allow putting in the item (or items) you picked up previously,
by selecting the 'P' entry from the item class menu

Inspired by the itemcat patch by Stanislav Traykov.

Invalidates saves and bones.
2021-09-17 21:00:06 +03:00
Pasi Kallinen 408aa4b3cb remove sp_lev execute bits 2021-09-12 22:34:19 +03:00
Pasi Kallinen e3a2dd7f40 Reveal the monster your strike moved
When you hit a small hidden monster (by eg. force-fighting)
that got moved by the strike, the monster stayed hidden, possibly
causing a sanity checking error.

Reveal the monster before hurtling it.
2021-09-12 19:44:39 +03:00
Pasi Kallinen e7e7bca2a3 fixes entry 2021-09-06 21:02:48 +03:00
Pasi Kallinen 9942b65df7 Resistances gained from worn or wielded items also protect inventory 2021-09-06 20:24:44 +03:00
Pasi Kallinen e813cf5b05 Move sanity checking to start of main loop
... just after clearing the object bypasses, as some
of the monster movement code may use object bypass flags.
2021-09-05 10:14:16 +03:00
Pasi Kallinen e61d149171 Fix eel hiding in dry land
When an eel was hiding in a pool and a rolling boulder trap
launched a boulder on top of the pool, and the boulder then
filled the pool, the eel ended up hiding on the dry land.

As a stopgap measure, kill off any monster that is in the
pool location when the boulder hits the pool. This should
probably be expanded to handle flying monsters differently.
2021-09-03 13:27:40 +03:00
Pasi Kallinen c0dc72b3d2 Test for replace_terrain coordinates 2021-09-03 08:27:17 +03:00
Pasi Kallinen cf44cb3382 Handle buried zombifying corpses
When a zombifying corpse is buried, allow it to zombify and
dig itself out of the ground.

Also allow wishing for zombifying corpses.
2021-09-02 20:54:36 +03:00
Pasi Kallinen b76a213caf Fixes entry 2021-08-28 17:07:56 +03:00
Pasi Kallinen 2aaee76c5c Fix ball bypass sanity complaint
Be punished, get swallowed, drop the ball inside the monster
via the 'D' drop, kill the swallower - this issued a sanity
check complaint about the ball bypass flag.

In this case, the ball was "floating", not on any object chain,
when dropped inside the monster, so clear_bypasses didn't
clear the flag.
2021-08-26 18:46:25 +03:00
Pasi Kallinen 2f94ad489f Reindent main loop
No code change, just reindenting the main loop, as it wasn't
reindented when the inner part was split into separate function.
2021-08-26 14:19:39 +03:00
Pasi Kallinen 70b953db44 Clear bypasses at beginning of main loop
Object bypass flag is used to check if an object was already
handled in an iteration loop, in cases where the linked list order
may change during iteration. The flags should never stay set
past a turn, if any were used.

Reset the bypass flags at the beginning of the main loop, without
checking g.context.move -flag; that flag gets reset if hero lifesaved.
2021-08-26 14:12:00 +03:00
Pasi Kallinen a1b927a278 Use enum value, not hardcoded number 2021-08-24 11:34:28 +03:00
Pasi Kallinen 6dc99f69b7 Prevent impossible trying to find a door position
When random dungeon level generation looks for room walls
to place doors at (for joining corridors or creating niches),
it complained about impossible, if the shaped theme room
doesn't have a valid place for a door.

Make the position routine return FALSE and let the
caller deal with it...

Observed this with the small circular themeroom which had
all 4 valid positions already joined with corridors, and
the niche function tried to add a niche to the room.
2021-08-22 18:44:20 +03:00
Pasi Kallinen 67b485601a sanity checking: bypassed billed object destroyed 2021-08-21 18:50:13 +03:00
Pasi Kallinen f43bfc3f71 Lua: diagonals for selection floodfill 2021-08-15 13:50:28 +03:00
Pasi Kallinen 98ec66e00c Qt: deprecation warnings, again
Check Qt version for the QFontMetrics::width vs horizontalAdvance.
Of course can't just #define horizontalAdvance to width, that would
be too easy ...
2021-08-15 10:58:42 +03:00
Pasi Kallinen 6554500593 Qt: Fix Qt5 deprecation warnings
Mostly the warnings were about QString::sprintf and QFontMetrics::width.
sprintf replacement is asprintf, which annoyingly behaves differently
from sprintf - it seems to append to the string.

Not thoroughly tested, but seems to work.
2021-08-14 21:08:12 +03:00
Pasi Kallinen 0bf4bea6ec Fix eels hiding when a pool boiled off
Sanity check caught an eel hiding on floor; this was caused by
an exploding flaming sphere boiling off the pool the eel was
hiding in. The freezing water case was already handled, so
add the same, rather lackluster handling, to the fire case.
2021-08-14 13:43:04 +03:00
Pasi Kallinen 2748ac746e lookaround comments
trying to figure this out
2021-08-12 19:38:29 +03:00
Pasi Kallinen 7a9dd64cb5 Use mon_visible 2021-08-09 19:16:36 +03:00
Pasi Kallinen 1c401960aa Move movement tests
Rushing will go along a snaking corridor.
2021-08-09 16:13:12 +03:00
Pasi Kallinen f5b617eaca More movement tests
Rush behaves different in ROOM vs CORR; in corridors, it'll
turn 90 degrees, but will not go in the opposite direction
from when it started.
2021-08-08 19:30:59 +03:00
Pasi Kallinen c9d075910e Slightly better stone tile
Replacing the placeholder stone tile with something that has
similar color scheme to the dungeon walls.
2021-08-04 13:58:54 +03:00
Pasi Kallinen de73a32d7d Implement wishing for walls in wizmode 2021-07-30 20:52:46 +03:00
Pasi Kallinen d463a9e258 Reveal branch stairs only after traversing them 2021-07-30 19:40:54 +03:00
Pasi Kallinen 4f594659dc More movement tests 2021-07-30 18:40:57 +03:00
Pasi Kallinen 78854aeda6 More movement tests 2021-07-30 18:09:28 +03:00
Pasi Kallinen b080ea12c2 Debug flag allowing overwriting stairs
And using it in the movement tests, so running doesn't stop
at stairs.
2021-07-30 16:35:36 +03:00
Pasi Kallinen 5580cd6286 Remove unused params 2021-07-30 15:35:00 +03:00
Pasi Kallinen c0c617c413 Try fixing interrupted travel oddities
My earlier commit (433f0cc) changed traveling, and caused some
strange problems when travel was interrupted. This seems to
fix those problems.
2021-07-29 21:21:28 +03:00
Pasi Kallinen 4007640882 Allow meta-keys in getloc
Fix altmeta again, to (re)allow meta-keys in getloc, for example
fast-moving the cursor with altmeta and number_pad.
2021-07-29 14:43:46 +03:00
Pasi Kallinen 7bfbe0fba9 Lua: Allow setting debug_flags 2021-07-29 07:36:08 +03:00
Pasi Kallinen 19599fa751 Add more movement tests 2021-07-28 20:47:12 +03:00
Pasi Kallinen 65b320de39 Start of movement tests
Adds the following lua functions:

- nh.pushkey("x")
    Pushes a key into the command queue. Support is spotty,
    currently only the keys handled in rhack.
- nh.doturn()
    Runs one turn of main loop, or if optional boolean param
    is true, until g.multi == 0
- nh.monster_generation(false)
    Disable monster generation, and kill off all monsters.

Adds a testmove.lua script to test hero movement. Currently
covers only hjklyubn and HJKLYUBN.
2021-07-28 19:19:40 +03:00
Pasi Kallinen b16c3732cb Add branch stairs to symbols 2021-07-28 07:57:16 +03:00
Pasi Kallinen 2775a07e5b Explicitly set the altlabels array size
This will allow the compiler to complain after you add new glyphs.
2021-07-28 07:45:25 +03:00
Pasi Kallinen d332720336 Increment editlevel
Added the new branch stairs glyphs, forgot to increment editlevel.
2021-07-27 18:56:50 +03: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
Pasi Kallinen 141a7915d6 Bugle playing should not scare some monsters
Make awaken_soldiers match awaken_monsters in what monsters
it can scare.
2021-07-26 21:40:23 +03:00
Pasi Kallinen 83c2eb5645 Add more shop tests 2021-07-25 22:52:42 +03:00
Pasi Kallinen c88bdb0a32 Hide internal commands from key list 2021-07-25 11:57:09 +03:00
Pasi Kallinen 120a8c0173 Add shop creation test script 2021-07-24 20:29:15 +03:00
Pasi Kallinen e2c6cbe347 Fix missing Izchak shop
My recent commit broke Izchak's shop in minetn-6.
Fix it as per the suggestion from entrez.
Fixes #555
2021-07-24 20:18:44 +03:00
Pasi Kallinen 7f39d53ad3 Lua: improve level testing
Add des.finalize_level() used for testing in conjunction with
des.reset_level().
Add nhc.DLB to return 0 or 1 if DLB was defined at compile-time.
Change the test_lev.lua to give more informative messages instead of
just lua error when required file doesn't exist.
Add bigrm-11 to the level tests.
2021-07-24 10:49:06 +03:00
Pasi Kallinen 93b66ff8da Prevent segfault on nonexistent mapseen
Cannot happen on normal play, but with some lua trickery ...
2021-07-23 21:09:39 +03:00
Pasi Kallinen f07829045a Prevent impossible with secret doors in sokoban
Doesn't currently happen as no Soko levels use secret doors,
but handle them anyway gracefully.

Secret doors have their doormask set, but it's overloaded wall_info.
The display routines aren't happy with D_CLOSED in wall_info.
2021-07-23 20:58:45 +03:00
Pasi Kallinen 043cd7e108 Lua: lit="random" is not allowed anymore
Random is the default lit state, so leave it out.
2021-07-22 19:38:04 +03:00
Pasi Kallinen dbac44596e Lua: Allow boolean params in level_init 2021-07-22 18:02:58 +03:00
Pasi Kallinen b566bbda38 Split calculating your movement speed out of moveloop 2021-07-22 12:28:15 +03:00
Pasi Kallinen 5cf0bb1de9 Split moveloop into preamble and core 2021-07-22 12:01:26 +03:00