Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 38a5dac08c Tutorial: add farlooking 2024-05-20 17:51:56 +03:00
Pasi Kallinen 016ff166c0 Slightly more variance to hellfill maze v5 2024-05-11 10:02:23 +03:00
Pasi Kallinen ed5c7114ab Untrapping containers or doors gives some experience 2024-05-08 20:10:32 +03:00
Pasi Kallinen a6c5d967d2 Fix bhit/mbhit hitting destroyed objects
A monster zapped a wand of striking, hitting a burning potion
of oil, which destroyed items in the same square, and the ray was
checking destroyed item.  Similar thing with a ray done by hero.

The code currently stops checking the objects in the location
if a next object in the chain was destroyed - an improvement
would be to gather all the objects into an array and iterate
over that instead of relying on the nexthere pointer.
2024-05-07 16:05:00 +03:00
Pasi Kallinen 7139ee7446 Move light source and timer types so zero means none
Breaks saves and bones.
2024-05-06 19:58:21 +03:00
Pasi Kallinen dba37fa768 Zero out freed timers and light sources 2024-05-06 19:17:07 +03:00
Pasi Kallinen 1a58ed8de9 Rework object deletion
Make object deletion work similarly to monster deletion:
it's marked for deletion (by setting the where-field to OBJ_DELETED
and moved to specific deleted-objects chain), but they're actually
freed at the beginning of turn.

This may need some more tweaking, especially in places that iterate
over object chains, but fuzzing did not find any obvious problems.

Fix a case of accessing freed memory: a monster breathed at hero,
destroying some items.  The code stored the next item in the chain
(a cloak), but a ring of levitation was destroyed, causing hero to
plop down into lava, destroying the cloak.  The item destruction
code then tried to access the destroyed cloak object.
Make the code check the object where-field - which will be different
if the object was marked for deletion.  Also removed an extra loop
going through the whole object chain looking for the items to
destroy.
2024-05-06 17:57:47 +03:00
Pasi Kallinen 312a4bcd26 Fix weight of merged partially eaten food
Due to integer rounding, merging two partially eaten food rations
will have wrong weight if we add the old weights together.
Recalculate the weight instead.

quan = 1, weight = 6  (6.675)
quan = 2, weight = 13 (13.35)
2024-05-06 12:06:33 +03:00
Pasi Kallinen cc6d04519c Fix mind flayer missing wildly impossible
A mind flayer blasted a polyed hero on a pool, who reverted back
to human.  The hero teleported to safety, but the mind flayer was
still thinking hero was at the old location, and tried to attack there.
2024-05-03 17:57:21 +03:00
Pasi Kallinen 9b9d9d1a13 Fix getloc filter looking outside the map 2024-05-01 11:15:31 +03:00
Pasi Kallinen 575d8c0696 Prevent boomerang going out of map 2024-05-01 10:12:51 +03:00
Pasi Kallinen a0256ef5cb Fix monster vs monster breath attacks
The same routine handles both monster-vs-hero and monster-vs-monster
breath attacks, but the code was considering what the attacker knows
about hero's resistances even when attacking another monster.

Also unconditionally prevent the monster breath attack if the monster
knows about hero reflecting - previously the monster could use the breath
if it were just far enough from hero, even when hero had reflection.
2024-04-27 21:18:58 +03:00
Pasi Kallinen 26c8cbc931 Fix drawbridge checking outside map 2024-04-26 07:59:42 +03:00
Pasi Kallinen ab0a98072b Prevent kicking an object accessing out of map location 2024-04-25 22:58:37 +03:00
Pasi Kallinen 5fa6e6bd8d Prevent explosions moving objects out of map 2024-04-25 22:28:21 +03:00
Pasi Kallinen 472cb7f7fa Prevent throwing gold out of the map 2024-04-25 12:39:02 +03:00
Pasi Kallinen 94dd316e80 Make saveoptions save changed autocompletions 2024-04-25 10:13:08 +03:00
Pasi Kallinen 91ecf2b167 Fix level regions accessing outside map 2024-04-24 23:35:55 +03:00
Pasi Kallinen 3ec8eb59de Fix off-map monster doing things
m_move could make monster go off-map (by eg. using a trap),
but the return values don't reflect that
2024-04-22 16:38:59 +03:00
Pasi Kallinen b76a96bf40 Add missing break
A rolling boulder hitting a wall or a tree could keep going,
possibly going out of map bounds
2024-04-22 14:46:18 +03:00
Pasi Kallinen a429eed984 Add Garden themeroom
Contains some wood nymphs and fountains, and the room walls are trees.

Adds a new lua hook for themeroom generation, "post_level_generate",
which is called last when generating the level.
2024-04-20 19:27:48 +03:00
Pasi Kallinen 4f271c912f Fuzzer vs repeat deaths, again
Even 100 deaths wasn't enough, as the fuzzer was still quitting.
If we're in wizmode, just execute wizmakemap to recreate the level,
getting rid of whatever was blocking hero from teleporting to safety.
2024-04-18 18:10:40 +03:00
Pasi Kallinen 08588a14f8 Prevent error when vault guard fails to relocate monster 2024-04-18 17:12:28 +03:00
Pasi Kallinen bb3b9b7271 CHANGE_COLOR: Save the palette with #saveoptions 2024-04-18 09:24:34 +03:00
Pasi Kallinen 7db8f7c6a5 Fix mention_map and hiders causing a light source error
Prevent glyph change messages while loading a level file.
Otherwise a monster hiding under an item triggered a vision recalc
before light sources were linked to their sources, leading into
strange errors looking like pointer corruption.

getlev -> hide_monst -> hideunder -> newsym -> show_glyph ->
 pline_xy -> vision_recalc -> do_light_sources -> get_obj_location

Add in_getlev program state variable, analogous to in_mklev
2024-04-18 09:01:11 +03:00
Pasi Kallinen bad63a0d36 Hallu Banana 2024-04-14 10:14:27 +03:00
Pasi Kallinen 3086f16386 Shopkeepers bill you for using their bear trap or land mine 2024-04-13 15:10:15 +03:00
Pasi Kallinen a57d0e6f4f Curses: add support for the palette config option
Depends on CHANGE_COLOR compile-time option.

Also allow multiple palette-definitions in the config file.
2024-04-13 12:01:43 +03:00
Pasi Kallinen 00d0700e75 Pit fiends can easily climb out of pits 2024-04-12 11:13:24 +03:00
Pasi Kallinen f15035868c Change Nalzok and Minion of Huhetotl to bright red
Disambiguate them from all the other red major demons.
The tiles are already bright red.
2024-04-11 21:39:22 +03:00
Pasi Kallinen 7cf7fe3c9b Init a possibly uninitialized variable 2024-04-11 18:52:51 +03:00
Pasi Kallinen f1c77aa2fd Pets avoid a location hero just kicked
If hero kicks a location, pets and peacefuls will avoid moving
into that location for that turn.
2024-04-11 18:05:18 +03:00
Pasi Kallinen 62b78ba037 Hero movement affects water bubble direction 2024-04-10 21:57:05 +03:00
Pasi Kallinen 85c8644469 Gold dragon should drop scales 2024-04-09 08:40:56 +03:00
Pasi Kallinen 0c29f88d0e Move showdamage to Advanced options 2024-04-07 17:19:25 +03:00
Pasi Kallinen 712a735111 Guidebook: hitpointbar is also available in curses 2024-04-07 12:24:19 +03:00
Pasi Kallinen 7ecc778173 Curses: fix pile hilite background color
The curses colorpair rework I did changed the pile hilite background
color from blue to red. Change it back to blue, and use a function
to get the color pair instead of hardcoding the value.
2024-04-05 20:15:21 +03:00
Pasi Kallinen 969c87c0a1 Unblind telepathy range and carried artifacts 2024-04-05 09:44:52 +03:00
Pasi Kallinen 28ed8e7962 Unblind telepathy range
Unblind telepathy range depends on the number of telepathy granting
items worn.

Breaks saves.
2024-04-04 23:22:28 +03:00
Pasi Kallinen 8762ab38ef Silent monsters in stinking clouds don't cough
... and you can hear the coughing some distance away,
even if you can't see the monster.
2024-04-04 12:32:31 +03:00
Pasi Kallinen f0fdd3c371 Make hero polyed into fog cloud emit clouds
Also prevent cloud creation giving a message, if it was a single
cloud on hero and deals no damage.
2024-04-04 12:17:44 +03:00
Pasi Kallinen 7f1bbdfb0e Hero polyed into fog cloud will also maintain clouds 2024-04-04 11:33:09 +03:00
Pasi Kallinen e2d3368b0e Make hero polyed into hezrou also stink 2024-04-04 11:22:20 +03:00
Pasi Kallinen defb5d5f80 Pets considered any noise made by hero as whistling
In 3.6.2 parts of the wakeup code were merged together, and this
caused pets consider any noise made by the hero - such as hitting
iron bars or digging - as whistling for them to come to the hero.

Change it to only consider actual whistling and ringing a bell.
2024-04-03 12:46:15 +03:00
Pasi Kallinen e821274382 Excalibur is much harder to get if hero is not a knight 2024-04-02 20:41:54 +03:00
Pasi Kallinen c4d4bafb44 Fix NO_TERMS compile, rename func
... to match others, from tty_curs_set to term_curs_set
2024-04-02 14:31:33 +03:00
Pasi Kallinen 7030b0b9fe tty: hide cursor unless waiting for user input
Use vi (cursor_invisible) and ve (cursor_normal) to hide and show
cursor, if the terminal supports those.  This way on a slower
connection the cursor doesn't jump all over the place when doing
map or menu updates.
2024-04-02 10:28:20 +03:00
Pasi Kallinen 44575ab347 Prevent blinding ray at yourself
The code doesn't handle zapping blinding ray at yourself;
maybe it should be changed to handle it, but for now just
prevent Sunsword blinding the hero.
2024-03-31 20:24:02 +03:00
Pasi Kallinen c71e8ec8d4 Sunsword can be invoked to create a blinding ray 2024-03-31 19:43:33 +03:00
Pasi Kallinen 1b0ba3433c Show damage only when any damage is dealt 2024-03-31 18:51:34 +03:00
Pasi Kallinen 058fc0cecf Fix signedness warning 2024-03-25 18:39:21 +02:00
Pasi Kallinen f131942dd2 Another tamedog message
Give a different message when a peaceful creature was tamed.
Allow suppressing this and the previous message, when the caller
handles messaging.
2024-03-24 10:48:29 +02:00
Pasi Kallinen 4d206c1c40 Make tamedog give a message
People seemed to be confused when a monster next to them was tame
after stepping on a magic trap; this is also an accessibility issue.
2024-03-23 18:37:12 +02:00
Pasi Kallinen e0cb6e2206 Query menu for putting ring on left or right hand 2024-03-23 13:22:29 +02:00
Pasi Kallinen 720c62c340 Ring of aggravate monster increases level difficulty 2024-03-23 12:35:54 +02:00
Pasi Kallinen a26f3d1838 yn_function menu code cleanup 2024-03-23 11:05:38 +02:00
Pasi Kallinen 82a698f333 Comment typofix 2024-03-23 10:36:00 +02:00
Pasi Kallinen 9a870b5f06 Option to use a menu to answer yes/no prompts
Add a new boolean option 'query_menu'. If on, game will pop up
a menu for specific yes/no questions, instead of using an input prompt.
2024-03-22 19:19:57 +02:00
Pasi Kallinen cbae237d62 Minor CRASHREPORT formatting bit 2024-03-22 17:54:36 +02:00
Pasi Kallinen fe2f58fbad Curses: Fix accessing illegal window id 2024-03-21 16:55:26 +02:00
Pasi Kallinen 8e83fcb1cc Fix returning from tutorial
Removing these two values from the stack seems to prevent calling
the leave_tutorial hook.
2024-03-20 22:44:12 +02:00
Pasi Kallinen 23d1657dca Add walking on traps to default paranoid_confirm 2024-03-20 19:31:09 +02:00
Pasi Kallinen e3ec21c5d3 Curses: avoid redrawing message window for each restored message 2024-03-19 19:19:16 +02:00
Pasi Kallinen 55263050df Doc: windowport putmsghistory 2024-03-19 18:59:23 +02:00
Pasi Kallinen ba7af36bfc Curses: Fix message window unhighlighting
The recent change to allow setting window colors in curses
resulted in PDCurses clearing the message window background color.
2024-03-18 10:02:51 +02:00
Pasi Kallinen 0700f60983 Fix segfault in curses
Curses handles menu and text windows specially; their id numbers
keep going up, so we need to check if the id is for a menu or
text window instead of directly accessing the windows array.
2024-03-17 20:09:43 +02:00
Pasi Kallinen 4030ef13a0 Curses: implement the windowcolors option
Allow changing the curses windows foreground and background colors,
for example:

OPTIONS=windowcolor:menu #8000F0/20F080 message grey/blue
2024-03-17 18:41:52 +02:00
Pasi Kallinen cad4d87101 wishtest fix
left-over bit from testing
2024-03-16 17:09:54 +02:00
Pasi Kallinen 9d97835686 Minor wishing alias improvement
Previously when wishing for "ring of protection from shape shifters",
you got a random ring instead of the protection from shape changers,
because the string matching alias was "protection from shape shifters"
without the object class.  Now, we'll check if the wish matched any
object class, but not existing object or alias, and try matching
the aliases again, but only those of the already matching obj class.

Add an alias for the ring of increase accuracy: "ring of accuracy",
and tests for it.
2024-03-16 16:59:58 +02:00
Pasi Kallinen c91d8d9450 Curses: unnecessary window erasing
When removing a temporary (menu, text, popup) window, the code
was erasing it from memory and then refreshing the screen.
This is unnecessary, as we're refreshing all the windows anyway.
2024-03-16 13:58:28 +02:00
Pasi Kallinen 243f6410d2 Curses: simplify color handling
The map frame (background) colors were all over the place; the
code should be much cleaner now, and still work exactly the same
as before.

I tested this with terminals with 8, 16, and 256 COLORS.
2024-03-15 20:36:56 +02:00
Pasi Kallinen 464d0c9269 Curses: swap the grey and no-color initialization
The grey color was initialized as default foreground color,
and no-color as white.
2024-03-15 11:06:44 +02:00
Pasi Kallinen 6e6c8a7208 Curses: fix message window border
When certain options (eg. legacy at least) were turned off,
the curses message window wasn't redrawn after the character creation.
2024-03-09 22:58:28 +02:00
Pasi Kallinen bb8ac1cded Curses: message window unhilite
The curses message window shows new messages bold, and removes the
bolding from older ones.  The code was calling curses mvwchgat with
attribute and color parameters in the wrong order.  Also change the
code to actually retain the color of the window, so it just removes
the bold attribute.
2024-03-09 18:44:31 +02:00
Pasi Kallinen 8cd8759e04 Walking on ice can make you slide in a random direction 2024-03-07 19:29:09 +02:00
Pasi Kallinen 2de0c8cacb Qt: make all menus modal
This fixes a lot of problems where a menu or a text window was up
and the main window accepted input - for example you could move around,
making another window of the same type pop up ...
2024-03-04 11:39:32 +02:00
Pasi Kallinen 53778ee507 Use single define for max message history
... instead of having every windowport define their own variant.
Affects tty, curses, X11, and Windows GUI.
2024-03-03 11:34:59 +02:00
Pasi Kallinen 140fb7215d Message location for monster going thru trap door 2024-03-02 10:00:38 +02:00
Pasi Kallinen 8588873858 Item destruction and recharging fix
Recharge only handles items carried by hero.
I don't think it really matters that we just skip it, but leave
a FIXME in the code if anyone has enough energy to improve this later.
Fallout from the unified item destruction.
2024-03-02 09:29:55 +02:00
Pasi Kallinen 121cf75d39 Minor changes to mention_map
Disable it during screen redraw.
Always use the message coordinates with it, even if accessiblemsg is off.
2024-02-29 18:29:43 +02:00
Pasi Kallinen 25fa293c81 Accessibility: lookaround command, mention_map option
Adds a new extended command #lookaround, which will describe
the map around the hero they can see or remember.

Adds a new boolean option mention_map, which will give a message
when an interesting map location in sight changes.
2024-02-28 20:53:52 +02:00
Pasi Kallinen dd37c5326a Accessibility: showdamage option
Add a new boolean option showdamage, if on, outputs a message
like "[HP -2, 14 left]" - several variants have something similar,
but I chose the message based on how eSpeak said it, while keeping
it short.
2024-02-24 17:38:46 +02:00
Pasi Kallinen c7e2ebe83c Check inventory protection only when hero is carrying it
TODO and better fix would be to have similar check for
monster inventory.
2024-02-21 11:28:49 +02:00
Pasi Kallinen d42efcd04f Slightly randomize the spellbook in vlad's tower
Replace the guaranteed invisibility with a somewhat high-level
spell sort-of thematical to Vlad or vampires in general
2024-02-21 09:47:47 +02:00
Pasi Kallinen 391295cfdc Move comment 2024-02-21 08:18:40 +02:00
Pasi Kallinen e76ab9558f remove register that snuck in 2024-02-20 22:13:31 +02:00
Pasi Kallinen ea38ddcb13 Fix mplayer weapon weight 2024-02-20 22:11:42 +02:00
Pasi Kallinen a0c28e97da Qt: split menu window color and attr setting 2024-02-18 13:27:47 +02:00
Pasi Kallinen 2952bdab63 No secret doors or corridors on the early levels
New players often get stuck on the first level when they can't
find the secret door or corridor.  Make the first two levels
have no such features.
2024-02-18 11:47:02 +02:00
Pasi Kallinen d511944dda Add missing initializer for field w_what 2024-02-12 12:57:50 +02:00
Pasi Kallinen b37f1408d8 Self-recover for linux
Compile-time option SELF_RECOVER was implemented for Windows;
add it to unix systems too, with it being on by default when
compiling with the linux hints file.
2024-02-08 11:34:59 +02:00
Pasi Kallinen 6b9f411a32 Accessibility: mon_movement
Adds a new boolean option, mon_movement. When hero notices monster
movement, give a message. Use with spot_monsters and accessiblemsg.
2024-02-07 19:50:38 +02:00
Pasi Kallinen 6c874267b8 Correct petattr doc in Guidebook 2024-02-06 08:54:32 +02:00
Pasi Kallinen 8c815d3bfa Init petattr in core, not in curses
My recent change to petattr caused a crash in curses when no
petattr was used in config file - because curses was setting
petattr to curses-specific value.  Init the setting in core
instead.
2024-02-06 08:50:16 +02:00
Pasi Kallinen 0d7fc06eb9 Do garbage collection on luacore
Another lua state that is not freed until end of game,
so clean up the stack and do GC regularly.
2024-02-03 12:55:10 +02:00
Pasi Kallinen e7a7526ea9 Minor code formatting 2024-02-03 10:56:16 +02:00
Pasi Kallinen fc0b61be60 Fix another wall_angle problem
Secret doors also need the correct wall_angle.
2024-02-02 18:41:45 +02:00
Pasi Kallinen 2a5a7160c9 Fix object weight when part of stack burns up on floor 2024-02-01 20:58:22 +02:00
Pasi Kallinen 95e42bf692 Split out random trap type picking 2024-01-29 20:10:07 +02:00
Pasi Kallinen 97678379dc Split picking familiar permonst type 2024-01-29 19:00:25 +02:00