Merge branch 'paxed-lua-merged3' into paxed-lua-v2-merged

This commit is contained in:
nhmall
2019-11-06 12:56:21 -05:00
252 changed files with 9504 additions and 6526 deletions

View File

@@ -1015,7 +1015,11 @@ endif
#==========================================
$(O)pdcurses.a : $(PDCLIBOBJS) $(PDCOBJS)
ar rcs $@ $(PDCLIBOBJS) $(PDCOBJS)
ar rcS $@ $(PDCLIBOBJS1)
ar rcS $@ $(PDCLIBOBJS2)
ar rcS $@ $(PDCLIBOBJS3)
ar rcS $@ $(PDCLIBOBJS4)
ar rcs $@ $(PDCOBJS)
#==========================================
# Other Util Dependencies.
@@ -1147,6 +1151,76 @@ $(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
#==========================================
# 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)
$(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)
#=============================================================
# LUA
#=============================================================

View File

@@ -49,12 +49,12 @@ void FDECL(get_cursor, (int *, int *));
/* direct bios calls are used only when iflags.BIOS is set */
STATIC_DCL char NDECL(DOSgetch);
STATIC_DCL char NDECL(BIOSgetch);
static char NDECL(DOSgetch);
static char NDECL(BIOSgetch);
#ifndef __GO32__
STATIC_DCL char *NDECL(getdta);
static char *NDECL(getdta);
#endif
STATIC_DCL unsigned int FDECL(dos_ioctl, (int, int, unsigned));
static unsigned int FDECL(dos_ioctl, (int, int, unsigned));
#ifdef USE_TILES
extern boolean FDECL(pckeys, (unsigned char, unsigned char)); /* pckeys.c */
#endif
@@ -243,7 +243,7 @@ static const char numeric_scanmap[] = { /* ... */
#define ALT 0x8
#endif /* PC9800 */
STATIC_OVL char
static char
BIOSgetch()
{
unsigned char scan, shift, ch = 0;
@@ -303,7 +303,7 @@ BIOSgetch()
return ch;
}
STATIC_OVL char
static char
DOSgetch()
{
union REGS regs;
@@ -406,7 +406,7 @@ foundfile_buffer()
}
/* Get disk transfer area */
STATIC_OVL char *
static char *
getdta()
{
union REGS regs;
@@ -503,7 +503,7 @@ enable_ctrlP()
return;
}
STATIC_OVL unsigned int
static unsigned int
dos_ioctl(handle, mode, setvalue)
int handle, mode;
unsigned setvalue;

View File

@@ -33,8 +33,8 @@
#include "tile.h"
#include "pctiles.h"
STATIC_VAR FILE *tilefile;
STATIC_VAR FILE *tilefile_O;
static FILE *tilefile;
static FILE *tilefile_O;
extern short glyph2tile[]; /* in tile.c (made from tilemap.c) */
#ifdef TILES_IN_RAM

View File

@@ -44,6 +44,7 @@
#define READ_ABSOLUTE_WORD(x) *(x)
#define WRITE_ABSOLUTE(x, y) *(x) = (y)
#define WRITE_ABSOLUTE_WORD(x, y) *(x) = (y)
#define WRITE_ABSOLUTE_DWORD(x, y) *(x) = (y)
#endif
#if defined(__GO32__) || defined(__DJGPP__)
@@ -57,6 +58,8 @@
_farpokeb(_go32_conventional_mem_selector(), (unsigned) x, (y))
#define WRITE_ABSOLUTE_WORD(x, y) \
_farpokew(_go32_conventional_mem_selector(), (unsigned) x, (y))
#define WRITE_ABSOLUTE_DWORD(x, y) \
_farpokel(_go32_conventional_mem_selector(), (unsigned) x, (y))
#endif
#ifdef OBSOLETE /* old djgpp V1.x way of mapping 1st MB */
@@ -66,6 +69,7 @@
#define READ_ABSOLUTE_WORD(x) *(x)
#define WRITE_ABSOLUTE(x, y) *(x) = (y)
#define WRITE_ABSOLUTE_WORD(x, y) *(x) = (y)
#define WRITE_ABSOLUTE_DWORD(x, y) *(x) = (y)
#endif
#endif /* MK_PTR */

View File

@@ -1,10 +1,10 @@
@echo off
REM NetHack 3.6 setup.bat $NHDT-Date: 1432512792 2015/05/25 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.9 $
REM Copyright (c) NetHack PC Development Team 1990 - 2018
REM Copyright (c) NetHack PC Development Team 1990 - 2019
REM NetHack may be freely redistributed. See license for details.
echo.
echo Copyright (c) NetHack PC Development Team 1990 - 2018
echo Copyright (c) NetHack PC Development Team 1990 - 2019
echo NetHack may be freely redistributed. See license for details.
echo.
REM setup batch file for msdos, see Install.dos for details.
@@ -80,7 +80,7 @@ ren ..\..\sys\share\posixregex.c posixreg.c
goto long4ok
:long4b
echo "Renaming ..\..\sys\share\posixr~1.c -> ..\..\sys\share\posixreg.c"
ren ..\..\sys\share\posixr~1.h posixreg.c
ren ..\..\sys\share\posixr~1.c posixreg.c
:long4ok
if "%1"=="GCC" goto ok_gcc

View File

@@ -122,7 +122,7 @@ void FDECL(get_cursor, (int *, int *));
void FDECL(adjust_cursor_flags, (struct WinDesc *));
void FDECL(cmov, (int, int));
void FDECL(nocmov, (int, int));
STATIC_DCL void NDECL(init_ttycolor);
static void NDECL(init_ttycolor);
int savevmode; /* store the original video mode in here */
int curcol, currow; /* graphics mode current cursor locations */
@@ -571,8 +571,10 @@ const char *s;
}
}
void xputc(ch) /* write out character (and attribute) */
char ch;
/* same signature as 'putchar()' with potential failure result ignored */
int
xputc(ch) /* write out character (and attribute) */
int ch;
{
int i;
char attribute;
@@ -591,16 +593,17 @@ char ch;
vesa_xputc(ch, attribute);
#endif /*SCREEN_VESA*/
}
return 0;
}
void xputg(glyphnum, ch,
special) /* write out a glyph picture at current location */
/* write out a glyph picture at current location */
void xputg(glyphnum, ch, special)
int glyphnum;
int ch;
unsigned special;
{
if (!iflags.grmode || !iflags.tile_view) {
xputc((char) ch);
(void) xputc((char) ch);
#ifdef SCREEN_VGA
} else if (iflags.grmode && iflags.usevga) {
vga_xputg(glyphnum, ch, special);
@@ -719,7 +722,7 @@ char *schoice[3] = { "dark", "normal", "light" };
char *shade[3];
#endif /* VIDEOSHADES */
STATIC_OVL void
static void
init_ttycolor()
{
#ifdef VIDEOSHADES

View File

@@ -104,18 +104,18 @@
extern short glyph2tile[];
/* STATIC_DCL void FDECL(vga_NoBorder, (int)); */
/* static void FDECL(vga_NoBorder, (int)); */
void FDECL(vga_gotoloc, (int, int)); /* This should be made a macro */
void NDECL(vga_backsp);
#ifdef SCROLLMAP
STATIC_DCL void FDECL(vga_scrollmap, (BOOLEAN_P));
static void FDECL(vga_scrollmap, (BOOLEAN_P));
#endif
STATIC_DCL void FDECL(vga_redrawmap, (BOOLEAN_P));
static void FDECL(vga_redrawmap, (BOOLEAN_P));
static void FDECL(vga_cliparound, (int, int));
STATIC_OVL void FDECL(decal_planar, (struct planar_cell_struct *, unsigned));
static void FDECL(decal_planar, (struct planar_cell_struct *, unsigned));
#ifdef POSITIONBAR
STATIC_DCL void NDECL(positionbar);
static void NDECL(positionbar);
static void FDECL(vga_special, (int, int, int));
#endif
@@ -147,11 +147,11 @@ extern boolean inmap; /* in the map window */
* Global Variables
*/
STATIC_VAR unsigned char __far *font;
STATIC_VAR char *screentable[SCREENHEIGHT];
static unsigned char __far *font;
static char *screentable[SCREENHEIGHT];
STATIC_VAR const struct Pixel *paletteptr;
STATIC_VAR struct map_struct {
static const struct Pixel *paletteptr;
static struct map_struct {
int glyph;
int ch;
int attr;
@@ -171,13 +171,13 @@ STATIC_VAR struct map_struct {
}
#define TOP_MAP_ROW 1
STATIC_VAR int vgacmap[CLR_MAX] = { 1, 4, 6, 10, 5, 9, 0, 15,
static int vgacmap[CLR_MAX] = { 1, 4, 6, 10, 5, 9, 0, 15,
12, 3, 7, 8, 2, 9, 0, 14 };
STATIC_VAR int viewport_size = 40;
/* STATIC_VAR char masktable[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}; */
/* STATIC_VAR char bittable[8]= {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; */
static int viewport_size = 40;
/* static char masktable[8]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01}; */
/* static char bittable[8]= {0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80}; */
#if 0
STATIC_VAR char defpalette[] = { /* Default VGA palette */
static char defpalette[] = { /* Default VGA palette */
0x00, 0x00, 0x00,
0x00, 0x00, 0xaa,
0x00, 0xaa, 0x00,
@@ -202,10 +202,10 @@ int vp[SCREENPLANES] = { 8, 4, 2, 1 };
#endif
int vp2[SCREENPLANES] = { 1, 2, 4, 8 };
STATIC_VAR struct planar_cell_struct planecell;
STATIC_VAR struct overview_planar_cell_struct planecell_O;
static struct planar_cell_struct planecell;
static struct overview_planar_cell_struct planecell_O;
/* STATIC_VAR int g_attribute; */ /* Current attribute to use */
/* static int g_attribute; */ /* Current attribute to use */
void
vga_get_scr_size()
@@ -231,25 +231,20 @@ void
vga_clear_screen(colour)
int colour;
{
char __far *pch;
int y, j;
char volatile a;
unsigned long __far *pch;
unsigned j;
outportb(0x3ce, 5);
outportb(0x3cf, 2);
for (y = 0; y < SCREENHEIGHT; ++y) {
pch = screentable[y];
for (j = 0; j < SCREENBYTES; ++j) {
outportb(0x3ce, 8);
outportb(0x3cf, 255);
a = READ_ABSOLUTE(pch); /* Must read , then write */
WRITE_ABSOLUTE(pch, (char) colour);
++pch;
}
egawriteplane(colour);
pch = (unsigned long __far *) screentable[0];
for (j = 0; j < SCREENHEIGHT * SCREENBYTES / 4; ++j) {
WRITE_ABSOLUTE_DWORD(&pch[j], 0xFFFFFFFF);
}
outportb(0x3ce, 5);
outportb(0x3cf, 0);
egawriteplane(~colour);
pch = (unsigned long __far *) screentable[0];
for (j = 0; j < SCREENHEIGHT * SCREENBYTES / 4; ++j) {
WRITE_ABSOLUTE_DWORD(&pch[j], 0x00000000);
}
egawriteplane(15);
if (iflags.tile_view)
vga_clearmap();
vga_gotoloc(0, 0); /* is this needed? */
@@ -455,32 +450,26 @@ int x, y;
}
}
STATIC_OVL void
static void
vga_redrawmap(clearfirst)
boolean clearfirst;
{
int j, x, y, t;
char __far *pch;
char volatile a;
int x, y, t;
unsigned long __far *pch;
if (clearfirst) {
/* y here is in pixel rows */
outportb(0x3ce, 5);
outportb(0x3cf, 2);
unsigned j;
t = TOP_MAP_ROW * ROWS_PER_CELL;
for (y = t; y < (ROWNO * ROWS_PER_CELL) + t; ++y) {
pch = screentable[y];
for (j = 0; j < SCREENBYTES; ++j) {
outportb(0x3ce, 8);
outportb(0x3cf, 255);
/* On VGA mode2, must read first, then write */
a = READ_ABSOLUTE(pch);
WRITE_ABSOLUTE(pch, (char) BACKGROUND_VGA_COLOR);
++pch;
}
pch = (unsigned long __far *) screentable[t];
egawriteplane(BACKGROUND_VGA_COLOR);
for (j = 0; j < ROWNO * ROWS_PER_CELL * SCREENBYTES / 4; ++j) {
WRITE_ABSOLUTE_DWORD(&pch[j], 0xFFFFFFFF);
}
outportb(0x3ce, 5);
outportb(0x3cf, 0);
egawriteplane(~BACKGROUND_VGA_COLOR);
for (j = 0; j < ROWNO * ROWS_PER_CELL * SCREENBYTES / 4; ++j) {
WRITE_ABSOLUTE_DWORD(&pch[j], 0x00000000);
}
egawriteplane(15);
}
/* y here is in screen rows*/
#ifdef ROW_BY_ROW
@@ -578,7 +567,7 @@ vga_refresh()
}
#ifdef SCROLLMAP
STATIC_OVL void
static void
vga_scrollmap(left)
boolean left;
{
@@ -724,7 +713,7 @@ unsigned char (*indexes)[TILE_X];
}
}
STATIC_OVL void
static void
decal_planar(gp, special)
struct planar_cell_struct *gp;
unsigned special;
@@ -858,7 +847,7 @@ vga_Finish(void)
* to a more standard values - MJA 94/04/23.
*
*/
STATIC_OVL void
static void
vga_NoBorder(int bc)
{
union REGS regs;
@@ -941,36 +930,52 @@ int chr, col, row, colour;
int i;
int x, pixy;
char volatile tc;
char __far *cp;
unsigned char __far *fp = font;
unsigned char fnt;
int actual_colour = vgacmap[colour];
int vplane;
x = min(col, (CO - 1)); /* min() used protection from callers */
pixy = min(row, (LI - 1)) * 16; /* assumes 8 x 16 char set */
/* if (chr < ' ') chr = ' '; */ /* assumes ASCII set */
outportb(0x3ce, 5);
outportb(0x3cf, 2);
chr = chr << 4;
for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
cp = screentable[pixy + i] + x;
fnt = READ_ABSOLUTE((fp + chr + i));
outportb(0x3ce, 8);
outportb(0x3cf, fnt);
tc = READ_ABSOLUTE(cp); /* wrt mode 2, must read, then write */
WRITE_ABSOLUTE(cp, (char) actual_colour);
outportb(0x3ce, 8);
outportb(0x3cf, ~fnt);
tc = READ_ABSOLUTE(cp); /* wrt mode 2, must read, then write */
WRITE_ABSOLUTE(cp, (char) BACKGROUND_VGA_COLOR);
vplane = ~actual_colour & ~BACKGROUND_VGA_COLOR & 0xF;
if (vplane != 0) {
egawriteplane(vplane);
for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
cp = screentable[pixy + i] + x;
WRITE_ABSOLUTE(cp, (char) 0x00);
}
}
outportb(0x3ce, 5);
outportb(0x3cf, 0);
outportb(0x3ce, 8);
outportb(0x3cf, 255);
vplane = actual_colour & ~BACKGROUND_VGA_COLOR & 0xF;
if (vplane != 0) {
egawriteplane(vplane);
for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
cp = screentable[pixy + i] + x;
fnt = READ_ABSOLUTE((fp + chr + i));
WRITE_ABSOLUTE(cp, (char) fnt);
}
}
vplane = ~actual_colour & BACKGROUND_VGA_COLOR & 0xF;
if (vplane != 0) {
egawriteplane(vplane);
for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
cp = screentable[pixy + i] + x;
fnt = ~READ_ABSOLUTE((fp + chr + i));
WRITE_ABSOLUTE(cp, (char) fnt);
}
}
vplane = actual_colour & BACKGROUND_VGA_COLOR & 0xF;
if (vplane != 0) {
egawriteplane(vplane);
for (i = 0; i < MAX_ROWS_PER_CELL; ++i) {
cp = screentable[pixy + i] + x;
WRITE_ABSOLUTE(cp, (char) 0xFF);
}
}
egawriteplane(15);
}
/*
@@ -1121,7 +1126,7 @@ char *posbar;
*p = 0;
}
STATIC_OVL void
static void
positionbar()
{
char *posbar = pbar;