Skip to content

Commit

Permalink
Merge branch 'NetHack-3.7' of https://github.com/nethack/nethack into…
Browse files Browse the repository at this point in the history
… 8.0-savebreaking

Merging in nearly a year of vanilla development.

Conflict notes:
- Many of the conflicts were from the following changes:
  - Breakup of struct instance_globals g into alphabetic (???)
    sub-structs.
  - index() and yn() not being available anymore (replacements are
    straightforward)
  - xchar not being available anymore (all xchars have to be coordxys or
    xint8s now; xNetHack actually imported coordxy a little earlier so I
    could write code that wouldn't have to be changed in this merge)
  - Verbose() replacing flags.verbose
  - add_menu now taking a color (all changed lines just added 0/NO_COLOR
    for it)
  - Splitting hmon_hitmon; reconciling these changes was long and complex
    and may have introduced some new bugs.
- Took vanilla's addition of spinach tins to the Monk quest.
- Fixed a minor bug in zap.c where an object class was stored as boolean
  rather than char.
- Took vanilla's implementation of o monsters with poison resistance
  (goblins and hobgoblins don't have it).
- Fixed a bug where difficulty-4 bugbear came before difficulty-3 orc in
  the monster list.
- Took vanilla's implementation of Demonbane. Lost: warning. Gained:
  invoke to banish demons, is now the first sac gift for Priests. It is
  still a lawful silver mace.
- Moved some xNetHack specific definitions from decl.h to hack.h in line
  with the new guidelines for what should be in those files.
- Take vanilla's change in which carrying a lizard corpse no longer has
  any passive protection against cockatrice hissing on new moon.
- Steadfastness immunity to knockback is conferred only by Giantslayer,
  since loadstones have been removed for a while.
- Reject vanilla's anti-magic trap changes (which deal reduced physical
  and Pw damage) in favor of xnethack's which deal Pw and maxPw damage.
- Fix a Y2K warning in makedefs.c preventing compilation with -Wall.
- Drop xNetHack's custom names for room alignment in favor of vanilla's,
  e.g. RM_LEFT -> SPLEV_LEFT. For some reason, vanilla did not prefix
  SPLEV_ on the TOP or BOTTOM constants, so I did.
- Dropped reset_coordinate_system() in favor of reset_xystart_size()
  which does the same thing, but the Lua command is still
  des.reset_coordinate_system().
- Removed the mpickstuff mitem_wanted callbacks in favor of vanilla's
  mon_would_take_item (with modifications to preserve existing xNetHack
  behavior with monsters that know valuable gems and want to take
  magical tools).
- Renamed the variable "leader_is_dead" to vanilla's "killed_leader" (it
  does the same thing, representing whether the leader is dead by any
  means, not that the player personally killed them necessarily).
- Reverted xnh commit daa7d61 by re-adding monmax_difficulty_lev().
  Tired of it causing merge conflicts.
- Took vanilla's implementation of amulet of life saving giving 60-170
  HP depending on Con instead of a flat 100.
- Fixed a bug where experience gained from an exploding bag of holding
  would not actually cause a new experience level to be gained until the
  next time the hero gained experience.
- Took vanilla's reducing the size of the gas clouds on the Plane of
  Fire.
- Took vanilla's (actually my pull request against vanilla's) amount of
  temporary very fast speed granted by the potion of speed -
  (40/100/160)+d10 turns depending on BUC.
- Started adding comments like /* xNetHack ones start here */ to some
  lists or flag constants, where the order of the list items doesn't
  matter, to ensure that the vanilla stuff stays in one blob and the
  xnethack stuff stays in another blob.
- Took vanilla's converting the boolean arguments to newcham into flags.
- Took PatR's iterations on the wand of secret door detection feedback.
- Took one new helltweaks from vanilla: the drawbridge fortress. The
  other helltweaks have been discarded because they're made more for the
  old maze levels which no longer exist here.
- Took vanilla's implementation of "some objects may generate eroded":
  chance of erosionproof decreased from 1/40 to 1/100, recursive chance
  of erosion decreased from 1/40 to 1/80, chance of greased raised from
  1/23263 to 1/1000
- Kept the xNetHack logic of the Astral guardian angel not appearing at
  all if you are petless (vanilla does the old xNetHack logic of it
  appearing but just being peaceful).
- Took vanilla's addition of "themeroom fills" which allow a room of
  arbitrary shape to be specified with a random fill which can be
  applied to an arbitrary room, thus enabling the various shaped rooms
  to contain interesting fills. These have also been added to all the
  xNetHack themed rooms that are just a shape without special terrain or
  contents.
- Took vanilla's implementation of the "buried treasure" themed room:
  rather than an "X" engraving on a random space somewhere in the same
  room, there will be an engraving in a random space anywhere on the
  level indicating the distance to the treasure spot.
- Took the vanilla implementation (actually a patch I submitted) of
  marking fortune-cookie-only rumors with "[cookie]" instead of a
  leading colon.
- Reverted part of commit 2b3883e in which orcs get Skilled in scimitar:
  vanilla's merge of scimitar and saber skills meant that all orcs could
  now use artifact sabers like Grayswandir at Skilled, even if they
  would normally have no skill in it at all (Rangers, Wizards) or low
  skill (Barbarians).
- Revert commit 22c11b7 that changed has_ceiling(d_level*) to
  ceiling_exists(void) because this continues to cause merge conflicts
  with vanilla. has_ceiling is now used everywhere.
- Took the Tutorial branch from vanilla.
- Took vanilla's mpickstuff refactor and discarded the xnh one with
  callback functions.
- Cocytus levels now use the "cold" level flag. (Other gehennom ones
  don't need to specify "hot" because this is assumed as the default
  case in sp_lev.c.)
- Some new Verbose flags are added to cover xNetHack-only uses of
  flags.verbose. Also, the m_move[2-4] ones have turned into
  mon_open_door[1-3] (same values, suppressing verbosity of the same
  messages). This creates some weirdness in the enum because they're
  still sandwiched between m_move1 and m_move5.
- Vanilla's blindness overhaul for roleplay blindness collided with my
  implementation of intrinsic blindness inflicted by dark speech. Both
  used the (HBlinded & FROMOUTSIDE) bit and they are supposed to behave
  differently (namely, dark speech blindness is supposed to be curable
  by several things, but roleplay blindness is NEVER curable - even the
  Eyes of the Overworld only suppress it now while they're worn). To
  keep both behaviors, I took an unused bit from the intrinsic and
  labeled it FROMROLEPLAY - which now controls the vanilla roleplay
  blindness. FROMOUTSIDE remains the xNetHack form of dark speech
  blindness. (Also considered using a long timeout, but that wouldn't
  really have worked - there are too many sources of temporary blindness
  cures that zero its timeout.)
- The vanilla implementation of showing engravings on room and corridor
  tiles is missing a lot of detail compared to xNetHack (namely that
  there is no indication of the type of engraving). Since xNetHack has
  nice tiles for those, I wanted to keep them. The implementation now is
  basically to use the new code paths vanilla set up, but use the
  xNetHack engraving system. S_engroom and S_engrcorr still exist as
  defsyms, but do not actually render in the game. back_to_defsym() is
  also reverted to vanilla.
- Updated the linux-xnh-debug hints file to be based on the latest
  linux.370 hints file.
  • Loading branch information
copperwater committed May 16, 2023
2 parents 1ca6816 + 1800424 commit 3c33ff3
Show file tree
Hide file tree
Showing 545 changed files with 167,482 additions and 34,115 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ win/share/oththin.txt

#libnethack
targets/*
bundle/*
#test.js
#sys/lib/npm-package/build/nethack.js
#sys/lib/npm-package/build/nethack.wasm
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "submodules/pdcurses"]
path = submodules/pdcurses
url = https://github.com/wmcbrine/PDCurses.git
[submodule "submodules/pdcursesmod"]
path = submodules/pdcursesmod
url = https://github.com/Bill-Gray/PDCursesMod.git
61 changes: 33 additions & 28 deletions Cross-compiling
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
Cross-compiling NetHack 3.7 Last edit: December 7, 2020
Cross-compiling NetHack 3.7 Last edit: February 18, 2023

The NetHack 3.7 build process differs from the build process of previous
versions in some important ways that make it possible to use a cross-compiler
running on one platform (the "host" platform of the build) to produce a binary
NetHack package that can execute on an entirely different platform.
versions in some important ways. Those differences make it possible to use
a cross-compiler running on one platform (the "host" platform of the build)
to produce a binary NetHack package that can execute on an entirely different
platform.

Part A Contents:
A1. Why cross-compile?
Expand Down Expand Up @@ -31,13 +32,13 @@ Part B Contents:
By using cross-compilers on host platforms with fast processors, plenty of RAM
and storage resources, and an available cross-compiler, it may be possible to
keep or resurrect a working version of NetHack on platforms that are now too
constrained to carry out the build process natively on the platform any more.
constrained to carry out the build process natively on the platform anymore.

Some of the constraints in carrying out a native build on the desired target
may include, but not necessarily be limited to, any of the following:

o Access: Somebody with a working knowledge of the NetHack build process may
not have the desired target build platform available to them. Conversly,
not have the desired target build platform available to them. Conversely,
somebody with a keen knowledge of the target platform, and access to it,
may not be all that familiar with the NetHack build process.

Expand All @@ -46,8 +47,8 @@ may include, but not necessarily be limited to, any of the following:
compile process on the target platform.

o Compilers: Some of the native compilers on historical platforms may only
support the particular dialect of C that was popular when the platform and
compiler were in their prime.
support the dialect of C that was popular when the platform and compiler
were in their prime.

Another useful potential result of cross-compiling, is that it paves the way
for carrying out test and production builds of NetHack for multiple target
Expand Down Expand Up @@ -127,7 +128,7 @@ steps to be carried out:
several required output files that contain information required by the
game, or contain information about the game during its execution, that
are stored in a portable, platform-independent way, that need to be
inserted into the game package (makedefs -d, -z, -r, -h, -s).
inserted into the game package (makedefs -d, -o, -r, -h, -s).
3. Compile and link several less critical utilities such as uudecode,
tile-generation utilities, and so forth, all of which need to execute
on the build platform during the build process to produce output files
Expand All @@ -139,10 +140,10 @@ steps to be carried out:
NetHack itself, Lua, and any optional regular-expression or window port
libraries that you plan to link into the NetHack game executable.
5. Package the game and its required files including the output from
previous steps 2b, 3 and 4 above.
previous steps 2, 3 and 4 above.

Step 4 is now the only impediment to cross-compiling NetHack, and is resolved
by executing step 4 using a cross-compiler that runs on the build (host)
Step 4 is now the only impediment to cross-compiling NetHack. That impediment
is resolved by executing step 4 using a cross-compiler that runs on the build (host)
platform to produce a resulting binary for the target platform, instead of
executing the native compiler.

Expand All @@ -161,11 +162,11 @@ cross-compiling possible:

o There is no build-time level compiler involved. Instead, the level
descriptions have been converted to Lua and are inserted into the game
package for processing by the embeded Lua during execution of NetHack.
package for processing by the embedded Lua during execution of NetHack.

o There is no build-time dungeon compiler involved. Instead, the dungeon
description has been converted to Lua and is inserted into the game
package for processing by the embeded Lua during execution of NetHack.
package for processing by the embedded Lua during execution of NetHack.

o Some of the build and option information that was formerly produced
during build time by makedefs, and contained information about the
Expand Down Expand Up @@ -242,7 +243,7 @@ You have to:

It should be mentioned that you can execute the cross-compile build approach
to generate binaries for the same platform as the host, where the HOST
compilerand the TARGET compiler are actually one and the same.
compiler and the TARGET compiler are the same.


+------------------------------------------------------+
Expand All @@ -256,6 +257,7 @@ On the HOST, here are the mandatory things that have to be built.
Compile and link the following with these compiler switches:
-DCROSSCOMPILE
from sources: util/makedefs.c, src/mdlib.c, src/monst.c, src/objects.c
src/date.c, src/alloc.c

b) Execute HOST native makedefs utility, util/makedefs, as follows:
Required for complete packaging of the game, but not the C source
Expand All @@ -265,12 +267,6 @@ On the HOST, here are the mandatory things that have to be built.
util/makedefs -h
util/makedefs -s

For reference purposes, but no longer a required prerequisite for the
game compile process:
util/makedefs -v
util/makedefs -o
util/makedefs -p

c) Using the HOST native compiler, build these additional utilities if your
target platform requires components that they produce. It is important
to note that all of the required source files need to be compiled to
Expand Down Expand Up @@ -323,23 +319,29 @@ On the HOST, here are the mandatory things that have to be built.
from sources: win/share/tile2bmp.c, win/share/tiletext.c,
win/share/tilemap.c, src/drawing.c,
src/monst.c, src/objects.c
purpose: <TBD>
purpose: Read win/share/monsters.txt,
win/share/objects.txt and win/share/other.txt
files and produce a .bmp file.

util/gif2txt

from sources: win/share/gifread.c, win/share/tiletext.c,
win/share/tilemap.c, src/drawing.c,
src/monst.c, src/objects.c,
src/alloc.c, util/panic.c
purpose: <TBD>
purpose: Read win/share/monsters.txt,
win/share/objects.txt and win/share/other.txt
files and produce a .gif file.

util/ppmwrite

from sources: win/share/ppmwrite.c, win/share/tiletext.c,
win/share/tilemap.c, src/drawing.c,
src/monst.c, src/objects.c,
src/alloc.c, util/panic.c
purpose: <TBD>
purpose: Read win/share/monsters.txt,
win/share/objects.txt and win/share/other.txt
files and produce a .ppm file.


+--------------------------------------------+
Expand Down Expand Up @@ -407,7 +409,7 @@ Using the cross-compiler, build the following targets:

b) Lua (mandatory in 3.7)

lib/lua-5.4.0/src
lib/lua-5.4.4/src

from sources: lua.c, lapi.c, lauxlib.c, lbaselib.c, lcode.c,
lcorolib.c, lctype.c, ldblib.c, ldebug.c,
Expand All @@ -428,6 +430,7 @@ Using the cross-compiler, build the following targets:
c) Additional optional library packages/obj files as required

lib/pdcurses/...
or lib/pdcursesmod/...

from sources: addch.c, addchstr.c, addstr.c, attr.c, beep.c,
bkgd.c, border.c, clear.c, color.c, delch.c,
Expand All @@ -452,15 +455,18 @@ Using the cross-compiler, build the following targets:
Cross-compiler used: Andrew Wu's djgpp cross-compiler
Cross-compiler url: https://github.com/andrewwutw/build-djgpp
Cross-compiler pre-built binary downloads:
https://github.com/andrewwutw/build-djgpp/releases/download/v3.0/
https://github.com/andrewwutw/build-djgpp/releases

Cross-compiler bits tested:
https://github.com/andrewwutw/build-djgpp
and the pre-built binary for your platform from:
https://github.com/andrewwutw/build-djgpp/releases/download/v3.0/
https://github.com/andrewwutw/build-djgpp/releases
and a DOS-extender (for including in msdos packaging) from
http://sandmann.dotster.com/cwsdpmi/csdpmi7b.zip
and pdcurses from:
https://github.com/wmcbrine/PDCurses.git
or pdcursesmod from:
https://github.com/Bill-Gray/PDCursesMod.git

- A shell script to download that djgpp cross-compiler and associated
pieces for either linux or macOS is available:
Expand Down Expand Up @@ -496,7 +502,6 @@ Cross-compiler pre-built binary downloads:
You can explicitly include tty and curses support if desired. The default
you'll end up with is a tty-only cross-compile build:

make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 all
make WANT_WIN_TTY=1 WANT_WIN_CURSES=1 CROSS_TO_MSDOS=1 package

Result: The "make package" target will bundle all of the necessary
Expand Down
7 changes: 7 additions & 0 deletions DEVEL/code_style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,13 @@ wrapped in an additional set of parentheses for clarity:
/* body */
}

Variable names to avoid
-----------------------

near, far Some compilers and cross-compilers that target old
processors with segmented architectures may treat
those as keywords. It is safest to just avoid them.

Spaces in Expressions
---------------------

Expand Down
Loading

0 comments on commit 3c33ff3

Please sign in to comment.