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.
This commit is contained in:
Pasi Kallinen
2019-05-10 21:11:50 +03:00
parent 3e029d2900
commit fd55d9118e
189 changed files with 16653 additions and 27346 deletions

View File

@@ -417,12 +417,9 @@ E struct restore_info restoreinfo;
E NEARDATA struct savefile_info sfcap, sfrestinfo, sfsaveinfo;
struct opvar {
xchar spovartyp; /* one of SPOVAR_foo */
union {
char *str;
long l;
} vardata;
struct selectionvar {
int wid, hei;
char *map;
};
struct autopickup_exception {
@@ -867,7 +864,7 @@ struct instance_globals {
d_level save_dlevel;
/* do_name.c */
struct opvar *gloc_filter_map;
struct selectionvar *gloc_filter_map;
int gloc_filter_floodfill_match_glyph;
int via_naming;
@@ -1178,6 +1175,7 @@ struct instance_globals {
int num_lregions;
/* positions touched by level elements explicitly defined in the des-file */
char SpLev_Map[COLNO][ROWNO];
struct sp_coder *coder;
xchar xstart, ystart;
char xsize, ysize;
boolean splev_init_present;
@@ -1187,7 +1185,6 @@ struct instance_globals {
struct obj *container_obj[MAX_CONTAINMENT];
int container_idx;
struct monst *invent_carrying_monster;
aligntyp ralign[3];
/* spells.c */
int spl_sortmode; /* index into spl_sortchoices[] */