Commit Graph

1987 Commits

Author SHA1 Message Date
nhmall
2a2021d5e4 use the copyright statement provided by the Lua distribution in lua.h 2019-11-30 18:43:57 -05:00
nhmall
c5babb0de1 instance_globals update to include lua_ver storage 2019-11-30 17:24:11 -05:00
nhmall
7031b6b504 get lua version from lua itself 2019-11-30 17:23:14 -05:00
nhmall
3a84bff7f3 Merge branch 'NetHack-3.6' 2019-11-30 15:41:52 -05:00
nhmall
42a13a1198 has_color() performance fixes
Performance profiling showed that multiple strcmpi() calls were
occurring each and every time a character was going to the map.

This update:
- honors the WC_COLOR capability
- It allows a window-port to control individual color availability should the window-port wish to do so.
- Makes checking on the individual colors for the active window-port is a straightforward table lookup at the CLR_ offset.

iflags.use_color remains a master on/off switch for use of color, regardless of the capability
compiled into the game (default TRUE).

The has_color() routine, which is now a shared routine in src/windows.c, could likely be made
into a simple macro to eliminate the function call, but this update does not go that far.

This hits a lot of port files due to the window-port interface change, mostly cookie-cutter.
2019-11-30 11:44:07 -05:00
nhmall
e13e166620 get rid of LUA_INTCAST defines 2019-11-29 17:40:58 -05:00
nhmall
8cd73c8cc9 Merge branch 'NetHack-3.6' 2019-11-29 16:57:23 -05:00
nhmall
fd7d0f5d52 more things considered when you're on the brink 2019-11-29 11:14:55 -05:00
PatR
adc455129d 3.7: goldX and other stuff
Move option variable goldX (True: treat gold as BUC unknown, False:
treat gold as uncursed during BUCX filtering) from iflags to flags
so that it persists across save/restore.

Get rid of a few obsolete things from struct flags.

Try to make the 'cursesgraphics' option work although I don't think
that it was ever functional enough for anybody to use so probably
could have been removed instead.

Bump EDITLEVEL; any current save files are invalid.

Demote status from Beta to Work-in-Progress.

I modified src/sfdata.c manually (not included here) to get a full
build.  The Unix Makefile.src needs to be taught when and how to
regenerate it.
2019-11-28 15:00:54 -08:00
nhmall
11ec453329 Merge branch 'NetHack-3.7' 2019-11-27 23:07:50 -05:00
nhmall
5847806104 Merge branch 'NetHack-3.6' 2019-11-27 23:07:29 -05:00
nhmall
566019e588 return struct fields borrowed in 3.6
This will break existing 3.7 save/bones.
2019-11-27 20:18:45 -05:00
PatR
7ca572eb60 paranoid_confirmation:eating
Add 'eating' (synonym 'continue') to the list of things that can be
set via paranoid_confirmation to require "yes" instead of "y" when
the user is prompted about something, in this case "Continue eating?".

dat/opthelp was missing a few of the paranoid_confirmation choices.
2019-11-27 16:27:13 -08:00
nhmall
719c8f5f5f Merge branch 'NetHack-3.6' 2019-11-27 13:36:12 -05:00
PatR
cc3152dc9a ignore 3.7 file if present 2019-11-27 09:53:40 -08:00
nhmall
5a1e523887 Merge branch 'NetHack-3.7' 2019-11-27 01:27:39 -05:00
nhmall
5d5d8069d4 Merge branch 'NetHack-3.6' 2019-11-27 01:27:11 -05:00
PatR
865607a392 3.7 Unix Makefiles
Copy lib/lua-$(VERSION)/src/liblua.h to lib/lua/ rather than lib/.

Instead of copying any of the header files or telling the compiler
where to find the lua ones, generate include/nhlua.h on the fly and
restrict the knowledge of where they are to it (paths are relative
to include/).

|/* nhlua.h - generated by top Makefile */
|#include "../lib/lua-5.3.5/src/lua.h"
|LUA_API int   (lua_error) (lua_State *L) NORETURN;
|#include "../lib/lua-5.3.5/src/lualib.h"
|#include "../lib/lua-5.3.5/src/lauxlib.h"
|/*nhlua.h*/

This might need to be redone (or augmented by having CFLAGS add back
'-I path-to-lua') if some compiler can't find '#include "luaconf.h"'
issued by lua.h.
2019-11-26 19:27:00 -08:00
PatR
3130676077 alignment of mimicked or polymorphed altars
A reddit thread about an unaligned altar in an aligned temple was
a tipoff that mimics posing as altars didn't have any particular
alignment.  The look-at code was misusing an operloaded field of the
underlying terrain.  Pick an alignment at random when taking on the
appearance of an altar, store it in the mimic's mon->mextra->mcorpsenm
field, and have look-at use that.

Also, dropping a ring of polymorph into a sink can transform it, and
one possible outcome is an altar.  In this case, the alignment is
part of the location's topology, but code setting that up was using
Align2amask(rn2(foo)).  That's a macro which evaluates its argument
more than once.  The first evaluation was effectively a no-op.  If
the second evaluation picked lawful then the result was lawful as
intended.  But if the second picked non-lawful and the third picked
lawful, the result would end up as none-of-the-above (a value of 3
when it needs to be a single-bit mask of 1, 2, or 4).
2019-11-25 15:01:40 -08:00
Pasi Kallinen
ddd8b7d9a5 Remove vestiges of quest text data file 2019-11-25 16:30:54 +02:00
nhmall
d830f3578a Merge branch 'NetHack-3.7' into paxed-quest-lua 2019-11-24 23:11:30 -05:00
PatR
9adeff5e27 3.7: fix #9397 - pronouns when hallucinating
Developed for 3.6 but deferred to 3.7.  Most of the testing was with
the earlier incarnation.

Report was that pronouns were accurate for the underlying monsters
when hallucination was describing something random, and also that the
gender prefix flag from bogusmon.txt wasn't being used.  The latter
is still the case, but pronouns are now chosen at random while under
the influence of hallucination.  One of the choices is plural and an
attempt is made to make the monster name and verb fit that usage.

|The homunculus picks up a wand of speed monster.
|The large cats zap themselves with a wand of speed monster!
|The blue dragon is suddenly moving faster.

There is no attempt to match gender for the singular cases; you might
get
|The succubus zaps himself [...]
or
|The incubus zaps herself [...]
2019-11-24 18:29:14 -08:00
PatR
8f5cca8e3d 3.7 build cleanup
Unix Makefile.utl wasn't aware of the dependency of makedefs.o on
src/mdlib.c so didn't rebuild makedefs when it should have.

Eliminate several warnings:
mdlib.c  - #if inside the arguments to macro Sprintf();
nhlua.c  - nhl_error() ends with a call to lua_error() which doesn't
           return, but neither of them were declared that way;
nhlsel.c - because of the previous, the 'else error' case of
           l_selection_ellipse() led to complaints about uninitialized
	   variables;
sp_lev.c - missing 'const'.

I did minimal testing which went ok, but revisiting a couple of levels
gave me un-freed memory allocated by restore.c line 1337.  (I haven't
looked at that at all.)
2019-11-24 17:56:01 -08:00
nhmall
2a187c47c7 more warnings 2019-11-24 18:01:48 -05:00
Pasi Kallinen
8b87013fba Move quest texts to lua 2019-11-24 17:41:39 +02:00
nhmall
ac315adaf1 Revert "attempt to avoid questpgr convert woes on cross-compile by making the int sizes fixed"
This reverts commit b8a6d82c57.
2019-11-24 00:40:00 -05:00
nhmall
b8a6d82c57 attempt to avoid questpgr convert woes on cross-compile by making the int sizes fixed 2019-11-24 00:11:26 -05:00
nhmall
1e0c03b3f6 incremental improvements to cross-compiling support in NetHack 3.7
Some support of new code #defines to faciliate cross-compiling:

    OPTIONS_AT_RUNTIME    If this is defined, code to support obtaining
                          the compile time options and features is
                          included. If you define this, you'll also have
                          to compile sys/mdlib.c and link the resulting
                          object file into your game binary/executable.

    CROSSCOMPILE          Flags that this is a cross-compiled NetHack build,
                          where there are two stages:
                          1. makedefs and some other utilities are compiled
                          on the host platform and executed there to generate
                          some output files and header files needed by the
                          game.
                          2. the NetHack game files are compiled by a
                          cross-compiler to generate binary/executables for
                          a different platform than the one the build is
                          being run on. The executables produced for the
                          target platform may not be able to execute on the
                          build platform, except perhaps via a software
                          emulator.

                          The 2-stage process (1. host, 2.target) can be done
                          on the same platform to test the cross-compile
                          process. In that case, the host and target platforms
                          would be the same.

    CROSSCOMPILE_HOST     Separates/identifies code paths that should only be
                          be included in the compile on the host side, for
                          utilities that will be run on the host as part of
                          stage 1 to produce output files needed to build the
                          game. Examples are the code for makedefs, tile
                          conversion utilities, uudecode, dlb, etc.

    CROSSCOMPILE_TARGET   Separates/identifies code paths that should be
                          included on the build for the target platform
                          during stage 2, the cross-compiler stage. That
                          includes most of the pieces of the game itself
                          but the code is only flagged as such if it must
                          not execute on the host.

If you don't define any of those, things should build as before.
One follow-on change that is likely required is setting the new dependency
makedefs has on src/mdlib.c in Makefiles etc.

More information about the changes:

    makedefs

    - splinter off some of makedefs functionality into a separate file
      called src/mdlib.c.
        - src/mdlib.c, while included during the compile of makedefs.c
          for producing the makedefs utility, can also be compiled
          as a stand-alone object file for inclusion in the link step
          of your NetHack game build. The src/mdlib.c code can then
          deliver the same functionality that it provided to makedefs
          right to your NetHack game code at run-time.
          For example, do_runtime_info() will provide the caller with
          the features and options that were built into the game.
          Previously, that information was produced at build time on the
          host and stored in a dat file. Under a cross-compile situation,
          those values are highly suspect and might not even reflect the
          correct options and setting for the cross-compiled target
          platform's binary/executable. The compile of those values and
          the functionality to obtain them needs to move to the target
          cross-compiler stage of the build (stage 2).
        - date information on the target-side binary is produced from
          the cross-compiler preprocessor pre-defined macros __DATE__
          and __TIME__, as they reflect the actual compile time of the
          cross-compiled target and not host-side execution of a utility
          to produce them. The cross-compiler itself, through those
          pre-defined preprocessor macros, provides them to the target
          platform binary/executable. They reflect the actual build
          time of the target binary/executable (not values produced
          at the time the makefiles utility was built and the
          appropriate option selected to store them in a text file.)
        - most Makefiles should not require adding the new file
          src/mdlib.c because util/makedefs.c has a preprocessor
          include "../src/mdlib.c" to draw in its contents. As previously
          stated though, the Makefile dependency may be required:
		makedefs.o: ../util/makedefs.c ../src/mdlib.c
                                               ^^^^^^^^^^^^^^^
2019-11-22 22:35:48 -05:00
nhmall
3545374e9c internal self-recover fix and bones name buffers 2019-11-21 23:41:11 -05:00
nhmall
bb2185203f Merge branch 'NetHack-3.6' 2019-11-17 20:31:56 -05:00
nhmall
e85646816c mark source tree as beta, previously marked work-in-progress 2019-11-17 20:06:21 -05:00
nhmall
57584a22d7 add some guard code to the Is_*_level macros in dungeon.h
All Is_*_level tests during early startup would test as true until
dungeon_topology was initialized in a new game or restored from
a save file. That could result in some unexpected code paths being
taken.
2019-11-17 19:13:23 -05:00
nhmall
5f3398347c Merge branch 'NetHack-3.6' 2019-11-16 23:14:34 -05:00
nhmall
a364348098 add an mgflags parameter to mapglyph() to alter how it behaves internally
avoid a recent save-value,call,restore-value kludge by adding
an mgflags parameter to mapglyph() to control its behavior

 Changes to be committed:
	modified:   doc/window.doc
	modified:   include/extern.h
	modified:   include/hack.h
	modified:   src/detect.c
	modified:   src/mapglyph.c
	modified:   src/pager.c
	modified:   sys/amiga/winfuncs.c
	modified:   sys/wince/mhmap.c
	modified:   win/Qt/qt_win.cpp
	modified:   win/Qt4/qt4map.cpp
	modified:   win/X11/winmap.c
	modified:   win/curses/cursdial.c
	modified:   win/curses/cursinvt.c
	modified:   win/curses/cursmain.c
	modified:   win/gem/wingem.c
	modified:   win/tty/wintty.c
	modified:   win/win32/mhmap.c
	modified:   win/win32/mswproc.c
2019-11-16 22:49:36 -05:00
nhmall
18f6af1466 Merge branch 'NetHack-3.6' 2019-11-16 18:27:50 -05:00
PatR
2a07924063 rename S_player_override to S_hero_override 2019-11-16 14:31:57 -08:00
nhmall
6aef1f13a1 Merge branch 'NetHack-3.6' 2019-11-16 17:09:44 -05:00
PatR
2a50fb1845 place_monster() debugging
Show more information if place_monster() detects something wrong.
I don't know whether it will actually be useful.
2019-11-16 13:42:25 -08:00
nhmall
bfb278fd38 Merge branch 'NetHack-3.7' 2019-11-15 22:23:55 -05:00
nhmall
29d378116e fix unplanned perm change 2019-11-15 22:22:19 -05:00
nhmall
4e05c874bf Merge branch 'NetHack-3.7' 2019-11-15 22:13:00 -05:00
nhmall
b0d8e86c8c Merge branch 'NetHack-3.6' 2019-11-15 22:12:12 -05:00
nhmall
298af2294f quiet some macosx warnings 2019-11-15 21:20:38 -05:00
PatR
ae415589e9 have --showpaths show DUMPLOG file
While not a path exactly, the dumplog file isn't placed somewhere
fixed so being able to see where it is placed could be useful.

This cascaded a bit during testing.  Fix one of the warnings from
hardfought (fqn_prefix_names[]).  And a few more that came up with
SYSCF disabled (panictrace_gdb, two unused variables if files.c).
2019-11-15 17:51:20 -08:00
nhmall
d2128968fa Merge branch 'NetHack-3.7' into paxed-lua-v2-merged 2019-11-14 19:50:20 -05:00
nhmall
6c97b0f9a1 Merge branch 'NetHack-3.6' 2019-11-14 19:48:57 -05:00
PatR
f3a923d647 fix #H1554, #H1736, github issue #240 - silver )
Fixes #240

Monster versus monster (melee and throwing) didn't handle shades
(need silver or blessed weapon to take damage) or silver feedback
(extra info when silver-haters are hit).

I did a lot of test, revise, re-test but didn't always re-test
everything that had previously been tested, so bugs that I thought
were quashed might have crept in.

Now if a missile weapon "passes harmlessly through the shade" it
will continue on and maybe hit something else.  (Regular misses
still stop at the missed target.)

A couple of minor ball&chain changes accidentally got included.
2019-11-13 15:47:46 -08:00
nhmall
bc0d78138f some, but not all, vms issues fixed 2019-11-12 19:58:48 -05:00
nhmall
3bc26e6c65 Merge branch 'NetHack-3.7' into paxed-lua-v2-merged 2019-11-11 14:33:31 -05:00
nhmall
900a826e8e Merge branch 'NetHack-3.6' 2019-11-11 14:32:09 -05:00