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

@@ -1,5 +1,5 @@
# NetHack 3.6 Makefile.GCC $NHDT-Date: 1519600525 2018/02/25 23:15:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.34 $
# Copyright (c) NetHack PC Development Team 1996-2006.
# Copyright (c) NetHack PC Development Team 1996-2019.
# PC NetHack 3.6 Makefile for djgpp V2
#
# Gnu gcc compiler for msdos (djgpp)
@@ -25,6 +25,28 @@ GAME = nethack
# The GNU Make has a problem if you include a drive spec below (unfortunately).
GAMEDIR =../binary
# Optional PDCurses support
# Uncomment these and set them appropriately if you want to
# include curses port support alongside TTY support in your
# NetHack.exe binary.
#
# You'll have to set PDCURSES_H to the correct location of the
# PDCurses header (.h) files and PDCURSES_C to the location
# of your PDCurses C files which must already be resident on
# your machine.
#
ADD_CURSES=Y
PDCURSES_TOP=../../pdcurses
#---------------------------------------------------------------
# Location of LUA
ADD_LUA=Y
LUATOP=../../lua-535
#
#==============================================================================
# This marks the end of the BUILD DECISIONS section.
#==============================================================================
#
# Directories, gcc likes unix style directory specs
#
@@ -38,6 +60,7 @@ SRC = ../src
SSHR = ../sys/share
UTIL = ../util
WIN = ../win/tty
WCURSES = ../win/curses
WSHR = ../win/share
#
@@ -67,7 +90,8 @@ LIBRARIES = $(LIBS) $(TERMLIB)
# If you have yacc/lex or a work-alike set YACC_LEX to Y
#
YACC_LEX = N
ifeq ($(YACC_LEX),Y)
ifeq "$(YACC_LEX)" "Y"
DO_YACC = YACC_ACT
DO_LEX = LEX_ACT
endif
@@ -138,97 +162,39 @@ SUPPRESS_GRAPHICS =
GAMEFILE = $(GAMEDIR)/$(GAME).exe
# Changing this conditional block is not recommended
ifeq ($(USE_DLB),Y)
ifeq "$(USE_DLB)" "Y"
DLBFLG = -DDLB
else
DLBFLG =
endif
#
# Flags.
#
ifeq ($(SUPPRESS_GRAPHICS),Y)
TERMLIB =
# Build NetHack suitable for blind players
# Debugging
#cflags = -pg -c -I../include $(DLBFLG) -DSUPPRESS_GRAPHICS
#LFLAGS = -pg
cflags = -c -O -I../include $(DLBFLG) -DSUPPRESS_GRAPHICS
LFLAGS =
else
# Debugging
#cflags = -g -c -I../include $(DLBFLG) -DUSE_TILES
#LFLAGS = -g
# Normal
cflags = -c -O -I../include $(DLBFLG) -DUSE_TILES
LFLAGS =
endif
#==========================================
#================ RULES ==================
#==========================================
.SUFFIXES: .exe .o .til .uu .c .y .l
#==========================================
# Rules for files in src
#==========================================
$(OBJ)/%.o : /%.c
$(CC) $(cflags) -o$@ $<
$(OBJ)/%.o : $(SRC)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
# Rules for files in sys/share
#==========================================
$(OBJ)/%.o : $(SSHR)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
# Rules for files in sys/msdos
#==========================================
$(OBJ)/%.o : $(MSYS)/%.c
$(CC) $(cflags) -I../sys/msdos -o$@ $<
#==========================================
# Rules for files in util
#==========================================
$(OBJ)/%.o : $(UTIL)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
# Rules for files in win/share
#==========================================
$(OBJ)/%.o : $(WSHR)/%.c
$(CC) $(cflags) -I../win/share -o$@ $<
#{$(WSHR)}.txt{$(DAT)}.txt:
# copy $< $@
#==========================================
# Rules for files in win/tty
#==========================================
$(OBJ)/%.o : $(TTY)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
#================ MACROS ==================
#==========================================
# This section creates shorthand macros for many objects
# referenced later on in the Makefile.
#
# Have windows path styles available for use in commands
#
W_OBJ =$(subst /,\, $(OBJ))
W_INCL =$(subst /,\, $(INCL))
W_DAT =$(subst /,\, $(DAT))
W_DOC =$(subst /,\, $(DOC))
W_UTIL =$(subst /,\, $(UTIL))
W_SRC =$(subst /,\, $(SRC))
W_SSYS =$(subst /,\, $(SSYS))
W_MSWSYS =$(subst /,\, $(MSWSYS))
W_TTY =$(subst /,\, $(TTY))
W_MSWIN =$(subst /,\, $(MSWIN))
ifeq "$(ADD_CURSES)" "Y"
W_WCURSES =$(subst /,\, $(WCURSES))
endif
W_WSHR =$(subst /,\, $(WSHR))
W_GAMEDIR =$(subst /,\, $(GAMEDIR))
#
# Shorten up the location for some files
#
@@ -245,15 +211,19 @@ VGAOBJ = $(O)vidvga.o $(O)vidvesa.o
MAKESRC = makedefs.c
ifneq "$(ADD_LUA)" "Y"
SPLEVSRC = lev_yacc.c lev_$(LEX).c lev_main.c panic.c
endif
DGNCOMPSRC = dgn_yacc.c dgn_$(LEX).c dgn_main.c
MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o
MAKEDEFSOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o
ifneq "$(ADD_LUA)" "Y"
SPLEVOBJS = $(O)lev_yacc.o $(O)lev_$(LEX).o $(O)lev_main.o $(O)alloc.o \
$(O)monst.o $(O)objects.o $(O)panic.o \
$(O)drawing.o $(O)decl.o $(O)stubvid.o
endif
DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_$(LEX).o $(O)dgn_main.o $(O)alloc.o \
$(O)panic.o
@@ -339,21 +309,97 @@ VOBJ19 = $(O)trap.o $(O)u_init.o $(O)uhitm.o $(O)vault.o $(O)vision.o
VOBJ20 = $(O)vis_tab.o $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows.o
VOBJ21 = $(O)wintty.o $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o
VOBJ22 = $(O)zap.o $(O)light.o $(O)dlb.o $(O)dig.o $(O)teleport.o
VOBJ23 = $(O)region.o $(O)sys.o $(REGEX)
VOBJ23 = $(O)region.o $(O)sys.o $(REGEX) $(O)isaac64.o
VOBJ24 = $(O)sfbase.o $(O)sfdata.o
VOBJ25 = $(O)sfstruct.o $(O)sfascii.o $(O)sflendian.o
SOBJ = $(O)msdos.o $(O)pcsys.o $(O)tty.o $(O)unix.o \
$(O)video.o $(O)vidtxt.o $(O)pckeys.o
VVOBJ = $(O)version.o
ifeq "$(ADD_LUA)" "Y"
LUAOBJ = $(O)nhlua.o $(O)nhlsel.o
endif
ifeq "$(ADD_CURSES)" "Y"
CURSESOBJ= $(O)cursdial.o $(O)cursinit.o $(O)cursinvt.o $(O)cursmain.o \
$(O)cursmesg.o $(O)cursmisc.o $(O)cursstat.o $(O)curswins.o
else
CURSESOBJ=
endif
VOBJ = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
$(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \
$(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \
$(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
$(VOBJ21) $(VOBJ22) $(VOBJ23)
$(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \
$(CURSESOBJ) $(LUAOBJ)
ALLOBJ = $(VOBJ) $(SOBJ) $(TILOBJ) $(TILOBJ2) $(VVOBJ)
ifeq "$(ADD_LUA)" "Y"
#===============-=================================================
# LUA library
# Source from http://www.lua.org/ftp/lua-5.3.5.tar.gz
#=================================================================
LUASRC = $(LUATOP)/src
LUALIB = $(O)lua535s.a
LUADLL = $(O)lua535.a
LUAINCL = -I$(LUASRC)
#LUAFLAGS = unix added -lm here?
LUATARGETS = lua.exe luac.exe $(LUADLL) $(LUALIB)
LUASRCFILES = lapi.c lauxlib.c lbaselib.c lbitlib.c lcode.c \
lcorolib.c lctype.c ldblib.c ldebug.c ldo.c \
ldump.c lfunc.c lgc.c linit.c liolib.c llex.c \
lmathlib.c lmem.c loadlib.c lobject.c lopcodes.c \
loslib.c lparser.c lstate.c lstring.c lstrlib.c \
ltable.c ltablib.c ltm.c lundump.c lutf8lib.c \
lvm.c lzio.c
LUAOBJFILES = $(O)lapi.o $(O)lauxlib.o $(O)lbaselib.o $(O)lbitlib.o \
$(O)lcode.o $(O)lcorolib.o $(O)lctype.o $(O)ldblib.o \
$(O)ldebug.o $(O)ldo.o $(O)ldump.o $(O)lfunc.o \
$(O)lgc.o $(O)linit.o $(O)liolib.o $(O)llex.o \
$(O)lmathlib.o $(O)lmem.o $(O)loadlib.o $(O)lobject.o \
$(O)lopcodes.o $(O)loslib.o $(O)lparser.o $(O)lstate.o \
$(O)lstring.o $(O)lstrlib.o $(O)ltable.o $(O)ltablib.o \
$(O)ltm.o $(O)lundump.o $(O)lutf8lib.o $(O)lvm.o $(O)lzio.o
endif
ifeq "$(ADD_CURSES)" "Y"
#==========================================
# PDCurses build macros
#==========================================
PDCURSES_CURSES_H = $(PDCURSES_TOP)/curses.h
PDCURSES_CURSPRIV_H = $(PDCURSES_TOP)/curspriv.h
PDCURSES_HEADERS = $(PDCURSES_CURSES_H) $(PDCURSES_CURSPRIV_H)
PDCSRC = $(PDCURSES_TOP)/pdcurses
PDCDOS = $(PDCURSES_TOP)/dos
PDCLIBOBJS = $(O)addch.o $(O)addchstr.o $(O)addstr.o $(O)attr.o $(O)beep.o \
$(O)bkgd.o $(O)border.o $(O)clear.o $(O)color.o $(O)delch.o $(O)deleteln.o \
$(O)getch.o $(O)getstr.o $(O)getyx.o $(O)inch.o $(O)inchstr.o \
$(O)initscr.o $(O)inopts.o $(O)insch.o $(O)insstr.o $(O)instr.o $(O)kernel.o \
$(O)keyname.o $(O)mouse.o $(O)move.o $(O)outopts.o $(O)overlay.o $(O)pad.o \
$(O)panel.o $(O)printw.o $(O)refresh.o $(O)scanw.o $(O)scr_dump.o $(O)scroll.o \
$(O)slk.o $(O)termattr.o $(O)touch.o $(O)util.o $(O)window.o \
$(O)debug.o
PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o \
$(O)pdcscrn.o $(O)pdcsetsc.o $(O)pdcutil.o
#PDCOBJS = $(O)pdcclip.o $(O)pdcdisp.o $(O)pdcgetsc.o $(O)pdckbd.o $(O)pdcscrn.o \
# $(O)pdcsetsc.o $(O)pdcutil.o
PDCLIB = $(O)pdcurses.a
PDCINCL = -I$(PDCURSES_TOP) -I$(PDCSRC) -I$(PDCDOS)
else
PDCLIB =
endif
#==========================================
# Header file macros
#==========================================
@@ -410,6 +456,117 @@ DJ1 = $(dir $(DJGPP))
CWSDPMI = $(subst /,\,$(DJ1))bin\CWSDPMI.*
endif
#==========================================
# More compiler setup macros
#==========================================
#
ifeq "$(ADD_CURSES)" "Y"
CURSESDEF=-D"CURSES_GRAPHICS" -D"CURSES_BRIEF_INCLUDE"
else
CURSESDEF=
CURSESLIB=
endif
INCLDIR=-I../include -I../sys/msdos $(LUAINCL)
# Debugging
#cflags = -pg -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
#LFLAGS = -pg
cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DSUPPRESS_GRAPHICS
LFLAGS =
# Debugging
#cflags = -g -c $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES
#LFLAGS = -g
# Normal
cflags = -c -O $(INCLDIR) $(DLBFLG) $(CURSESDEF) -DUSE_TILES
LFLAGS =
#==========================================
#================ RULES ==================
#==========================================
.SUFFIXES: .exe .o .til .uu .c .y .l
#==========================================
# Rules for files in src
#==========================================
$(OBJ)/%.o : /%.c
$(CC) $(cflags) -o$@ $<
$(OBJ)/%.o : $(SRC)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
# Rules for files in sys/share
#==========================================
$(OBJ)/%.o : $(SSHR)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
# Rules for files in sys/msdos
#==========================================
$(OBJ)/%.o : $(MSYS)/%.c
$(CC) $(cflags) -I../sys/msdos -o$@ $<
#==========================================
# Rules for files in util
#==========================================
$(OBJ)/%.o : $(UTIL)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
# Rules for files in win/share
#==========================================
$(OBJ)/%.o : $(WSHR)/%.c
$(CC) $(cflags) -I../win/share -o$@ $<
#{$(WSHR)}.txt{$(DAT)}.txt:
# copy $< $@
#==========================================
# Rules for files in win/tty
#==========================================
$(OBJ)/%.o : $(TTY)/%.c
$(CC) $(cflags) -o$@ $<
#==========================================
# Rules for files in win/curses
#==========================================
$(OBJ)/%.o : $(WCURSES)/%.c
$(CC) -DPDC_NCMOUSE $(PDCINCL) $(cflags) -o$@ $<
#==========================================
# Rules for files in PDCurses
#==========================================
$(OBJ)/%.o : $(PDCURSES_TOP)/%.c
$(CC) $(PDCINCL) $(cflags) -o$@ $<
$(OBJ)/%.o : $(PDCSRC)/%.c
$(CC) $(PDCINCL) $(cflags) -o$@ $<
$(OBJ)/%.o : $(PDCDOS)/%.c
$(CC) $(PDCINCL) $(cflags) -o$@ $<
ifeq "$(ADD_LUA)" "Y"
#==========================================
# Rules for LUA files
#==========================================
$(OBJ)/%.o : $(LUASRC)/%.c
$(CC) $(cflags) -o$@ $<
endif
#==========================================
# Primary Targets.
#==========================================
@@ -425,9 +582,14 @@ default: $(GAMEFILE)
util: $(O)utility.tag
$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \
$(INCL)/pm.h monstr.c vis_tab.c \
$(U)lev_comp.exe $(U)dgn_comp.exe $(TILEUTIL)
ifneq "$(ADD_LUA)" "Y"
LEVCOMPEXE = $(U)lev_comp.exe
else
LEVCOMPEXE =
endif
$(O)utility.tag: $(INCL)/date.h $(INCL)/trap.h $(INCL)/onames.h \
$(INCL)/pm.h monstr.c vis_tab.c $(LEVCOMPEXE) \
$(U)dgn_comp.exe $(TILEUTIL)
$(subst /,\,echo utilities made > $@)
tileutil: $(U)gif2txt.exe $(U)txt2ppm.exe
@@ -444,7 +606,11 @@ ifeq ($(USE_DLB),Y)
else
@$(subst /,\,copy $(DAT)/*. $(GAMEDIR))
@$(subst /,\,copy $(DAT)/*.dat $(GAMEDIR))
ifeq "$(ADD_LUA)" "Y"
@$(subst /,\,copy $(DAT)/*.lua $(GAMEDIR))
else
@$(subst /,\,copy $(DAT)/*.lev $(GAMEDIR))
endif
@$(subst /,\,copy $(MSYS)/msdoshlp.txt $(GAMEDIR))
@$(subst /,\,if exist $(GAMEDIR)/makefile. del $(GAMEDIR)/makefile.)
endif
@@ -455,7 +621,7 @@ endif
@$(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR))
@$(subst /,\,copy $(SSHR)/NetHack.cnf $(GAMEDIR)/defaults.nh)
-@$(subst /,\,touch $(GAMEDIR)/record)
@$(subst /,\,copy $(DOC)/guidebo*.txt $(GAMEDIR))
@$(subst /,\,copy $(DOC)/guideb*.txt $(GAMEDIR))
@$(subst /,\,copy ../sys/winnt/sysconf $(GAMEDIR))
@$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR))
ifdef CWSDPMI
@@ -469,7 +635,8 @@ endif
# The main target.
#==========================================
$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk
$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(PDCLIB) $(LUATARGETS) \
$(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk
@if exist temp.a del temp.a
@ar ru temp.a $(VOBJ01)
@ar ru temp.a $(VOBJ02)
@@ -494,11 +661,20 @@ $(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk
@ar ru temp.a $(VOBJ21)
@ar ru temp.a $(VOBJ22)
@ar ru temp.a $(VOBJ23)
@ar ru temp.a $(VOBJ24)
@ar ru temp.a $(VOBJ25)
@ar ru temp.a $(SOBJ)
@ar ru temp.a $(TILOBJ)
@ar ru temp.a $(TILOBJ2)
@ar ru temp.a $(VVOBJ)
$(LINK) $(LFLAGS) -o$(GAME).exe temp.a $(LIBRARIES) $(ZLIB)
ifeq "$(ADD_LUA)" "Y"
@ar ru temp.a $(LUAOBJ)
endif
ifeq "$(ADD_CURSES)" "Y"
@ar ru temp.a $(CURSESOBJ)
endif
$(LINK) $(LFLAGS) -o$(GAME).exe temp.a \
$(PDCLIB) $(LUALIB) $(LIBRARIES) $(ZLIB)
@$(subst /,\,stubedit $(GAME).exe minstack=2048K)
@$(subst /,\,copy $(GAME).exe $(GAMEFILE))
@$(subst /,\,del $(GAME).exe)
@@ -527,86 +703,18 @@ $(O)$(GAME).lnk: $(ALLOBJ)
echo $(VOBJ21) >> $(subst /,\,$@)
echo $(VOBJ22) >> $(subst /,\,$@)
echo $(VOBJ23) >> $(subst /,\,$@)
echo $(VOBJ24) >> $(subst /,\,$@)
echo $(VOBJ25) >> $(subst /,\,$@)
echo $(SOBJ) >> $(subst /,\,$@)
echo $(TILOBJ) >> $(subst /,\,$@)
echo $(TILOBJ2) >> $(subst /,\,$@)
echo $(VVOBJ) >> $(subst /,\,$@)
#==========================================
# Housekeeping.
#==========================================
clean:
$(subst /,\,if exist $(O)*.o del $(O)*.o)
$(subst /,\,if exist $(O)dat.tag del $(O)dat.tag)
$(subst /,\,if exist $(O)install.tag del $(O)install.tag)
$(subst /,\,if exist $(O)$(GAME).lnk del $(O)$(GAME).lnk)
$(subst /,\,if exist $(O)obj.tag del $(O)obj.tag)
$(subst /,\,if exist $(O)sp_lev.tag del $(O)sp_lev.tag)
$(subst /,\,if exist $(O)thintile.tag del $(O)thintile.tag)
$(subst /,\,if exist $(O)utility.tag del $(O)utility.tag)
$(subst /,\,if exist temp.a del temp.a)
spotless: clean
$(subst /,\,if exist $(U)lev_flex.c del $(U)lev_flex.c)
$(subst /,\,if exist $(U)lev_lex.c del $(U)lev_lex.c)
$(subst /,\,if exist $(U)lev_yacc.c del $(U)lev_yacc.c)
$(subst /,\,if exist $(U)dgn_flex.c del $(U)dgn_flex.c)
$(subst /,\,if exist $(U)dgn_lex.c del $(U)dgn_lex.c)
$(subst /,\,if exist $(U)dgn_yacc.c del $(U)lev_yacc.c)
$(subst /,\,if exist $(U)makedefs.exe del $(U)makedefs.exe)
$(subst /,\,if exist $(U)lev_comp.exe del $(U)lev_comp.exe)
$(subst /,\,if exist $(U)dgn_comp.exe del $(U)dgn_comp.exe)
$(subst /,\,if exist $(U)recover.exe del $(U)recover.exe)
$(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe)
$(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe)
$(subst /,\,if exist $(U)tile2bin.exe del $(U)tile2bin.exe)
$(subst /,\,if exist $(U)til2bin2.exe del $(U)til2bin2.exe)
$(subst /,\,if exist $(U)thintile.exe del $(U)thintile.exe)
$(subst /,\,if exist $(U)dlb_main.exe del $(U)dlb_main.exe)
$(subst /,\,if exist $(INCL)/vis_tab.h del $(INCL)/vis_tab.h)
$(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h)
$(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h)
$(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h)
$(subst /,\,if exist $(INCL)/dgn_comp.h del $(INCL)/dgn_comp.h)
$(subst /,\,if exist $(INCL)/lev_comp.h del $(INCL)/lev_comp.h)
$(subst /,\,if exist $(SRC)/monstr.c del $(SRC)/monstr.c)
$(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c)
$(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c)
$(subst /,\,if exist $(DAT)/options del $(DAT)/options)
$(subst /,\,if exist $(DAT)/data del $(DAT)/data)
$(subst /,\,if exist $(DAT)/rumors del $(DAT)/rumors)
$(subst /,\,if exist $(DAT)/dungeon.pdf del $(DAT)/dungeon.pdf)
$(subst /,\,if exist $(DAT)/dungeon del $(DAT)/dungeon)
$(subst /,\,if exist $(DAT)/oracles del $(DAT)/oracles)
$(subst /,\,if exist $(DAT)/quest.dat del $(DAT)/quest.dat)
$(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon)
$(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave)
$(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph)
$(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst)
$(subst /,\,if exist $(DAT)/nhdat del $(DAT)/nhdat)
$(subst /,\,if exist $(DAT)/*.lev del $(DAT)/*.lev)
$(subst /,\,if exist $(TILE_BMP) del $(TILE_BMP))
$(subst /,\,if exist $(WSHR)/monthin.txt del $(WSHR)/monthin.txt)
$(subst /,\,if exist $(WSHR)/objthin.txt del $(WSHR)/objthin.txt)
$(subst /,\,if exist $(WSHR)/oththin.txt del $(WSHR)/oththin.txt)
#==========================================
# Create directory for holding object files
#==========================================
$(O)obj.tag:
-$(subst /,\,@if not exist $(OBJ)/*.* mkdir $(OBJ))
@$(subst /,\,@echo directory created > $@)
#===========================================
# Work around some djgpp long file name woes
#===========================================
$(PATCHLEV_H):
@$(subst /,\,if not exist $@ copy $(INCL)/patchlevel.h $(INCL)/patchlev.h)
ifeq "$(ADD_LUA)" "Y"
echo $(LUAOBJ) >> $(subst /,\,$@)
endif
ifeq "$(ADD_CURSES)" "Y"
echo $(CURSESOBJ) >> $(subst /,\,$@)
endif
#==========================================
#=========== SECONDARY TARGETS ============
@@ -640,12 +748,13 @@ vis_tab.c: $(U)makedefs.exe
# Makedefs Stuff
#==========================================
$(U)makedefs.exe: $(MAKEOBJS)
$(LINK) $(LFLAGS) -o$@ $(MAKEOBJS)
$(U)makedefs.exe: $(MAKEDEFSOBJS)
$(LINK) $(LFLAGS) -o$@ $(MAKEDEFSOBJS)
$(O)makedefs.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/objclass.h \
$(INCL)/monsym.h $(INCL)/qtext.h $(U)makedefs.c
ifneq "$(ADD_LUA)" "Y"
#==========================================
# Level Compiler Dependencies
#==========================================
@@ -718,6 +827,7 @@ else
@$(subst /,\,copy $(SSHR)/lev_lex.c $@)
@$(subst /,\,echo.>>$@)
endif
endif
#==========================================
# Dungeon Dependencies
@@ -900,6 +1010,13 @@ $(O)viewtib.o: $(MSYS)/viewtib.c
endif
#==========================================
# PDCurses Library
#==========================================
$(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS)
ar rcs $@ $(PDCLIBOBJS) $(PDCOBJS)
#==========================================
# Other Util Dependencies.
#==========================================
@@ -954,7 +1071,9 @@ $(DAT)/engrave: $(O)utility.tag $(DAT)/engrave.txt
$(DAT)/epitaph: $(O)utility.tag $(DAT)/epitaph.txt
@$(subst /,\,$(U)makedefs.exe -s)
$(O)sp_lev.tag: $(O)utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \
ifneq "$(ADD_LUA)" "Y"
$(O)sp_lev.tag: $(O)utility.tag \
$(DAT)/bigroom.des $(DAT)/castle.des \
$(DAT)/endgame.des $(DAT)/gehennom.des $(DAT)/knox.des \
$(DAT)/medusa.des $(DAT)/oracle.des $(DAT)/tower.des \
$(DAT)/yendor.des $(DAT)/arch.des $(DAT)/barb.des \
@@ -988,6 +1107,9 @@ $(O)sp_lev.tag: $(O)utility.tag $(DAT)/bigroom.des $(DAT)/castle.des \
@$(subst /,\,$(U)lev_comp valkyrie.des)
@$(subst /,\,$(U)lev_comp wizard.des)
@$(subst /,\,cd $(SRC))
else
$(O)sp_lev.tag: $(O)utility.tag
endif
@$(subst /,\,echo sp_levs done > $@)
$(DAT)/dungeon: $(O)utility.tag $(DAT)/dungeon.def
@@ -1011,7 +1133,11 @@ $(DAT)/nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/rumors $(DAT)/dungeon \
@$(LS) data dungeon oracles options quest.dat rumors help hh >dlb.lst
@$(LS) cmdhelp history opthelp wizhelp license msdoshlp.txt >>dlb.lst
@$(LS) bogusmon engrave epitaph tribute >>dlb.lst
ifeq "$(ADD_LUA)" "Y"
$(LS) $(subst /,\,*.lua) >>dlb.lst
else
$(LS) $(subst /,\,*.lev) >>dlb.lst
endif
@$(subst /,\,$(U)dlb_main cvIf dlb.lst nhdat)
@$(subst /,\,cd $(SRC))
@@ -1021,6 +1147,100 @@ $(U)dlb_main.exe: $(DLBOBJS)
$(O)dlb_main.o: $(U)dlb_main.c $(INCL)/config.h $(DLB_H)
$(CC) $(cflags) -o$@ $(U)dlb_main.c
#=============================================================
# LUA
#=============================================================
lua.exe: $(O)lua.o $(LUALIB)
$(link) $(LFLAGS) -o$@ $(O)lua.o $(LUALIB)
luac.exe: $(O)luac.o $(O)lua535s.a
$(link) $(LFLAGSU) -o$@ $(O)luac.o $(LUALIB)
$(O)lua535.a: $(LUAOBJFILES)
$(cc) -shared -Wl,--export-all-symbols \
-Wl,--add-stdcall-alias -o $@ $<
$(O)lua535s.a: $(LUAOBJFILES)
ar rcs $@ $(LUAOBJFILES)
$(O)lua.o: $(LUASRC)/lua.c
$(O)luac.o: $(LUASRC)/luac.c
#==========================================
# Housekeeping.
#==========================================
clean:
$(subst /,\,if exist $(O)*.o del $(O)*.o)
$(subst /,\,if exist $(O)dat.tag del $(O)dat.tag)
$(subst /,\,if exist $(O)install.tag del $(O)install.tag)
$(subst /,\,if exist $(O)$(GAME).lnk del $(O)$(GAME).lnk)
$(subst /,\,if exist $(O)obj.tag del $(O)obj.tag)
$(subst /,\,if exist $(O)sp_lev.tag del $(O)sp_lev.tag)
$(subst /,\,if exist $(O)thintile.tag del $(O)thintile.tag)
$(subst /,\,if exist $(O)utility.tag del $(O)utility.tag)
$(subst /,\,if exist temp.a del temp.a)
spotless: clean
$(subst /,\,if exist $(U)dgn_flex.c del $(U)dgn_flex.c)
$(subst /,\,if exist $(U)dgn_lex.c del $(U)dgn_lex.c)
$(subst /,\,if exist $(U)makedefs.exe del $(U)makedefs.exe)
$(subst /,\,if exist $(U)dgn_comp.exe del $(U)dgn_comp.exe)
$(subst /,\,if exist $(U)recover.exe del $(U)recover.exe)
$(subst /,\,if exist $(U)tilemap.exe del $(U)tilemap.exe)
$(subst /,\,if exist $(U)tile2bmp.exe del $(U)tile2bmp.exe)
$(subst /,\,if exist $(U)tile2bin.exe del $(U)tile2bin.exe)
$(subst /,\,if exist $(U)til2bin2.exe del $(U)til2bin2.exe)
$(subst /,\,if exist $(U)thintile.exe del $(U)thintile.exe)
$(subst /,\,if exist $(U)dlb_main.exe del $(U)dlb_main.exe)
$(subst /,\,if exist $(INCL)/vis_tab.h del $(INCL)/vis_tab.h)
$(subst /,\,if exist $(INCL)/onames.h del $(INCL)/onames.h)
$(subst /,\,if exist $(INCL)/pm.h del $(INCL)/pm.h)
$(subst /,\,if exist $(INCL)/date.h del $(INCL)/date.h)
$(subst /,\,if exist $(INCL)/dgn_comp.h del $(INCL)/dgn_comp.h)
ifneq "$(ADD_LUA)" "Y"
$(subst /,\,if exist $(INCL)/lev_comp.h del $(INCL)/lev_comp.h)
endif
$(subst /,\,if exist $(SRC)/monstr.c del $(SRC)/monstr.c)
$(subst /,\,if exist $(SRC)/vis_tab.c del $(SRC)/vis_tab.c)
$(subst /,\,if exist $(SRC)/tile.c del $(SRC)/tile.c)
$(subst /,\,if exist $(DAT)/options del $(DAT)/options)
$(subst /,\,if exist $(DAT)/data del $(DAT)/data)
$(subst /,\,if exist $(DAT)/rumors del $(DAT)/rumors)
$(subst /,\,if exist $(DAT)/dungeon.pdf del $(DAT)/dungeon.pdf)
$(subst /,\,if exist $(DAT)/dungeon del $(DAT)/dungeon)
$(subst /,\,if exist $(DAT)/oracles del $(DAT)/oracles)
$(subst /,\,if exist $(DAT)/quest.dat del $(DAT)/quest.dat)
$(subst /,\,if exist $(DAT)/bogusmon del $(DAT)/bogusmon)
$(subst /,\,if exist $(DAT)/engrave del $(DAT)/engrave)
$(subst /,\,if exist $(DAT)/epitaph del $(DAT)/epitaph)
$(subst /,\,if exist $(DAT)/dlb.lst del $(DAT)/dlb.lst)
$(subst /,\,if exist $(DAT)/nhdat del $(DAT)/nhdat)
ifneq "$(ADD_LUA)" "Y"
$(subst /,\,if exist $(DAT)/*.lev del $(DAT)/*.lev)
endif
$(subst /,\,if exist $(TILE_BMP) del $(TILE_BMP))
$(subst /,\,if exist $(WSHR)/monthin.txt del $(WSHR)/monthin.txt)
$(subst /,\,if exist $(WSHR)/objthin.txt del $(WSHR)/objthin.txt)
$(subst /,\,if exist $(WSHR)/oththin.txt del $(WSHR)/oththin.txt)
#==========================================
# Create directory for holding object files
#==========================================
$(O)obj.tag:
-$(subst /,\,@if not exist $(OBJ)/*.* mkdir $(OBJ))
@$(subst /,\,@echo directory created > $@)
#===========================================
# Work around some djgpp long file name woes
#===========================================
$(PATCHLEV_H):
@$(subst /,\,if not exist $@ copy $(INCL)/patchlevel.h $(INCL)/patchlev.h)
#==========================================
# Game Dependencies
#==========================================
@@ -1269,6 +1489,8 @@ $(O)mplayer.o: mplayer.c $(HACK_H)
$(O)mthrowu.o: mthrowu.c $(HACK_H)
$(O)muse.o: muse.c $(HACK_H)
$(O)music.o: music.c $(HACK_H) #interp.c
$(O)nhlua.o: nhlua.c $(HACK_H)
$(O)nhlsel.o: nhlsel.c $(HACK_H)
$(O)o_init.o: o_init.c $(HACK_H) $(INCL)/lev.h
$(O)objects.o: objects.c $(CONFIG_H) $(INCL)/obj.h $(INCL)/objclass.h \
$(INCL)/prop.h $(INCL)/skills.h $(INCL)/color.h

View File

@@ -16,10 +16,9 @@ goto err_set
echo Checking to see if directories are set up properly ...
if not exist ..\..\include\hack.h goto err_dir
if not exist ..\..\src\hack.c goto err_dir
if not exist ..\..\dat\wizard.des goto err_dir
if not exist ..\..\dat\wizard1.lua goto err_dir
if not exist ..\..\util\makedefs.c goto err_dir
if not exist ..\..\win\tty\wintty.c goto err_dir
if not exist ..\share\lev_yacc.c goto err_dir
echo Directories OK.
if not exist ..\..\binary\* mkdir ..\..\binary

View File

@@ -62,7 +62,7 @@ extern int attrib_text_normal; /* text mode normal attribute */
extern int attrib_gr_normal; /* graphics mode normal attribute */
extern int attrib_gr_intense; /* graphics mode intense attribute */
extern boolean inmap; /* in the map window */
extern boolean restoring;
/* extern boolean g.restoring; */
/*
* Global Variables
@@ -609,7 +609,7 @@ int x, y;
clipx = clipxmax - (viewport_size - 1);
}
if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !restoring)
if (on_level(&u.uz0, &u.uz) && !g.restoring)
/* (void) doredraw(); */
vesa_redrawmap();
}

View File

@@ -435,7 +435,7 @@ static void
vga_cliparound(x, y)
int x, y;
{
extern boolean restoring;
/* extern boolean g.restoring; */
int oldx = clipx;
if (!iflags.tile_view || iflags.over_view || iflags.traditional_view)
@@ -449,7 +449,7 @@ int x, y;
clipx = clipxmax - (viewport_size - 1);
}
if (clipx != oldx) {
if (on_level(&u.uz0, &u.uz) && !restoring)
if (on_level(&u.uz0, &u.uz) && !g.restoring)
/* (void) doredraw(); */
vga_redrawmap(1);
}