Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 1e90f89203 Chronicle of major events, and livelog
Log game events, such as entering a new dungeon level, breaking
a conduct, or killing a unique monster, in a new "Major events"
chronicle. The entries record the turn when the event happened.
The log can be viewed with #chronicle -command, and the entries
also show up in the end-of-game dump, if that is available.

This feature is on by default, but can be disabled by
defining NO_CHRONICLE compile-time option.

This also contains "live logging", writing the events as they
happen into a single livelog-file. This is mostly useful for
public servers. The livelog is off by default, and must be
compiled in with LIVELOG, and then turned on in sysconf.

Mostly this a version of livelogging from the Hardfought server,
with some changes.
2022-02-09 22:49:25 +02:00
Pasi Kallinen bbd5577063 Fix copy-paste error 2022-02-07 13:09:52 +02:00
Pasi Kallinen e2442c395b Make double fight prefix cancel out 2022-02-07 09:14:47 +02:00
Pasi Kallinen 4ee1c66f8f Make solid water behave more consistently
The "water" terrain (as used on the Plane of Water) behaved
strangely outside the plane. Make it behave a bit more consistently,
although it's still not really usable elsewhere.

The rationale here being it's a solid wall of water.

Firstly, disable levitation and flying (which was already done
when moving into the water on the Plane of Water), and moving into
it refers to it as a "wall of water" to make it clear it's a solid
block of water.
2022-02-06 20:38:22 +02:00
Pasi Kallinen 3315a5735e Add unique Rider revival messages
This comes from xNetHack by copperwater <aosdict@gmail.com>
with some changes to the code, although original change is from
SpliceHack.
2022-02-06 20:00:32 +02:00
Pasi Kallinen 82d404ec51 Death attacking a monster does drain life attack 2022-02-06 19:27:20 +02:00
Pasi Kallinen 2bd4386956 Magic traps can toggle intrinsic invisibility
Originally from Sporkhack by Derek Ray
2022-02-06 17:54:09 +02:00
Pasi Kallinen 20054551f9 Don't push unknown boulders when moving
If you're blind and there's a boulder you don't know about,
don't automatically push it. Instead, give a message and show
the boulder on the map.
2022-02-05 11:30:35 +02:00
Pasi Kallinen 8eb00cf593 Fix thinko in drain life attack
Fixes #667
2022-02-05 10:40:45 +02:00
Pasi Kallinen 93db2a8a84 Rejigger the prefix input
Make prefix commands cancel themselves when pressed twice,
with a message saying so.

Hopefully this fixes the problems I introduced.
2022-02-05 10:05:40 +02:00
Pasi Kallinen 8f7f598050 Fix mention_walls distinguishing unseen walls from solid stone
Bumping into an unseen wall reported "a wall" instead of "solid stone",
even though you could not know it was a wall when looking at it.

Use the same method when looking at glyphs on the map instead of
the map location type.

Fixes #318
2022-02-04 14:02:18 +02:00
Pasi Kallinen ac3c005615 Fix fall depth from Castle to the Valley 2022-01-31 20:31:26 +02:00
Pasi Kallinen 2cad4ecec2 Covetous monsters will teleport to downstairs or upstairs
I accidentally swapped the covetous monsters teleport to stairs to heal
but instead of changing it back like it was, now make those monsters
teleport to either upstairs or downstairs - some of them will go up,
others go down.
2022-01-31 19:52:33 +02:00
Pasi Kallinen 218c0d4a3b Stinking clouds block line of sight
... you will also get a message when a seen stinking cloud
or the one surrounding the hero dissipates.

Original feature comes from Fourk, but this version (with some
minor changes) comes from xnethack by copperwater <aosdict@gmail.com>
2022-01-31 19:00:19 +02:00
Pasi Kallinen 9f9551bdb3 Swap running and rushing modes back
I unintentionally swapped the shift and ctrl movement keys
when redoing the movement input - change them back to how
it was earlier.

Also change the number_pad meta-key bindings, and explain
in the comments why: We can't bind shift or ctrl numbers.
Meta (aka alt-key) works with number-pad numbers when
the altmeta-option is on. There was no altmeta in 3.4.3.

Here's a table of the flags.run/g.context.run values,
from 3.4.3 and 3.7 as of this commit:

             | num_pad:0 || num_pad:1
             | 343 | 370 || 343 | 370
-------------------------------------------------
 <dir>       |  0  |  0  ||  0  |  0
 shift-<dir> |  1  |  1  ||  0  | N/A
 ctrl-<dir>  |  3  |  3  ||  0  | N/A
 meta-<dir>  | N/A | N/A || N/A |  1 (with altmeta)
 m-prefix    |  0  |  -  ||  0  |  -
 G-prefix    |  3  |  3  ||  3  |  3
 g-prefix    |  2  |  2  ||  2  |  2
 5-prefix    | N/A | N/A ||  3  |  3
-------------------------------------------------

The m-prefix in 3.7 does not set the run-value, as it can now
be used with any movement key or prefix, which will set the run value.

New input system does not lose functionality when compared to 3.4.3.
Instead, the number_pad users gain the meta-<dir> running.

This doesn't fix the issue of three badly differentiated run values.
2022-01-29 12:58:06 +02:00
Pasi Kallinen af6f9b4594 X11 issue is already fixed 2022-01-28 17:28:54 +02:00
Pasi Kallinen c722962713 Cancellation explodes magical traps 2022-01-28 08:30:08 +02:00
Pasi Kallinen 95acaf2989 Falling through a hole or trap door will cause damage 2022-01-25 14:17:43 +02:00
Pasi Kallinen 61f78318a5 X11: Fix map expose area
The stop_row and stop_col were off-by-one in some cases, leaving
black lines on the map when a window on top was closed.
Simplify the calculation by always going one row/col further,
ensuring previously covered area gets redrawn for sure.
This should not affect speed or resource usage noticeably these days.
2022-01-25 11:26:47 +02:00
Pasi Kallinen 0652f7f774 Mindless monsters shouldn't cringe stepping on squeaky boards 2022-01-24 23:13:36 +02:00
Pasi Kallinen 4130a3a6ae Fix ESC so it cancels the movement prefix commands
My changes to turn the movement and prefix commands into
extended commands broke this.
2022-01-24 19:48:43 +02:00
Pasi Kallinen 6ed315ecf8 Don't stop running next to a peaceful monster
... unless the monster blocks the way.
2022-01-24 18:45:57 +02:00
Pasi Kallinen a6816824c7 Lua: Pass more data to room contents function 2022-01-23 13:27:00 +02:00
Pasi Kallinen 7b87f7b495 X11: Fix map display for hypothetical huge map
memsets don't work very well when xchar isn't char sized.
2022-01-23 01:14:26 +02:00
Pasi Kallinen d92d5f2268 Fix possibly uninitialized error 2022-01-22 21:53:15 +02:00
Pasi Kallinen 3b542e3cab Fix vision if xchar is defined larger than char 2022-01-22 21:15:44 +02:00
Pasi Kallinen 738a225011 Replace a return value with ECMD define 2022-01-22 16:04:02 +02:00
Pasi Kallinen f698d48ba0 Avoid generating monsters on boulders
... unless the monster can go through walls.
2022-01-22 15:41:18 +02:00
Pasi Kallinen 9d64d135b8 Curses: fix extended command input
The extended command input prompt was behaving in an unintended way:
Typing #a<enter> executed #adjust. Spaces in the entry prevented matching
any command. No error message was given when no command was matched.

Fix all of those, so it behaves more like the tty.

Clean up the tty, curses, and X11 windowport code, so they don't use
the extcmdlist array directly, but query with extcmds_match
and extcmds_getentry.
2022-01-22 14:32:53 +02:00
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