Commit Graph

13063 Commits

Author SHA1 Message Date
PatR
43e2f7d0ae some livelog cleanup
The gamelog structure's type/flags field is 'long' but the
corresponding livelog event type field and the argument passed to
gamelog's logging were 'unsigned'.  They take the same values and
those values mean the same things so change them all to long.

The actual livelog logging assumed that time_t is a long number of
seconds, and was also using a boolean as an array index.  Perform
proper type conversions.

sysconf parsing used 'int' to hold strtol() value; change to long.
Also it was using raw_printf() instead of config_error_add() to
complain about any problems.  Clearly the livelog patch was not
updated to the current code base before being incorporated.
2022-03-02 13:09:42 -08:00
Pasi Kallinen
13d85abde5 Fix uninitialized variables
... as found by valgrind
2022-03-02 13:31:18 +02:00
PatR
23d09e6678 livelog: killing unique monsters revisited
Treat all kills of the Wizard and of any of the Riders as major events
for inclusion in dumplog.  For other unique monsters, that only happens
when they're killed for the first time.
2022-03-01 17:23:41 -08:00
PatR
730f73d1c8 livelog: killing unique monsters
Treat the first kill of any unique monster as a major event (for
inclusion in dumplog).  Revival and repeat kill is not major but
can still be seen during the game via the #chronicle command.

Show the minor event more often:  in addition to death #1 it was
being shown on death 5, 10, 50, 100, 150, 200, and 250.  Add 2, 3,
and 25 to that list.
2022-03-01 16:51:41 -08:00
PatR
f9192623e1 livelog: completing a sokoban level
Log a major event when the last hole or pit is plugged on a sokoban
level.

Event logging currently reports the got-sokoban-prize achievement as
completion of sokoban.  That's misleading but this doesn't change it.
2022-03-01 15:02:20 -08:00
PatR
33191ae4a2 eat.c formatting
This is just reformatting some relatively recently added code.

There's a lot of redundancy in eating conduct tracking and livelog
reporting of that, but this doesn't attempt to streamline it.  I may
try again some other time....
2022-03-01 14:11:58 -08:00
PatR
2bef05bb77 livelog level entry events
Fix up the level descriptions used when logging an "entered new level"
event.  Most of the change is for adding an extra argument to calls
to describe_level().  The curses portion is in a big chunk of old code
suppressed by #if 0.

I didn't notice that the level entry events are classified as LL_DEBUG
until all the work was done.  This promotes the entry events for the
four Plane of <Element> levels from debug events to major ones instead.
It doesn't do that for the Astral Plane because the entered-the-Astral-
Plane achievement already produces a major event for that.  Most other
key level entry events are in a similar situation--or will become that
way once another set of achievements eventually gets added--so there
aren't any other event classification promotions.
2022-03-01 13:53:57 -08:00
PatR
2f273eb70b Guidebook typo 2022-03-01 06:48:42 -08:00
Pasi Kallinen
e83917bbf3 Unhide monster hiding under chain when unpunished 2022-03-01 16:14:07 +02:00
Pasi Kallinen
473ae4a6a0 Prevent segfault trying to make non-existent trap seen 2022-03-01 15:31:22 +02:00
Alex Smith
d63b59e6a1 Avoid panic on zero-byte writes to save files
This is a well-defined operation, so bwrite() should be able to
handle it. However, when running under glibc, fwrite() produces an
unexpected return value for 0-byte writes, which makes bwrite()
think that the write failed (causing a panic).

This change implements 0-byte writes by not calling into libc at
all, so that we don't have to worry about how to decode the return
value of fwrite().
2022-03-01 13:23:10 +00:00
PatR
77bd50fd77 fix github issue #687 - logging of major events
Reported by k21971, the dumplog section labeled "major events" showed
all logged events rather than just the ones classified as major.
Filter out the non-major ones when writing dumplog.

At the moment only a couple of ones other than achievements are major.
Probably various other types should be too.

The #chronicle command still lists all logged events unless they're
flagged as 'spoiler'.  So far the mines' end luckstone is the only
one flagged that way.  Unfortunately a player with access to live
logging could still learn whether or not the gray stone that has just
been picked up on the last mines level is the target luckstone by
viewing the log from outside of the game.

The #chronicle command would be more useful if it gathered all the
categories of events present and put up a menu allowing the player to
choose which ones to view.  I haven't attempted to implement that.

Closes #687
2022-03-01 04:15:55 -08:00
PatR
0ac3b08825 livelog revisions
Some changes to fix things I noticed in the dumplog referenced by
github issue #687 about showing all logged events under the header
"major events".  (This doesn't address that.  I figured it was
intentional while #chronicle is having any bugs worked out.)

Sequencing:  show the event corresponding to an achievement for
entering a dungeon branch before the livelog-specific event of
entering a level for the first time.  You enter the branch before
arriving at the new level.

Missing feedback:  the you-won achievement didn't produce any
"ascended" event.  That turned out to be a side-effect to suppressing
achievements that take place after the gameover flag has been set
(so blind-from-birth and/or nudist when applicable plus duplicate
obtained-amulet and ascended due to manipulation to reposition the
amulet achievement to be right before ascended so that the alternate
wording it has in the achievements listing looks better).  Instead of
just forcing the ascended achievement to produce an ascended event,
this adds a more general game-over event.

While in there, change the classification of attaining level 14 from
minor livelog event to major since questing keys off of it.
2022-02-28 13:46:59 -08:00
Pasi Kallinen
b172957831 Use macro for spell pw cost per spell level 2022-02-28 22:21:37 +02:00
nhkeni
3cf1b87914 cmdcount_t
Add a type to force g.{command_count,last_command_count,multi} to have the
same type (because cmd.c: g.multi = g.command_count;) and some resulting
cleanup.
2022-02-27 20:01:49 -05:00
PatR
eeee725bf9 document new 'tune' achievement
Add /tune/ to the achievement section of the Guidebook.

The 'note' part is a bit of a spoiler and risks making the prayer
boon of "Hark!  To enter the castle you must play the right tune."
redundant for players who actually read the Guidebook (so hardly
anybody).  Since that's the first stage of a two-stage reward I've
left it alone.
2022-02-27 12:20:20 -08:00
PatR
a3b52bf6a3 new achievement: drawbridge tune
Use up the last available bit for achievements:
"You learned the tune to open and close the castle's drawbridge."
(More can still be added but xlogfile will need another field to
track a second set of 31 in order to keep its achievement bitmask(s)
within portable size.)

As achievements go, it's not very exciting, but players who normally
destroy the drawbridge have to choose whether to earn an achievement
first since once it's gone, there's no way to find out the tune
(either via prayer reward or successful Mastermind).  I'm guessing
that most will probably decide to ignore this achievement since it
has no effect on the outcome of the game.  However, that might not
be true for future tournament play.

There's no need to bump EDITLEVEL for this; room for recording one
additional achievement is already allocated.
2022-02-27 01:55:25 -08:00
Pasi Kallinen
6a65b41270 Using magic portals and level teleporters stuns for a few turns
It's taxing to teleport long distances.

Yes, this makes the entrance to the planes and the quest more
dangerous, and nerfs portal dancing Fort Ludios.
2022-02-27 11:25:58 +02:00
Pasi Kallinen
1d4d0f4b0e Use more u_locomotion
... and make it autocapitalize the first letter, just like locomotion
2022-02-27 11:07:31 +02:00
Pasi Kallinen
9e666b75f6 Make rope golem have some death drops 2022-02-26 23:46:55 +02:00
Pasi Kallinen
d0f349cbd1 Use find_mid finding the leashed mon 2022-02-26 22:42:37 +02:00
PatR
020d3f76d5 choose_stairs() revisited
Rewrite choose_stairs().  Use of '&& !builds_up()' was a no-op in
normal branches and forced picking the down stairs/ladder in Vlad's
Tower (or Sokoban) rather than reversing the usual up/down choice.

Also, the logic used was backwards:  Kops always surrounded the up
stairs instead of the down stairs as intended.  Non-Kops picked the
opposite direction of what the arguments asked for but since they based
their choice of up versus down on hidden mon->m_id, the reversal wasn't
noticeable.

Extend the choosing so that if nothing in the requested direction can
be found, it tries the opposite direction.  Otherwise when Vlad's m_id
happens to force the direction to be 'up', he has nowhere to teleport
to now that being in his Tower doesn't force 'down' anymore.  He goes
to down ladder when on the top level but if you level teleport to the
next level down and he accompanies you, he might go to either the down
ladder or the up ladder when he tries to get away from you to heal.
2022-02-26 10:15:58 -08:00
Pasi Kallinen
f8cb7ae0b8 Unify shopkeeper/guard/priest bit in m_move 2022-02-26 18:05:43 +02:00
Pasi Kallinen
7523623d95 Make m_move return defines instead of magic numbers 2022-02-26 17:40:17 +02:00
PatR
8c447e6ad5 formatting bits in end.c 2022-02-26 00:24:17 -08:00
PatR
b1d59665d8 Fixes entry for pull request #685 - place_object
From argrath:  in place_object(object, x, y), validate <x,y> before
using them as indices into level.objects[][] instead of after.

Closes #685
2022-02-25 22:44:17 -08:00
SHIRAKATA Kentaro
757139476f move validations before their first use 2022-02-25 22:41:21 -08:00
PatR
7f28a79ae6 fix github issue #686 - dead code
Reported by argrath:  the code in choose_stairs() intended as last
resort wouldn't do anything because the loop's test condition always
started out false.  Fix suggested by entrez.

Closes #686
2022-02-25 22:35:04 -08:00
Pasi Kallinen
4b6b976e3b Split escaping from sticking monster check out of domove 2022-02-25 22:26:12 +02:00
Pasi Kallinen
f88dce6970 Unify domove and lookaround trap/liquid avoidance code
Nearly same code was in two places - the only difference was
how g.context.run == 1 was handled.  Previously, if you were
blind, and knew about the water or lava, you still ran into it.
Now, we always avoid the dunking if running/rushing.
2022-02-25 21:52:52 +02:00
PatR
54df272f50 remove references to old Qt 'moc' timestamp files
src/moc.qt[56] existed briefly but got replaced by src/Qt[56].h-t
(controlled by hints/include/compiler.370).  The old names were
deliberately left in src/.gitignore and sys/unix/Makefile.src's
'clean' target to give some time for anyone who had generated them
to run 'make clean' to get rid of them.  That time is now up.  It's
only been about three weeks but if I wait any longer I'll probably
forget.
2022-02-25 10:39:45 -08:00
Pasi Kallinen
e57c631ef9 Minor code clarification 2022-02-25 19:48:17 +02:00
Pasi Kallinen
86bc0a2633 Split movement out of bounds check out of domove 2022-02-25 18:33:50 +02:00
Pasi Kallinen
4e11a85fb7 Split carrying too much check out of domove 2022-02-25 18:12:55 +02:00
PatR
ca97f4f3dd more thrown object cleanup
Handle thrown or kicked object that's in transit for hangup save and
panic save in addition to normal end of game.  Affects ball and chain
placement too, if they've been temporarily taken off the map.
2022-02-25 07:10:30 -08:00
Pasi Kallinen
2012254c39 Split impaired movement code out of domove 2022-02-25 17:06:25 +02:00
Pasi Kallinen
7733cbe399 Split water turbulence code out of domove 2022-02-25 16:59:52 +02:00
Pasi Kallinen
7a29110514 Split ice fumbling code out of domove 2022-02-25 16:43:09 +02:00
Pasi Kallinen
1cc79b7156 Wizard-mode wishing for (melting) ice 2022-02-25 16:42:08 +02:00
Pasi Kallinen
cb5ca657ed Split air turbulence code out of domove 2022-02-25 16:13:27 +02:00
Pasi Kallinen
d617875a82 Split force-fighting empty square out of domove 2022-02-25 15:19:51 +02:00
Pasi Kallinen
48cd81dbfd Split swapping places with pet code out of domove 2022-02-25 15:09:56 +02:00
Pasi Kallinen
f44a4b0485 Change unknown mintrap result into impossible 2022-02-25 14:57:03 +02:00
Pasi Kallinen
3b521aa955 Split force-fight iron bars code out of domove 2022-02-25 14:54:33 +02:00
Pasi Kallinen
57f55f5ca6 Split some code out of domove
Should have no change in behaviour.
2022-02-25 14:46:45 +02:00
PatR
1abf723f03 place_object() bit: panic/impossible decl 2022-02-24 18:15:48 -08:00
PatR
20eccf8ead lost objects thrown by monsters
Reported by entrez:  if a monster or explosion kills the hero with an
object that has timers or is a light source, it could trigger a panic
when end of game cleanup can't find it because it has been removed
from the map or monster's inventory and not placed back on the map
yet.  This isn't much different from something thrown by hero which
had a similar situation dealt with a long time ago.  Fix by setting
'thrownobj' for monster-launched and explosion-launched missiles.
That way done_object_cleanup() called from really_done() will place the
missile on the map where saving bones or general cleanup can find it.

It doesn't bother dealing with exploding a lit potion of oil that
kills the hero by missile damage before the potion explodes.  If that
ends up in bones, it should still be lit and might blow up before the
new character reaches it.  (Not verified.)

The code for a hero polymorphed into a unicorn and catching a thrown
gem has been moved into its own routine.  No change in behavior, just
less clutter in the thrown-object-hits-hero section of the monster
throwing routine.
2022-02-24 18:10:52 -08:00
PatR
ab2bcf4dac trap followup
Make the flags argument to dotrap() and mintrap() and the constants
passed to them all have consistent type: unsigned int.
2022-02-24 12:17:21 -08:00
Pasi Kallinen
6fa4fd46f7 Move output delay from walk_path to mhurtle_step
... in case walk_path is ever used for something that
doesn't need the delay.  The hero hurtling already had
delay, so it was done twice.
2022-02-24 19:50:37 +02:00
Pasi Kallinen
0c20bf116c Moving a monster with telekinesis hurles it through the air
... and at the end of the flight, it can't avoid a trap, if it
lands on one.
2022-02-24 19:27:59 +02:00