Commit Graph

10370 Commits

Author SHA1 Message Date
Pasi Kallinen
7a54edf91f Implement lua selection iteration
... and showcase it by dehardcoding the Fort Ludios treasury.
2020-02-26 17:25:28 +02:00
nhmall
1003a8142e fix a couple of warnings seen on visual studio 2019
src/sp_lev.c(4278): warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int(__cdecl *)(int,int)'
  src/sp_lev.c(5021): warning C4113: 'int (__cdecl *)()' differs in parameter lists from 'int (__cdecl *)(int,int)'
2020-02-25 22:56:50 -05:00
PatR
cff63b5b4c fix curses' create_nhmenu() warning
The extra flags argument to create_nhmenu() wasn't propagated to
anywhere useful.  It still doesn't do anything yet.
2020-02-25 16:18:58 -08:00
PatR
19df82971d fix nhlsel.c warning
A recent change has resulted in complaints about 'sel' not being
used in
  struct selectionvar *sel = l_selection_check(L, 1);
  struct selectionvar *ret;
  int p = (int) luaL_checkinteger(L, 2);

  lua_pop(L, 1);
  (void) l_selection_clone(L);
  ret = l_selection_check(L, 1);
  selection_filter_percent(ret, p);

This preserves the semantics of that code while getting rid of the
warning, but I have no idea whether it makes any sense.
2020-02-25 16:04:41 -08:00
Pasi Kallinen
ccb00f59bc Add new level init type, swamp
Creates a "relaxed blockwise maze".
Make Juiblex's swamp use it.
2020-02-25 19:24:58 +02:00
PatR
04d15b099b level flip comment bit 2020-02-24 17:29:32 -08:00
PatR
194b174bbc flipping current level with #wizlevelflip
Give wizard mode player control over how a level gets transposed by
prompting for the desired outcome.

Refreshing the screen showed that remembered, no longer in view wall
corners and T walls were shown with their old orientation instead of
being transposed along with the level.  This fixes that, but does so
by adding a chunk of code that will be irrelevant for normal play.
2020-02-24 17:07:01 -08:00
Pasi Kallinen
e56d3414a0 More noflip special levels 2020-02-24 19:08:58 +02:00
Pasi Kallinen
509576a8b7 Minor tweaks to level flipping 2020-02-23 15:06:44 +02:00
PatR
cbdda9dc9d adopt github pull request #286 - rndmonst()
Eliminate the cache that was supporting rndmonst() and pick a random
monster in a single pass through mons[] via "weighted reservoir
sampling", a term I'm not familiar with.

It had a couple of bugs:  if the first monster examined happened to
be given a weighting of 0, rn2() would divide by 0.  I didn't try
to figure out how to trigger that.  But the second one was easy to
trigger:  if all eligible monsters were extinct or genocided, it
would issue a warning even though the situation isn't impossible.

Aside from fixing those, the rest is mostly as-is.  I included a bit
of formatting in decl.c, moved some declarations to not require C99,
and changed a couple of macros to not hide and duplicate a call to
level_difficulty().

Fixes #286
2020-02-22 17:40:55 -08:00
PatR
5d4b9784ac more #302 - empty {bogusmon,engrave,epitaph}.txt
Have makedefs add a real data line to the output for the files that
caused trouble when empty.
2020-02-22 12:32:00 -08:00
Pasi Kallinen
dc70132da8 Change lua selection floodfill and add some tests 2020-02-22 18:35:41 +02:00
Pasi Kallinen
fe3dae85d5 Make lua selection filter_mapchar create a new selection 2020-02-22 17:51:29 +02:00
Pasi Kallinen
50eaf95c27 Make lua selection grow create a new selection 2020-02-22 16:58:45 +02:00
Pasi Kallinen
6648ecfe04 Make lua selection randline create a new selection 2020-02-22 16:34:50 +02:00
Pasi Kallinen
b3f337bdf6 Make lua selection rect and fillrect create a new selection 2020-02-22 15:23:30 +02:00
Pasi Kallinen
44f7d44e94 Make lua selection line create a new selection
... instead of modifying the one given as a parameter.

Also add some tests for it.
2020-02-22 14:23:36 +02:00
Pasi Kallinen
00a32c6039 Make lua selection percent filter create a new selection
... instead of modifying the one given as a parameter.

Also add some tests for it.
2020-02-22 13:31:47 +02:00
Pasi Kallinen
42a05e9595 Make lua selection boolean opers create a new selection
... instead of modifying one of the given selections.

Also add tests for the operations.
2020-02-22 12:17:03 +02:00
Pasi Kallinen
e8ee044468 Make lua selection negate return a new selection
... instead of modifying the one given as a parameter.

Also add tests for it.
2020-02-22 12:17:03 +02:00
PatR
29321c6f80 fix github issue #302 - divide by 0 crash
The traceback points directly to the problem:  divide by 0 happens
if the 'bogusmon' file only contains the "do not edit" line, which
would happen if 'bogusmon.txt' is empty.  makedefs probably ought to
complain about that.

There is now one hardcoded bogus monster to fall back to:  'bogon'.

Random tombstone epitaphs report divide by 0 if their text source is
empty, but it is done by rn2() rather than rn2_for_display_rng() so
is just a warning for pre-release code.  It would crash for release
version though.

I tried placing an empty engravings file and expected similar results
but didn't see any response.  Not sure what that means.

After the fix, empty epitaph file yields blank result so graves that
want a random epitaph won't have any epitaph.

Fixes #302
2020-02-22 01:41:04 -08:00
PatR
9366307210 extra ^X info (mon's location) for u.ustuck 2020-02-21 13:46:03 -08:00
PatR
12016966b1 build warning 2020-02-21 13:45:17 -08:00
Pasi Kallinen
d76ffe43b7 Don't bother flipping oracle level 2020-02-21 21:32:18 +02:00
Pasi Kallinen
88aa0793dc Allow flipping levels horizontally or vertically
When a special level is created, there's a chance it gets flipped
horizontally and/or vertically.

Add new level flags "noflip", "noflipx", and "noflipy" to prevent
flipping the level. Add a wiz-mode command #wizlevelflip to test
the flipping on current level - although this doesn't flip everything,
as level flipping is meant to happen during level creation.
2020-02-21 18:16:14 +02:00
nhmall
86f5e73ef3 ensure condition menu always starts the same way even under "play again" 2020-02-20 20:36:37 -05:00
nhmall
3bc346868e flag an unused parameter 2020-02-20 20:23:33 -05:00
nhmall
67df8dd784 add an entry for the start_menu change to fixes37.0 2020-02-20 20:19:49 -05:00
nhmall
9462b230c6 Merge branch 'menu-interface' into NetHack-3.7 2020-02-20 20:17:40 -05:00
nhmall
d81c096ce6 window port interface change - add mbehavior flags to start_menu()
Provide a way to communicate additional behaviors and/or appearances
desired from NetHack window port menus.

This is foundation work for changes to follow at a future date.
2020-02-20 20:12:51 -05:00
PatR
d9672823f9 better ^X feedback when swallowed/engulfed 2020-02-20 14:34:58 -08:00
nhmall
8e6e4922f8 preserve menu sort between 'O' commands in same instance
Also, only execute the change settings loop when the
menu response was > 0
2020-02-20 16:56:05 -05:00
nhmall
d50c3577e9 some more status condition follow-up
- Don't display 'Held' when swallowed.
- Don't display 'Held' when the hero is doing the holding; add a condition display
  entry "UHold" for that (the opt_in option is "holding")
- Allow resorting of the 'O' menu for status condition fields. Default is alphabetical, but you
  can sort by condition field ranking now.
2020-02-20 01:22:27 -05:00
PatR
cfd425d5db Wounded_legs condition
Mounting a steed while legs are wounded would offer to cure them
but wasn't going through the heal_legs() routine so didn't update
the status line when Wounded_legs condition is enabled.

Move some common code for describing left/right/both legs into a
new routine used for feedback by jumping, kicking, and ridiing.

For ^X, distinguish between one wounded leg and both but don't
bother with left vs right when it is just one.
2020-02-19 15:47:55 -08:00
Patric Mueller
16d32b3002 Remove left over NH_DEVEL_STATUS bits from makedefs.c
Left bits from previous version info code caused compilation errors
if NH_DEVEL_STATUS was not set to NH_STATUS_WIP.
2020-02-19 01:43:51 +01:00
PatR
8659dcd7bc monster sound changes
MS_MOO was placed among the humanoid sounds, resulting in a minotaur
being able to articulate "I'm hungry".  Move it to the animal sounds,
which causes almost all the sounds to be renumbered.

Give MS_MOO to rothes.

Change mumak from MS_ROAR to new sound MS_TRUMPET and mastodon from
silent to that.

I changed MS_ORC from a synonym for MS_GRUNT into a distinct type
which also just grunts.  Grunt is in the animal group of sounds and
orc is now in the 'other' group (neither animal nor understandable
humanoid).  [There are a bunch of other humanoid monsters (gnomes and
ogres, for example) that still use MS_GRUNT.  They aren't animals so
that's not right.]

Have pets who beg for food but happen to have 'other' sounds between
animal and humanoid be described as looking hungry instead of being
skipped.

Hat tipped to a peaceful humanoid will behave as non-peaceful if
Conflict is active (without giving the monster a resistance check).

Despite mons[].msound getting new values, save files should be ok.
2020-02-18 13:33:00 -08:00
Pasi Kallinen
49069d6d62 Split bound_digging function to two
Also remove a DCC 3.0 specific bug define,
doubt anyone is using that anymore ...
2020-02-18 16:53:14 +02:00
PatR
814adb41b8 fix #K376 - tipping cap
Allow #tip to do something if you pick your worn helmet instead of
a container.  It's mostly just a variation of #chat but probably adds
several new bugs....
2020-02-18 03:14:22 -08:00
nhmall
f177675cbc Guidebook.txt update from cron-NetHack-3.7 2020-02-17 14:39:24 -05:00
nhmall
73ffb61e7e typo in .tex and replacement of obsolete OS reference 2020-02-17 13:39:04 -05:00
Patric Mueller
4b270099ec Stop monsters from interacting with protected items on the floor
This fixes the issue of chests with the wand of wishing on the castle level
being stolen by soldiers.

Commit b12ea03d1 revealed that searches_for_item() didn't check for onscary()
and allowed monsters to pick up items even though they were protected by a
scroll of scare monsters.
2020-02-17 10:41:03 +01:00
PatR
3981e3e6e5 controlling u.ustuck
Setting or clearing u.ustuck now requires that context.botl be set,
so make a new routine to take care of both instead of manipulating
that pointer directly.
2020-02-16 13:04:12 -08:00
Pasi Kallinen
c7ec28f4c7 Fix symset menu
Symset entry index numbers weren't initialized when the symsets were
read from file, making the menu behave erratically. This looks like
a merge mistake.
2020-02-16 21:49:13 +02:00
Pasi Kallinen
f76aba4d7f Prevent segfault in can_blnd 2020-02-16 11:22:18 +02:00
nhmall
f9c9c8262c Guidebook.txt and Files from cron daily 2020-02-16 00:26:43 -05:00
PatR
63c3ec21b8 yet more Guidebook tweaks
A couple of indentation adjustments:  a bit more space for continued
lines in the table for suits of armor, and restore the indentation of
the list of Achievements in the Postscript version (lost when dealing
with the wouldn't-span-page-boundary issue).
2020-02-15 17:44:41 -08:00
PatR
2d150d323b new status conditions
Several conditions result in stale data on the status line when
starting or stopping because things which didn't used to affect it
haven't been setting context.botl to force an update.  This wasn't
systematic; there are bound to be lots more.
2020-02-15 15:41:24 -08:00
PatR
c78a69bc44 Guidebook.dat typo
A typo in Gbk-1pg-sfx.mn resulted in " /" as a "last word" on the
end-of-data marker line of the intermediate 12345 line single page.
That was effectively invisible because it immediately got deleted
during the post-processing which strips off that marker through to
the end (producing a 5266 line single page at present).
2020-02-15 14:42:00 -08:00
PatR
c21921668a fix github issue #293 - raven vs raven
The saying /corvus oculum corvi non eruit/ (Latin) means "a crow
doesn't pluck out the eye of another crow" (roughly).  Something
along the lines of "like-minded people stick together".  Honor the
literal meaning by preventing a raven's blinding attack that gets
directed at another raven from being able to cause blindness.

Fixes #293
2020-02-15 13:55:51 -08:00
PatR
998d8b1fd4 more Guidebook tweaks
Add a missing word to Guidebook.tex and add a couple of new sentences
to both Guidebook.{mn,tex}.

Also, add Guidebook.dat to .gitignore.
2020-02-15 13:08:34 -08:00