Commit Graph
100 Commits
Author SHA1 Message Date
Pasi Kallinen 3afbcb76f5 Minor msdos cross compile improvements 2019-11-23 23:40:25 +02:00
Pasi Kallinen acf48fa305 Fix the lua integration parts marked for review
Also, explicitly allow traps of type "random".
2019-11-23 17:42:14 +02:00
Pasi Kallinen 5cad6a15dc More hallu monsters 2019-11-22 09:24:19 +02:00
Pasi Kallinen cb4d350424 Fix unnecessary string copy 2019-11-20 21:20:35 +02:00
Pasi Kallinen a338f8bd88 Fix wizmakemap calling mklev twice 2019-11-20 21:08:35 +02:00
Pasi Kallinen 791657f4e6 Fix memory leaks in lua integration 2019-11-20 20:09:16 +02:00
Pasi Kallinen 786a90415e Fix some memory leaks 2019-11-19 17:31:50 +02:00
Pasi Kallinen 65ccd1d89e Fix double DLB definition in linux hints file 2019-11-18 09:16:51 +02:00
Pasi Kallinen c2f7fb7d84 Fix heap-use-after-free
bcsign was used on a freed obj
2019-11-11 18:46:19 +02:00
Pasi Kallinen a6b752e6f1 Lua: Default dungeon and level chance is 100 2019-11-10 17:36:59 +02:00
Pasi Kallinen 32f2fdb135 Remove leftover level compiler header 2019-11-07 19:40:41 +02:00
Pasi Kallinen 6f5a50a538 Move and remove test files 2019-11-07 19:32:36 +02:00
Pasi Kallinen 4e438e0146 Use lua_tointeger instead of lua_tonumber 2019-11-07 19:28:58 +02:00
Pasi Kallinen 468ba1071d Remove the hints file change for extra warnings 2019-11-07 18:45:42 +02:00
Pasi Kallinen 6dca5e0a49 Fix couple warnings
Alloc failure is already handled.
2019-11-07 18:13:48 +02:00
Pasi Kallinen 1908017e27 Fixes typo 2019-11-07 11:23:28 +02:00
Pasi Kallinen 9cd9280276 Lua: remove dgn_comp, use lua instead 2019-11-06 18:45:10 +02:00
Pasi Kallinen fd55d9118e Use lua for special level files
Game is playable, and should compile on linux and Windows.
Assumes you have a lua 5.3 library available.

Removes level compiler and associated files.
Replaces special level des-files with lua scripts.
Exposes some NetHack internals to lua:
 - des-table with commands to create special levels
 - nh-table with NetHack core commands
 - nhc-table with some constants
 - u-table with some player-specific data (u-struct)
 - selection userdata

Adds some rudimentary tests.

Adds new extended command #wizloadlua to run a specific script,
and #wizloaddes to run a specific level-creation script.

nhlib.lua is loaded for every lua script.

Download and untar lua:
  mkdir lib
  cd lib
  curl -R -O http://www.lua.org/ftp/lua-5.3.5.tar.gz
  tar zxf lua-5.3.5.tar.gz

Then make nethack normally.
2019-11-06 18:43:20 +02:00
Pasi Kallinen efbef0f22c Fix unleashable message given for non-leashed monster 2019-11-04 18:58:22 +02:00
Pasi Kallinen 4c9f4dbbd9 Prevent leashing monsters with no extremities
... and also unsolid monsters.
2019-11-02 11:40:37 +02:00
Pasi Kallinen 54024f2015 Fix pet polyed to long worm staying leashed
Long worms cannot be leashed, but polymorphing a leashed pet
into a long worm kept it leashed.
2019-11-01 19:05:48 +02:00
Pasi Kallinen d201d302b7 Fix wizmakemap leaving genocided monsters on map
If a genocided monster was in "limbo" (migrating to the same level),
wizmakemap put it back on map.
2019-10-26 19:58:02 +03:00
Pasi Kallinen f200397689 Fix monster triggering land mine accessing deleted trap
mintrap -> thitm -> mondied -> relobj -> mdrop_obj ->
flooreffects -> deltrap

after calling thitm, the mintrap code was trying to access the trap.
2019-10-13 20:52:38 +03:00
Pasi Kallinen 346ebbce10 Fix launched object accessing a deleted trap
In launch_obj, the code first got the trap, then called ohitmon
(which can delete the trap by doing mondied -> fill_pit ->
flooreffects -> deltrap), then after that used the trap variable.
2019-10-13 20:40:58 +03:00
Pasi Kallinen 1f7095e226 Fix addressing deleted trap when helping monster out of a pit
Move reward_untrap before fill_pit, as the trap may get deleted.
2019-10-13 19:58:27 +03:00
Pasi Kallinen 9e9ee59ca7 Fix hero hiding under a statue shattered by land mine
Trigger a land mine while being polymorphed into a monster that
automatically hides (eg. scorpion). Have the statue on the land mine
shatter and all items on that square scatter away. Avoid falling
into the pit left by the land mine.
2019-10-13 19:30:32 +03:00
Pasi Kallinen 46adb312e7 Fix priests and shopkeepers moving on other monsters 2019-10-11 20:24:17 +03:00
Pasi Kallinen ab30c3d79d Fix vault guard impossible
... when the guard is angry, and he's in the vault or in his corridor,
you're not in the vault nor in his corridor, and the level is full
so the guard cannot relocate.
2019-10-11 20:11:28 +03:00
Pasi Kallinen 02b9368dba Fix fired iron ball sanity error
When hero was punished and swallowed, and fired the attached
iron ball from a quiver, thrownobj was not cleared.
2019-10-11 20:02:06 +03:00
Pasi Kallinen e92445810f Fix ball and chain sanity
Scatter did not consider the ball or chain, and moved them around, causing
ball and chain sanity error.

One way to trigger was being punished, with chain on a land mine and having
a monster trigger the mine. Now the chain will shatter, unpunishing the hero.
2019-10-08 19:47:51 +03:00
Pasi Kallinen 6426e61860 Prevent a possible impossible when guard relocated a monster 2019-09-06 22:09:03 +03:00
Pasi Kallinen 2562144503 Make sure the correct luckstone is the prize
The first generated luckstone is marked as the prize in mines' end.
Make sure we generate the intended one first, before any other
(possibly randomly generated) luckstones.
2019-05-25 19:15:56 +03:00
Pasi Kallinen 217671e00f Remove built-in speaker support
The changes to amiga, mac and msdos builds are untested.
2019-05-11 11:10:00 +03:00
Pasi Kallinen c4b286be8f Fix merge mistake 2019-05-09 20:27:33 +03:00
Pasi Kallinen 60f1b7e35b Fix compiling without DLB 2019-05-09 19:44:34 +03:00
Pasi Kallinen fdb2c91723 Fix X11 compilation 2019-05-09 10:23:29 +03:00
Pasi Kallinen bed2c2307e Fix monster trapped state being wrong
When cloning a monster, clear the clone trapped and hiding states.
When splitting a monster (eg. a black pudding), the clone could
be placed on a trap, so do mintrap.
When removing a monster from the map, clear the trapped state.
2019-05-05 22:58:27 +03:00
Pasi Kallinen f55e9ddd7c Fix impossible if monster cannot be relocated from tele region 2019-05-05 22:30:20 +03:00
Pasi Kallinen f303fd2872 Database fixes
Merge barbed devil entry to already existing one.
Replace spaces in the beginning of lines with tabs.
2019-05-01 13:38:57 +03:00
Pasi Kallinen f17cfc977b Add the missing int param 2019-04-29 20:45:18 +03:00
Pasi Kallinen 1a4223faac Unify code for cure self spell 2019-04-29 18:50:08 +03:00
Pasi Kallinen be40ff3104 Cursor targeting help improvement
Based on feedback from users, explicitly show that m/M keys cycle
to next/previous monster, and so on.
2019-03-29 16:33:54 +02:00
Pasi Kallinen f68cb08304 Zero an array
Valgrind complained about accessing uninitialised memory
2019-03-24 13:03:22 +02:00
Pasi Kallinen 9f1ae0fe74 Fix making fake leash object with leashmon set
When farlooking at a leash glyph on a map, the fake object should never
have leashmon set. This happened when a mimic was on the same spot
and was mimicing a corpse or statue, due to leashmon and corpsenm
using the same field.
2019-02-01 18:19:04 +02:00
Pasi Kallinen adacde80e7 Fix logic error in stuck_in_wall 2019-02-01 13:38:21 +02:00
Pasi Kallinen 7bbc1f0130 Fix warning
Fix "using integer constants in boolean context"
2019-01-31 21:31:29 +02:00
Pasi Kallinen 8736141f68 Option handling return values and errors
Fix some options not stopping when encountering an error,
some didn't show up any errors, and other minor fixes.
2019-01-31 10:46:44 +02:00
Pasi Kallinen 6a953231a3 Silence sprintf format warnings and dehardcode buffer sizes 2019-01-31 09:42:07 +02:00
Pasi Kallinen 749fb2e222 Fix make tileutils failure
OALLOC was used twice
2019-01-23 18:17:52 +02:00
Pasi Kallinen f6b9dc7d68 Don't try to write a zero-length message
If the message history contains a zero-length message line, skip it,
as trying to write a zero-length string will make bwrite panic.

Happened only on X11. This is post-3.6.1 bug.
2019-01-21 11:56:19 +02:00
Pasi Kallinen 77bc07f579 Make demon gating show a message
This was both an accessibility and comprehensibility issue.
2019-01-20 15:56:44 +02:00
Pasi Kallinen abcdb713d5 wizmakemap should reset lockpicking 2019-01-13 17:27:17 +02:00
Pasi Kallinen 5e2236a3ef Fix accessing deleted fire trap
melt_ice can delete the fire trap, in the case where the trap
is on ice, and a monster carrying a boulder triggers it, then drowns.

mintrap -> minliquid -> mondead -> ... -> mdrop_obj ->
   flooreffects -> boulder_hits_pool -> delfloortrap
2019-01-10 21:48:20 +02:00
Pasi Kallinen 45e06d638f Curses: Remove useless inventory label
The inventory window used a line to say "Inventory:", which is pretty
useless, and that was the only window showing such a label.

Also don't duplicate the "Not carrying anything" text from core.
2018-12-29 13:16:51 +02:00
Pasi Kallinen 6ac681b5fa X11: default to XPM-format tile file and rip screen
People have been wondering how to change the tiles on the X11
version, and the old default of NetHack-specific binary tile data
isn't directly editable with image editing tools.

Also show in the #version info if xpm and graphic rip are enabled.
2018-12-29 07:19:24 +02:00
Pasi Kallinen ca336bbf4b curses: include date.h
This way the curses port will show the version and compile date
on the startup banner, just like tty does.
2018-12-28 11:34:01 +02:00
Pasi Kallinen 8319227b55 Clear the getlin buffer
Recent change to this bit of code didn't clear the buffer,
which causes garbage in the string if compiled with EDIT_GETLIN
2018-12-07 22:18:53 +02:00
Pasi Kallinen 857b8af2ee Add missing valid location descriptors 2018-12-05 23:15:14 +02:00
Pasi Kallinen f020595fb7 Valid cursor locations showed null
When getting a cursor location, and there was no "valid" location
function defined, trying to go to the next or previous valid
location showed null.

Fix this by using the "interesting" locations if no valid ones.
2018-12-05 22:39:16 +02:00
Pasi Kallinen 6e0a9cad5a Fake leash object is not attached
When farlooking at a fake leash object, make it explicitly not
be attached to a monster.
2018-12-05 22:36:03 +02:00
Pasi Kallinen 4c9603298a glyph variable is actually used 2018-12-01 08:58:36 +02:00
Pasi Kallinen 75bf7c1975 X11: Disable menucolors when showing text files 2018-11-30 15:26:38 +02:00
Pasi Kallinen 9e6ba48dbd Typofix 2018-11-28 15:59:48 +02:00
Pasi Kallinen f942687378 Remove unnecessary define 2018-11-27 07:38:03 +02:00
Pasi Kallinen 3517277467 Add some commented out flags to linux hints file 2018-11-23 19:26:13 +02:00
Pasi Kallinen 80d1aae8a5 ifdef, not if 2018-11-23 15:15:04 +02:00
Pasi Kallinen 02749b7621 Fix guard shoving monsters away coordinate logic
The logic required both x and y coordinates of the guard location and
the new location the guard wanted to move to be different. This is
obviously wrong, as the guard may move horizontally or vertically.
2018-11-22 20:25:03 +02:00
Pasi Kallinen 030efe84fa Map column 0 is not a valid location 2018-11-21 19:17:08 +02:00
Pasi Kallinen b54dda5624 More monster location sanity checks
Placing a monster over already existing one will now complain.
Define EXTRA_SANITY_CHECKS to check monster removal too.
2018-11-19 22:38:16 +02:00
Pasi Kallinen 5acddebb3c Init long worm even if it does not have a tail
Long worms with no tail parts still apparently need to have
the zero-length tail placed.
2018-11-19 22:09:18 +02:00
Pasi Kallinen 20b47b5bbd Replace long worm on map after removing tail with wormgone
Calling wormgone will also remove the long worm monster from
the map, not just the worm tail. Put the monster back on map
so relmon can actually remove it properly.
2018-11-19 22:04:36 +02:00
Pasi Kallinen b0428321b8 Explicitly remove long worm segments from the map
When a long worm was removed from the map, the segments for that worm
retained their map location info. This caused problems later on if
wormgone (or toss_wsegs) was called, because it would try to remove the
segments of that worm from the map.
2018-11-19 21:54:35 +02:00
Pasi Kallinen 2a439af336 More long worm checks when splitting
When a long worm is split into two, perform more checks placing
the segments on the map.
2018-11-19 21:49:52 +02:00
Pasi Kallinen 7119baafb8 Long worm may get killed in middle of action
If long worm attacks you, and you have a passive response that may
kill the worm (eg. blue jelly), the worm may die in the middle of
a loop checking for a worm segment that can attack. This'll cause
a segfault because the worm segments will get freed.

If the worm dies, just exit the loop.
2018-11-19 21:27:26 +02:00
Pasi Kallinen 9ad7268c0a Moving long worms may still put tail in old location
When using rloc and friends to move monsters, and the monster
happens to be a long worm, the tail may get randomly placed
in the same place where the long worm was removed from.

In the cases where we expect the location to really be free,
explicitly recheck the location for a monster after rloc.
2018-11-19 21:24:11 +02:00
Pasi Kallinen 657f557821 Fix vault guard not considering monsters in walls
Two different cases here: a) Vault guard did not move away monsters
except if they were standing on gold, and b) moving away monsters
on a completely filled level did not work
2018-11-19 21:20:43 +02:00
Pasi Kallinen ebef31ffa5 Check monster relocation degenerate cases more strictly
Just in case we're trying to put the monster on the same location
where it already thinks it is... but actually isn't.
2018-11-19 21:16:50 +02:00
Pasi Kallinen 878ac24037 Fix freeing monsters not on map
Sometimes we free the monster data, but the monster is not on the
map - usually this happens if the map is full of monsters and a new one
is migrated on the level.

Make m_detach check the monster x coordinate, so it knows not to touch the map
if the monster isn't on it.
2018-11-19 21:16:46 +02:00
Pasi Kallinen f9f1236f26 Fix some buffer underflows 2018-11-08 21:02:24 +02:00
Pasi Kallinen afd793e9b7 Fix memory leak in makedefs 2018-11-08 17:38:36 +02:00
Pasi Kallinen 0bb6754998 Fuzz testing debug tool
Add code to run a fuzz tester, simulating (more-or-less) random
keyboard mashing. There's no option to turn it on, you need to
set iflags.debug_fuzzer on via a debugger or something along
those lines.
2018-11-08 15:55:49 +02:00
Pasi Kallinen 75f6001afc Report insanities via impossible 2018-11-07 18:50:09 +02:00
Pasi Kallinen c6ade9c715 Prevent out of array index 2018-11-07 18:39:00 +02:00
Pasi Kallinen e8eadac3c8 Feedback on trying to pick up stairs or altar 2018-11-05 18:35:20 +02:00
Pasi Kallinen d7c042eb80 Make Mjollnir lightning noisy 2018-11-02 20:49:11 +02:00
Pasi Kallinen 312f7ccc10 X11: Fix msghistory restore segfault 2018-10-30 17:40:22 +02:00
Pasi Kallinen fd60e11d8d X11: Remove leftover file display stuff 2018-10-27 20:47:27 +03:00
Pasi Kallinen 6d70997869 X11: Reuse menu code to display files
Previously the code used the ASCII Text Athena widgets for displaying
file contents. Unfortunately, the widget made it impossible to control
scrolling or pretty much anything else.

Use the menu code instead, making the file display window behave properly.
2018-10-27 13:58:59 +03:00
Pasi Kallinen 742ec3dd49 X11: Don't hilite the help ext menu entry
Both the "help" button at top and the "help" extended menu command
were hilighted by the X resources. Make the top buttons have
"btn_" prefix, so they're easily distinguished in the resources.
2018-10-25 15:58:22 +03:00
Pasi Kallinen ef4f56242c X11: Make TTY status obey hilite_status 2018-10-24 20:04:28 +03:00
Pasi Kallinen 45ecbb84d6 X11: Move color and font structs
... so that other window types can also use them.
2018-10-23 20:30:48 +03:00
Pasi Kallinen 6381c32a39 X11: Adjust some colors to differentiate them 2018-10-23 17:48:54 +03:00
Pasi Kallinen 0470065b47 X11: TTY-style status lines
Set X resource NetHack*fancy_status: False to enable the TTY-style
status lines. Default is the fancy status.

This patch is somewhat unfinished - even though the TTY-style status
allow for status hilites, the colors don't work correctly yet.
Also changes the fancy status to use the windowport notification code.
2018-10-22 21:26:56 +03:00
Pasi Kallinen b653d0d137 X11: Mouse wheel scrolling for message window 2018-10-21 19:30:05 +03:00
Pasi Kallinen d648f4c371 X11: save and load message history 2018-10-21 17:26:24 +03:00
Pasi Kallinen 7ed01793b4 X11: Fix couple issues from recent changes
Segfault due to arg array overflow, and a theoretical fix for
a hang on a Mac during player selection if -@ parameter was given
on the command line.
2018-10-20 11:17:41 +03:00
Pasi Kallinen 3f94cee340 X11: Add key and mouse scrolling to extended command menu 2018-10-18 21:33:17 +03:00
Pasi Kallinen d454855c54 X11: Handle the -@ parameter 2018-10-18 19:29:42 +03:00
Pasi Kallinen fa5e5ac4b4 X11: Obey menu movement keys 2018-10-18 18:39:27 +03:00
Pasi Kallinen c687bb7cd8 X11: Revert finding scrollbars in same window
Apparently this doesn't work, for some reason every widget reports
a different window, even when they are in the same window ...
Maybe widgets inside and outside a viewport are technically
in different windows?
2018-10-18 17:19:42 +03:00