some of Ray Chason's MSDOS and other fixes

This commit is contained in:
nhmall
2016-03-05 14:44:50 -05:00
parent ef9cd17942
commit 78857961d2
22 changed files with 1484 additions and 201 deletions

View File

@@ -1,4 +1,4 @@
# NetHack 3.6 Makefile.GCC $NHDT-Date: 1432512792 2015/05/25 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.28 $
# NetHack 3.6 Makefile.GCC $NHDT-Date: 1457207036 2016/03/05 19:43:56 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.29 $
# Copyright (c) NetHack PC Development Team 1996-2006.
# PC NetHack 3.6 Makefile for djgpp V2
#
@@ -66,7 +66,7 @@ LIBRARIES = $(LIBS) $(TERMLIB)
#
# If you have yacc/lex or a work-alike set YACC_LEX to Y
#
YACC_LEX = Y
YACC_LEX = N
ifeq ($(YACC_LEX),Y)
DO_YACC = YACC_ACT
DO_LEX = LEX_ACT
@@ -161,8 +161,8 @@ LFLAGS =
else
# Debugging
#cflags = -pg -c -I../include $(DLBFLG) -DUSE_TILES
#LFLAGS = -pg
#cflags = -g -c -I../include $(DLBFLG) -DUSE_TILES
#LFLAGS = -g
# Normal
cflags = -c -O -I../include $(DLBFLG) -DUSE_TILES
@@ -173,7 +173,7 @@ endif
#================ RULES ==================
#==========================================
.SUFFIXES: .exe .o .tib .til .uu .c .y .l
.SUFFIXES: .exe .o .til .uu .c .y .l
#==========================================
# Rules for files in src
@@ -241,7 +241,7 @@ U = $(UTIL)/
# Utility Objects.
#==========================================
VGAOBJ = $(O)vidvga.o
VGAOBJ = $(O)vidvga.o $(O)vidvesa.o
MAKESRC = makedefs.c
@@ -267,10 +267,10 @@ RECOVOBJS = $(O)recover.o
ifeq ($(SUPPRESS_GRAPHICS),Y)
TILOBJ =
TILOBJ2 =
TEXTIO =
TEXTIO2 =
PLANAR_TIB =
OVERVIEW_TIB =
TILE_BMP =
TILEUTIL =
TILEFILES =
TILEFILES2 =
@@ -281,7 +281,9 @@ PPMWRIT2 =
else
TILOBJ = $(O)tile.o $(O)pctiles.o $(VGAOBJ)
TILOBJ = $(O)tile.o $(VGAOBJ)
TILOBJ2 = $(O)tileset.o $(O)bmptiles.o $(O)giftiles.o
TEXTIO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o $(O)decl.o $(O)monst.o \
$(O)objects.o $(O)stubvid.o
@@ -289,11 +291,9 @@ TEXTIO = $(O)tiletext.o $(O)tiletxt.o $(O)drawing.o $(O)decl.o $(O)monst.o
TEXTIO2 = $(O)tiletex2.o $(O)tiletxt2.o $(O)drawing.o $(O)decl.o $(O)monst.o \
$(O)objects.o $(O)stubvid.o
PLANAR_TIB = $(DAT)/NetHack1.tib
TILE_BMP = $(DAT)/nhtiles.bmp
OVERVIEW_TIB = $(DAT)/NetHacko.tib
TILEUTIL = $(TILOBJ) $(U)tile2bin.exe $(U)til2bin2.exe $(PLANAR_TIB) $(OVERVIEW_TIB)
TILEUTIL = $(TILOBJ) $(U)tile2bin.exe $(U)til2bin2.exe $(TILE_BMP)
TILEFILES = $(WSHR)/monsters.txt $(WSHR)/objects.txt $(WSHR)/other.txt
@@ -336,7 +336,7 @@ 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
VOBJ23 = $(O)region.o $(O)sys.o $(O)pmatchre.o $(O)string.o $(O)unicode.o
SOBJ = $(O)msdos.o $(O)sound.o $(O)pcsys.o $(O)tty.o $(O)unix.o \
$(O)video.o $(O)vidtxt.o $(O)pckeys.o
@@ -349,7 +349,7 @@ VOBJ = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
$(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
$(VOBJ21) $(VOBJ22) $(VOBJ23)
ALLOBJ = $(VOBJ) $(SOBJ) $(TILOBJ) $(VVOBJ)
ALLOBJ = $(VOBJ) $(SOBJ) $(TILOBJ) $(TILOBJ2) $(VVOBJ)
#==========================================
# Header file macros
@@ -391,7 +391,7 @@ DLB_H = $(INCL)/dlb.h
ifeq ($(SUPPRESS_GRAPHICS),Y)
TILE_H =
else
TILE_H = $(WSHR)/tile.h $(MSYS)/pctiles.h
TILE_H = $(WSHR)/tile.h $(INCL)/tileset.h
endif
ifeq ($(USE_DLB),Y)
@@ -448,11 +448,12 @@ endif
ifdef TERMLIB
@$(subst /,\,copy $(SSHR)/termcap $(GAMEDIR))
endif
@$(subst /,\,if exist $(DAT)/*.tib copy $(DAT)/*.tib $(GAMEDIR))
@$(subst /,\,if exist $(TILE_BMP) copy $(TILE_BMP) $(GAMEDIR))
@$(subst /,\,if exist $(DAT)/symbols copy $(DAT)/symbols $(GAMEDIR))
@$(subst /,\,copy $(SSHR)/NetHack.cnf $(GAMEDIR)/defaults.nh)
@$(subst /,\,copy $(MSYS)/NHAccess.nh $(GAMEDIR))
-@$(subst /,\,touch $(GAMEDIR)/record)
@$(subst /,\,copy $(DOC)/guidebo*.txt $(GAMEDIR))
@$(subst /,\,copy ../sys/winnt/sysconf $(GAMEDIR))
@$(subst /,\,if exist $(DOC)/nethack.txt copy $(DOC)/nethack.txt $(GAMEDIR))
ifdef CWSDPMI
@$(subst /,\,if exist $(CWSDPMI) copy $(CWSDPMI) $(GAMEDIR))
@@ -466,7 +467,35 @@ endif
#==========================================
$(GAMEFILE): $(O)obj.tag $(PATCHLEV_H) $(O)utility.tag $(ALLOBJ) $(O)$(GAME).lnk
$(LINK) $(LFLAGS) -o$(GAME).exe @$(O)$(GAME).lnk $(LIBRARIES) $(ZLIB)
@if exist temp.a del temp.a
@ar ru temp.a $(VOBJ01)
@ar ru temp.a $(VOBJ02)
@ar ru temp.a $(VOBJ03)
@ar ru temp.a $(VOBJ04)
@ar ru temp.a $(VOBJ05)
@ar ru temp.a $(VOBJ06)
@ar ru temp.a $(VOBJ07)
@ar ru temp.a $(VOBJ08)
@ar ru temp.a $(VOBJ09)
@ar ru temp.a $(VOBJ10)
@ar ru temp.a $(VOBJ11)
@ar ru temp.a $(VOBJ12)
@ar ru temp.a $(VOBJ13)
@ar ru temp.a $(VOBJ14)
@ar ru temp.a $(VOBJ15)
@ar ru temp.a $(VOBJ16)
@ar ru temp.a $(VOBJ17)
@ar ru temp.a $(VOBJ18)
@ar ru temp.a $(VOBJ19)
@ar ru temp.a $(VOBJ20)
@ar ru temp.a $(VOBJ21)
@ar ru temp.a $(VOBJ22)
@ar ru temp.a $(VOBJ23)
@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)
@$(subst /,\,stubedit $(GAME).exe minstack=2048K)
@$(subst /,\,copy $(GAME).exe $(GAMEFILE))
@$(subst /,\,del $(GAME).exe)
@@ -497,6 +526,7 @@ $(O)$(GAME).lnk: $(ALLOBJ)
echo $(VOBJ23) >> $(subst /,\,$@)
echo $(SOBJ) >> $(subst /,\,$@)
echo $(TILOBJ) >> $(subst /,\,$@)
echo $(TILOBJ2) >> $(subst /,\,$@)
echo $(VVOBJ) >> $(subst /,\,$@)
@@ -513,6 +543,7 @@ clean:
$(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
@@ -527,6 +558,7 @@ spotless: clean
$(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)
@@ -547,11 +579,13 @@ spotless: clean
$(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 $(PLANAR_TIB) del $(PLANAR_TIB))
$(subst /,\,if exist $(OVERVIEW_TIB) del $(OVERVIEW_TIB))
$(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)
@@ -614,7 +648,9 @@ $(O)makedefs.o: $(CONFIG_H) $(PERMONST_H) $(INCL)/objclass.h \
#==========================================
$(U)lev_comp.exe: $(SPLEVOBJS)
$(LINK) $(LFLAGS) -o$@ $(SPLEVOBJS)
@rm -f temp.a
@ar ru temp.a $(SPLEVOBJS)
$(LINK) $(LFLAGS) -o$@ temp.a
ifeq ($(YACC_LEX),Y)
@@ -770,23 +806,26 @@ $(O)tilemap.o: $(WSHR)/tilemap.c $(HACK_H) $(TILE_H)
# Required for tile support
#==========================================
$(DAT)/NetHack1.tib: $(TILEFILES) $(U)tile2bin.exe
$(DAT)/nhtiles.bmp: $(TILEFILES) $(U)tile2bmp.exe
@echo Creating binary tile files (this may take some time)
@$(subst /,\,chdir $(DAT))
@$(subst /,\,$(U)tile2bin.exe)
@$(subst /,\,$(U)tile2bmp.exe $@)
@$(subst /,\,chdir $(SRC))
$(DAT)/NetHacko.tib: $(O)thintile.tag $(TILEFILES2) $(U)til2bin2.exe
@echo Creating overview binary tile files (this may take some time)
@$(subst /,\,chdir $(DAT))
@$(subst /,\,$(U)til2bin2.exe)
@$(subst /,\,chdir $(SRC))
$(U)tile2bmp.exe: $(O)tile2bmp.o $(TEXTIO)
@rm -f temp.a
@ar ru temp.a $(TEXTIO)
$(LINK) $(LFLAGS) -o$@ $(O)tile2bmp.o temp.a
$(U)tile2bin.exe: $(O)tile2bin.o $(TEXTIO)
$(LINK) $(LFLAGS) -o$@ $(O)tile2bin.o $(TEXTIO)
@rm -f temp.a
@ar ru temp.a $(TEXTIO)
$(LINK) $(LFLAGS) -o$@ $(O)tile2bin.o temp.a
$(U)til2bin2.exe: $(O)til2bin2.o $(TEXTIO2)
$(LINK) $(LFLAGS) -o$@ $(O)til2bin2.o $(TEXTIO2)
@rm -f temp.a
@ar ru temp.a $(TEXTIO2)
$(LINK) $(LFLAGS) -o$@ $(O)til2bin2.o temp.a
$(U)thintile.exe: $(O)thintile.o
$(LINK) $(LFLAGS) -o$@ $(O)thintile.o
@@ -798,6 +837,9 @@ $(O)thintile.tag: $(U)thintile.exe $(TILEFILES)
@$(subst /,\,$(U)thintile.exe)
@$(subst /,\,echo thintiles created >$@)
$(O)tile2bmp.o: $(HACK_H) $(TILE_H) $(WSHR)/tile2bmp.c
$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(WSHR)/tile2bmp.c
$(O)tile2bin.o: $(HACK_H) $(TILE_H) $(MSYS)/pctiles.h $(MSYS)/pcvideo.h $(MSYS)/tile2bin.c
$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/tile2bin.c
@@ -900,6 +942,15 @@ $(DAT)/quest.dat: $(O)utility.tag $(DAT)/quest.txt
$(DAT)/oracles: $(O)utility.tag $(DAT)/oracles.txt
@$(subst /,\,$(U)makedefs.exe -h)
$(DAT)/bogusmon: $(O)utility.tag $(DAT)/bogusmon.txt
@$(subst /,\,$(U)makedefs.exe -s)
$(DAT)/engrave: $(O)utility.tag $(DAT)/engrave.txt
@$(subst /,\,$(U)makedefs.exe -s)
$(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 \
$(DAT)/endgame.des $(DAT)/gehennom.des $(DAT)/knox.des \
$(DAT)/medusa.des $(DAT)/oracle.des $(DAT)/tower.des \
@@ -949,24 +1000,14 @@ $(DAT)/dungeon: $(O)utility.tag $(DAT)/dungeon.def
#note that dir below assumes bin/dir.exe from djgpp distribution
#
$(DAT)/nhdat: $(U)dlb_main.exe $(DAT)/data $(DAT)/rumors $(DAT)/dungeon \
$(DAT)/oracles $(DAT)/quest.dat $(O)sp_lev.tag
$(DAT)/oracles $(DAT)/quest.dat $(O)sp_lev.tag \
$(DAT)/bogusmon $(DAT)/engrave $(DAT)/epitaph $(DAT)/tribute
@$(subst /,\,echo dat done >$(O)dat.tag)
@$(subst /,\,cd $(DAT))
@$(subst /,\,copy $(MSYS)/msdoshlp.txt .)
@$(subst /,\,echo data >dlb.lst)
@$(subst /,\,echo dungeon >>dlb.lst)
@$(subst /,\,echo oracles >>dlb.lst)
@$(subst /,\,echo options >>dlb.lst)
@$(subst /,\,echo quest.dat >>dlb.lst)
@$(subst /,\,echo rumors >>dlb.lst)
@$(subst /,\,echo help >>dlb.lst)
@$(subst /,\,echo hh >>dlb.lst)
@$(subst /,\,echo cmdhelp >>dlb.lst)
@$(subst /,\,echo history >>dlb.lst)
@$(subst /,\,echo opthelp >>dlb.lst)
@$(subst /,\,echo wizhelp >>dlb.lst)
@$(subst /,\,echo license >>dlb.lst)
@$(subst /,\,echo msdoshlp.txt >>dlb.lst)
@$(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
$(LS) $(subst /,\,*.lev) >>dlb.lst
@$(subst /,\,$(U)dlb_main cvIf dlb.lst nhdat)
@$(subst /,\,cd $(SRC))
@@ -1013,6 +1054,9 @@ $(O)video.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(MSYS)/video.c
$(O)vidvga.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidvga.c
$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/vidvga.c
$(O)vidvesa.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidvesa.c
$(CC) $(cflags) -I$(MSYS) -I$(WSHR) -o$@ $(MSYS)/vidvesa.c
$(O)vidtxt.o : $(HACK_H) $(MSYS)/pcvideo.h $(MSYS)/portio.h $(TILE_H) $(MSYS)/vidtxt.c
# $(CC) $(cflags) -o$@ -I$(MSYS) $(MSYS)/vidtxt.c
@@ -1270,6 +1314,10 @@ $(O)worm.o: worm.c $(HACK_H) $(INCL)/lev.h
$(O)worn.o: worn.c $(HACK_H)
$(O)write.o: write.c $(HACK_H)
$(O)zap.o: zap.c $(HACK_H)
$(O)pmatchre.o: $(SSHR)/pmatchre.c $(HACK_H)
$(O)tileset.o: $(WSHR)/tileset.c $(HACK_H)
$(O)bmptiles.o: $(WSHR)/bmptiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h
$(O)giftiles.o: $(WSHR)/giftiles.c $(INCL)/config.h $(INCL)/tileset.h $(INCL)/integer.h
# end of file

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pckeys.c $NHDT-Date: 1432512792 2015/05/25 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* NetHack 3.6 pckeys.c $NHDT-Date: 1457207039 2016/03/05 19:43:59 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.11 $ */
/* Copyright (c) NetHack PC Development Team 1996 */
/* NetHack may be freely redistributed. See license for details. */
@@ -14,6 +14,10 @@
#include "pcvideo.h"
boolean FDECL(pckeys, (unsigned char, unsigned char));
static void FDECL(userpan, (BOOLEAN_P));
static void FDECL(overview, (BOOLEAN_P));
static void FDECL(traditional, (BOOLEAN_P));
static void NDECL(refresh);
extern struct WinDesc *wins[MAXWIN]; /* from wintty.c */
extern boolean inmap; /* from video.c */
@@ -47,25 +51,25 @@ unsigned char shift;
#endif
case 0x74: /* Control-right_arrow = scroll horizontal to right */
if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
vga_userpan(1);
userpan(1);
break;
case 0x73: /* Control-left_arrow = scroll horizontal to left */
if ((shift & CTRL) && iflags.tile_view && !opening_dialog)
vga_userpan(0);
userpan(0);
break;
case 0x3E: /* F4 = toggle overview mode */
if (iflags.tile_view && !opening_dialog && !Is_rogue_level(&u.uz)) {
iflags.traditional_view = FALSE;
vga_overview(iflags.over_view ? FALSE : TRUE);
vga_refresh();
overview(iflags.over_view ? FALSE : TRUE);
refresh();
}
break;
case 0x3F: /* F5 = toggle traditional mode */
if (iflags.tile_view && !opening_dialog && !Is_rogue_level(&u.uz)) {
iflags.over_view = FALSE;
vga_traditional(iflags.traditional_view ? FALSE : TRUE);
vga_refresh();
traditional(iflags.traditional_view ? FALSE : TRUE);
refresh();
}
break;
default:
@@ -73,6 +77,61 @@ unsigned char shift;
}
return TRUE;
}
static void
userpan(on)
boolean on;
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_userpan(on);
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_userpan(on);
#endif
}
static void
overview(on)
boolean on;
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_overview(on);
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_overview(on);
#endif
}
static void
traditional(on)
boolean on;
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_traditional(on);
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_traditional(on);
#endif
}
static void
refresh()
{
#ifdef SCREEN_VGA
if (iflags.usevga)
vga_refresh();
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_refresh();
#endif
}
#endif /* USE_TILES */
#endif /* MSDOS */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pctiles.h $NHDT-Date: 1432512791 2015/05/25 00:13:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* NetHack 3.6 pctiles.h $NHDT-Date: 1457207040 2016/03/05 19:44:00 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.9 $ */
/* Copyright (c) NetHack PC Development Team 1993, 1994 */
/* NetHack may be freely redistributed. See license for details. */
/* */
@@ -11,6 +11,10 @@
*/
#ifdef USE_TILES
#ifndef TILE_X
#define TILE_X 16
#endif
#define NETHACK_PLANAR_TILEFILE "NetHack1.tib" /* Planar style tiles */
#define NETHACK_PACKED_TILEFILE "NetHack2.tib" /* Packed style tiles */
#define NETHACK_OVERVIEW_TILEFILE "NetHacko.tib" /* thin overview tiles */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pcvideo.h $NHDT-Date: 1432512792 2015/05/25 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* NetHack 3.6 pcvideo.h $NHDT-Date: 1457207040 2016/03/05 19:44:00 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.9 $ */
/* Copyright (c) NetHack PC Development Team 1993, 1994 */
/* NetHack may be freely redistributed. See license for details. */
/* */
@@ -166,7 +166,7 @@ struct overview_planar_cell_struct {
#define M_BRIGHTCYAN 11
#define M_TEXT M_GRAY
#define BACKGROUND_COLOR 0
#define BACKGROUND_COLOR 1
#define ATTRIB_NORMAL M_TEXT /* Normal attribute */
#define ATTRIB_INTENSE M_WHITE /* Intense White */
#define ATTRIB_MONO_NORMAL 0x01 /* Underlined,white */
@@ -176,9 +176,9 @@ struct overview_planar_cell_struct {
#endif /*SCREEN_BIOS || SCREEN_DJGPPFAST */
#if defined(SCREEN_VGA) || defined(SCREEN_8514)
#define BACKGROUND_VGA_COLOR 0
#define BACKGROUND_VGA_COLOR 1
#define ATTRIB_VGA_NORMAL CLR_GRAY /* Normal attribute */
#define ATTRIB_VGA_INTENSE 13 /* Intense White 94/06/07 palette chg*/
#define ATTRIB_VGA_INTENSE 14 /* Intense White 94/06/07 palette chg*/
#endif /*SCREEN_VGA || SCREEN_8514*/
#if defined(PC9800)
@@ -258,9 +258,6 @@ E int NDECL(vga_detect);
#ifdef SIMULATE_CURSOR
E void NDECL(vga_DrawCursor);
#endif
E void FDECL(vga_DisplayCell, (struct planar_cell_struct *, int, int));
E void FDECL(vga_DisplayCell_O,
(struct overview_planar_cell_struct *, int, int));
E void NDECL(vga_Finish);
E char __far *NDECL(vga_FontPtrs);
E void NDECL(vga_get_scr_size);
@@ -272,12 +269,8 @@ E void FDECL(vga_update_positionbar, (char *));
E void NDECL(vga_HideCursor);
#endif
E void NDECL(vga_Init);
E void FDECL(vga_SwitchMode, (unsigned int));
E void FDECL(vga_SetPalette, (char *));
E void NDECL(vga_tty_end_screen);
E void FDECL(vga_tty_startup, (int *, int *));
E void FDECL(vga_WriteChar, (int, int, int, int));
E void FDECL(vga_WriteStr, (char *, int, int, int, int));
E void FDECL(vga_xputs, (const char *, int, int));
E void FDECL(vga_xputc, (CHAR_P, int));
E void FDECL(vga_xputg, (int, int, unsigned));
@@ -286,6 +279,35 @@ E void FDECL(vga_overview, (BOOLEAN_P));
E void FDECL(vga_traditional, (BOOLEAN_P));
E void NDECL(vga_refresh);
#endif /* SCREEN_VGA */
#ifdef SCREEN_VESA
E void NDECL(vesa_backsp);
E void FDECL(vesa_clear_screen, (int));
E void FDECL(vesa_cl_end, (int, int));
E void FDECL(vesa_cl_eos, (int));
E int NDECL(vesa_detect);
#ifdef SIMULATE_CURSOR
E void NDECL(vesa_DrawCursor);
#endif
E void NDECL(vesa_Finish);
E void NDECL(vesa_get_scr_size);
E void FDECL(vesa_gotoloc, (int, int));
#ifdef POSITIONBAR
E void FDECL(vesa_update_positionbar, (char *));
#endif
#ifdef SIMULATE_CURSOR
E void NDECL(vesa_HideCursor);
#endif
E void NDECL(vesa_Init);
E void NDECL(vesa_tty_end_screen);
E void FDECL(vesa_tty_startup, (int *, int *));
E void FDECL(vesa_xputs, (const char *, int, int));
E void FDECL(vesa_xputc, (CHAR_P, int));
E void FDECL(vesa_xputg, (int, int, unsigned));
E void FDECL(vesa_userpan, (BOOLEAN_P));
E void FDECL(vesa_overview, (BOOLEAN_P));
E void FDECL(vesa_traditional, (BOOLEAN_P));
E void NDECL(vesa_refresh);
#endif /* SCREEN_VESA */
#endif /* NO_TERMS */
#undef E

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 tile2bin.c $NHDT-Date: 1432512792 2015/05/25 00:13:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.8 $ */
/* NetHack 3.6 tile2bin.c $NHDT-Date: 1457207041 2016/03/05 19:44:01 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.9 $ */
/* Copyright (c) NetHack PC Development Team 1993, 1994, 1995 */
/* NetHack may be freely redistributed. See license for details. */
@@ -38,6 +38,12 @@
extern unsigned _stklen = STKSIZ;
#endif
/* Produce only a planar file if building the overview file; with packed
files, we can make overview-size tiles on the fly */
#if defined(OVERVIEW_FILE) && defined(PACKED_FILE)
#undef PACKED_FILE
#endif
extern char *FDECL(tilename, (int, int));
#ifdef PLANAR_FILE
@@ -62,7 +68,8 @@ struct tibhdr_struct tibheader;
static void FDECL(write_tibtile, (int));
static void FDECL(write_tibheader, (FILE *, struct tibhdr_struct *));
static void FDECL(build_tibtile, (pixel(*) [TILE_X]));
static void FDECL(build_tibtile, (pixel(*) [TILE_X], BOOLEAN_P));
static void NDECL(remap_colors);
#ifndef OVERVIEW_FILE
char *tilefiles[] = { "../win/share/monsters.txt", "../win/share/objects.txt",
@@ -85,6 +92,7 @@ char *argv[];
struct tm *newtime;
time_t aclock;
char *paletteptr;
unsigned num_monsters = 0;
if (argc != 1) {
Fprintf(stderr, "usage: tile2bin (from the util directory)\n");
@@ -135,6 +143,7 @@ char *argv[];
}
if (!paletteflag) {
remap_colors();
paletteptr = tibheader.palette;
for (i = 0; i < num_colors; i++) {
*paletteptr++ = ColorMap[CM_RED][i],
@@ -145,15 +154,33 @@ char *argv[];
}
while (read_text_tile(pixels)) {
build_tibtile(pixels);
build_tibtile(pixels, FALSE);
write_tibtile(tilecount);
tilecount++;
}
(void) fclose_text_file();
if (filenum == 0) {
num_monsters = tilecount;
}
++filenum;
}
/* Build the statue glyphs */
if (!fopen_text_file(tilefiles[0], RDTMODE)) {
Fprintf(stderr,
"usage: tile2bin (from the util or src directory)\n");
exit(EXIT_FAILURE);
}
while (read_text_tile(pixels)) {
build_tibtile(pixels, TRUE);
write_tibtile(tilecount);
tilecount++;
}
(void) fclose_text_file();
#if defined(_MSC_VER)
tibheader.compiler = MSC_COMP;
#elif defined(__BORLANDC__)
@@ -207,17 +234,24 @@ struct tibhdr_struct *tibhdr;
}
static void
build_tibtile(pixels)
build_tibtile(pixels, statues)
pixel (*pixels)[TILE_X];
boolean statues;
{
static int graymappings[] = {
/* . A B C D E F G H I J K L M N O P */
0, 1, 17, 18, 19, 20, 27, 22, 23, 24, 25, 26, 21, 15, 13, 14, 14
};
int i, j, k, co_off;
unsigned char co_mask, tmp;
#ifdef PLANAR_FILE
#ifndef OVERVIEW_FILE
memset((void *) &planetile, 0, sizeof(struct planar_cell_struct));
#else
memset((void *) &planetile, 0,
sizeof(struct overview_planar_cell_struct));
#endif
#endif
for (j = 0; j < TILE_Y; j++) {
for (i = 0; i < TILE_X; i++) {
@@ -229,6 +263,15 @@ pixel (*pixels)[TILE_X];
}
if (k >= num_colors)
Fprintf(stderr, "color not in colormap!\n");
if (statues) {
k = graymappings[k];
} else {
if (k == 16) {
k = 13;
} else if (k == 13) {
k = 16;
}
}
#ifdef PACKED_FILE
packtile[j][i] = k;
#endif
@@ -242,6 +285,14 @@ pixel (*pixels)[TILE_X];
co_mask = masktable[i];
}
if (!statues) {
if (k == 28) {
k = 0;
}
if (k >= 16) {
fprintf(stderr, "Warning: pixel value %d in 16 color bitmap\n", k);
}
}
tmp = planetile.plane[0].image[j][co_off];
planetile.plane[0].image[j][co_off] =
(k & 0x0008) ? (tmp | co_mask) : (tmp & ~co_mask);
@@ -299,3 +350,19 @@ int recnum;
fwrite(&packtile, sizeof(packtile), 1, tibfile2);
#endif
}
static void
remap_colors()
{
char swap;
swap = ColorMap[CM_RED][13];
ColorMap[CM_RED][13] = ColorMap[CM_RED][16];
ColorMap[CM_RED][16] = swap;
swap = ColorMap[CM_GREEN][13];
ColorMap[CM_GREEN][13] = ColorMap[CM_GREEN][16];
ColorMap[CM_GREEN][16] = swap;
swap = ColorMap[CM_BLUE][13];
ColorMap[CM_BLUE][13] = ColorMap[CM_BLUE][16];
ColorMap[CM_BLUE][16] = swap;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 video.c $NHDT-Date: 1432512791 2015/05/25 00:13:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* NetHack 3.6 video.c $NHDT-Date: 1457207042 2016/03/05 19:44:02 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.11 $ */
/* Copyright (c) NetHack PC Development Team 1993, 1994, 2001 */
/* NetHack may be freely redistributed. See license for details. */
/* */
@@ -79,6 +79,11 @@ get_scr_size()
if (iflags.usevga) {
vga_get_scr_size();
} else
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa) {
vesa_get_scr_size();
} else
#endif
txt_get_scr_size();
}
@@ -141,6 +146,10 @@ backsp()
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_backsp();
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_backsp();
#endif
}
}
@@ -153,6 +162,10 @@ clear_screen()
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_clear_screen(BACKGROUND_VGA_COLOR);
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_clear_screen(BACKGROUND_VGA_COLOR);
#endif
}
}
@@ -168,6 +181,10 @@ void cl_end() /* clear to end of line */
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_cl_end(col, row);
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_cl_end(col, row);
#endif
}
tty_curs(BASE_WINDOW, (int) ttyDisplay->curx + 1, (int) ttyDisplay->cury);
@@ -182,6 +199,10 @@ void cl_eos() /* clear to end of screen */
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_cl_eos(cy);
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_cl_eos(cy);
#endif
}
tty_curs(BASE_WINDOW, (int) ttyDisplay->curx + 1, (int) ttyDisplay->cury);
@@ -198,6 +219,10 @@ register int col, row;
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_gotoloc(col, row);
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_gotoloc(col, row);
#endif
}
}
@@ -223,6 +248,10 @@ home()
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_gotoloc(0, 0);
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_gotoloc(0, 0);
#endif
}
}
@@ -236,6 +265,10 @@ int col, row;
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_gotoloc(col, row);
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_gotoloc(col, row);
#endif
}
}
@@ -360,6 +393,10 @@ tty_end_screen()
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_tty_end_screen();
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_tty_end_screen();
#endif
}
}
@@ -395,6 +432,11 @@ int *wid, *hgt;
if (iflags.usevga) {
vga_tty_startup(wid, hgt);
} else
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa) {
vesa_tty_startup(wid, hgt);
} else
#endif
txt_startup(wid, hgt);
@@ -430,39 +472,44 @@ tty_start_screen()
void
gr_init()
{
if (iflags.usevga) {
#ifdef SCREEN_VGA
if (iflags.usevga) {
vga_Init();
} else
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
if (iflags.usevesa) {
vesa_Init();
} else
#endif
#ifdef SCREEN_8514
} else if (iflags.use8514) {
if (iflags.use8514) {
v8514_Init();
} else
#endif
}
{}
}
void
gr_finish()
{
if (iflags.grmode) {
if (iflags.usevga) {
#ifdef SCREEN_VGA
if (iflags.usevga) {
vga_Finish();
} else
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
if (iflags.usevesa) {
vesa_Finish();
} else
#endif
#ifdef SCREEN_8514
} else if (iflags.use8514) {
if (iflags.use8514) {
v8514_Finish();
} else
#endif
}
{}
}
}
@@ -510,6 +557,10 @@ const char *s;
#ifdef SCREEN_VGA
} else if (iflags.usevga) {
vga_xputs(s, col, row);
#endif
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_xputs(s, col, row);
#endif
}
}
@@ -529,6 +580,10 @@ char ch;
} else if (iflags.usevga) {
vga_xputc(ch, attribute);
#endif /*SCREEN_VGA*/
#ifdef SCREEN_VESA
} else if (iflags.usevesa) {
vesa_xputc(ch, attribute);
#endif /*SCREEN_VESA*/
}
}
@@ -541,8 +596,12 @@ unsigned special;
if (!iflags.grmode || !iflags.tile_view) {
xputc((char) ch);
#ifdef SCREEN_VGA
} else {
} else if (iflags.grmode && iflags.usevga) {
vga_xputg(glyphnum, ch, special);
#endif
#ifdef SCREEN_VESA
} else if (iflags.grmode && iflags.usevesa) {
vesa_xputg(glyphnum, ch, special);
#endif
}
}
@@ -555,9 +614,13 @@ char *posbar;
if (!iflags.grmode)
return;
#ifdef SCREEN_VGA
else
else if (iflags.usevga)
vga_update_positionbar(posbar);
#endif
#ifdef SCREEN_VESA
else if (iflags.usevesa)
vesa_update_positionbar(posbar);
#endif
}
#endif
@@ -593,7 +656,12 @@ void
DrawCursor()
{
#ifdef SCREEN_VGA
vga_DrawCursor();
if (iflags.usevga)
vga_DrawCursor();
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_DrawCursor();
#endif
}
@@ -601,7 +669,12 @@ void
HideCursor()
{
#ifdef SCREEN_VGA
vga_HideCursor();
if (iflags.usevga)
vga_HideCursor();
#endif
#ifdef SCREEN_VESA
if (iflags.usevesa)
vesa_HideCursor();
#endif
}
@@ -854,7 +927,9 @@ char *sopt;
* getch();
*/
iflags.grmode = 0;
iflags.hasvesa = 0;
iflags.hasvga = 0;
iflags.usevesa = 0;
iflags.usevga = 0;
if (strncmpi(sopt, "def", 3) == 0) { /* default */
@@ -892,9 +967,10 @@ char *sopt;
#endif
/*
* Auto-detect Priorities (arbitrary for now):
* VGA
* VESA, VGA
*/
if (iflags.hasvga) {
if (iflags.hasvesa) iflags.usevesa = 1;
else if (iflags.hasvga) {
iflags.usevga = 1;
/* VGA depends on BIOS to enable function keys*/
iflags.BIOS = 1;
@@ -911,9 +987,13 @@ tileview(enable)
boolean enable;
{
#ifdef SCREEN_VGA
if (iflags.grmode)
if (iflags.grmode && iflags.usevga)
vga_traditional(enable ? FALSE : TRUE);
#endif
#ifdef SCREEN_VESA
if (iflags.grmode && iflags.usevesa)
vesa_traditional(enable ? FALSE : TRUE);
#endif
}
#endif /* NO_TERMS */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 vidtxt.c $NHDT-Date: 1432512791 2015/05/25 00:13:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.10 $ */
/* NetHack 3.6 vidtxt.c $NHDT-Date: 1457207043 2016/03/05 19:44:03 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.11 $ */
/* Copyright (c) NetHack PC Development Team 1993 */
/* NetHack may be freely redistributed. See license for details. */
/* */
@@ -235,18 +235,19 @@ void txt_cl_eos() /* clear to end of screen */
#else
txt_get_cursor(&col, &row);
txt_cl_end(col, row); /* clear to end of line */
txt_gotoxy(0, (row < (LI - 1) ? row + 1 : (LI - 1)));
regs.h.dl = (char) (CO - 1); /* X of lower right */
regs.h.dh = (char) (LI - 1); /* Y of lower right */
regs.h.cl = 0; /* X of upper left */
/* Y (row) of upper left */
regs.h.ch = (char) (row < (LI - 1) ? row + 1 : (LI - 1));
regs.x.cx = 0;
regs.x.ax = 0;
regs.x.bx = 0;
regs.h.bh = (char) attrib_text_normal;
regs.h.ah = SCROLL;
(void) int86(VIDEO_BIOS, &regs, &regs); /* Scroll or initialize window */
if (row < LI - 1) {
txt_gotoxy(0, (row < (LI - 1) ? row + 1 : (LI - 1)));
regs.h.dl = (char) (CO - 1); /* X of lower right */
regs.h.dh = (char) (LI - 1); /* Y of lower right */
regs.h.cl = 0; /* X of upper left */
/* Y (row) of upper left */
regs.h.ch = (char) (row < (LI - 1) ? row + 1 : (LI - 1));
regs.x.ax = 0;
regs.x.bx = 0;
regs.h.bh = (char) attrib_text_normal;
regs.h.ah = SCROLL;
(void) int86(VIDEO_BIOS, &regs, &regs); /* Scroll or initialize window */
}
#endif
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 vidvga.c $NHDT-Date: 1432512791 2015/05/25 00:13:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */
/* NetHack 3.6 vidvga.c $NHDT-Date: 1457207044 2016/03/05 19:44:04 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.18 $ */
/* Copyright (c) NetHack PC Development Team 1995 */
/* NetHack may be freely redistributed. See license for details. */
/*
@@ -10,7 +10,7 @@
#ifdef SCREEN_VGA /* this file is for SCREEN_VGA only */
#include "pcvideo.h"
#include "tile.h"
#include "pctiles.h"
#include "tileset.h"
#include <dos.h>
#include <ctype.h>
@@ -102,6 +102,8 @@
#include <conio.h>
#endif
extern short glyph2tile[];
/* STATIC_DCL void FDECL(vga_NoBorder, (int)); */
void FDECL(vga_gotoloc, (int, int)); /* This should be made a macro */
void NDECL(vga_backsp);
@@ -109,7 +111,7 @@ void NDECL(vga_backsp);
STATIC_DCL void FDECL(vga_scrollmap, (BOOLEAN_P));
#endif
STATIC_DCL void FDECL(vga_redrawmap, (BOOLEAN_P));
void FDECL(vga_cliparound, (int, int));
static void FDECL(vga_cliparound, (int, int));
STATIC_OVL void FDECL(decal_planar, (struct planar_cell_struct *, unsigned));
#ifdef POSITIONBAR
@@ -117,6 +119,19 @@ STATIC_DCL void NDECL(positionbar);
static void FDECL(vga_special, (int, int, int));
#endif
static void FDECL(vga_DisplayCell, (struct planar_cell_struct *, int, int));
static void FDECL(vga_DisplayCell_O,
(struct overview_planar_cell_struct *, int, int));
static void FDECL(vga_SwitchMode, (unsigned int));
static void FDECL(vga_SetPalette, (const struct Pixel *));
static void FDECL(vga_WriteChar, (int, int, int, int));
static void FDECL(vga_WriteStr, (char *, int, int, int, int));
static void FDECL(read_planar_tile, (unsigned, struct planar_cell_struct *));
static void FDECL(read_planar_tile_O,
(unsigned, struct overview_planar_cell_struct *));
static void FDECL(read_tile_indexes, (unsigned, unsigned char (*)[TILE_X]));
extern int clipx, clipxmax; /* current clipping column from wintty.c */
extern boolean clipping; /* clipping on? from wintty.c */
extern int savevmode; /* store the original video mode */
@@ -135,7 +150,7 @@ extern boolean inmap; /* in the map window */
STATIC_VAR unsigned char __far *font;
STATIC_VAR char *screentable[SCREENHEIGHT];
STATIC_VAR char *paletteptr;
STATIC_VAR const struct Pixel *paletteptr;
STATIC_VAR struct map_struct {
int glyph;
int ch;
@@ -156,8 +171,8 @@ STATIC_VAR struct map_struct {
}
#define TOP_MAP_ROW 1
STATIC_VAR int vgacmap[CLR_MAX] = { 0, 3, 5, 9, 4, 8, 12, 14,
11, 2, 6, 7, 1, 8, 12, 13 };
STATIC_VAR 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}; */
@@ -187,13 +202,8 @@ 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;
#if defined(USE_TILES)
STATIC_VAR struct tibhdr_struct tibheader;
/* extern FILE *tilefile; */ /* Not needed in here most likely */
#endif
STATIC_VAR struct planar_cell_struct planecell;
STATIC_VAR struct overview_planar_cell_struct planecell_O;
/* STATIC_VAR int g_attribute; */ /* Current attribute to use */
@@ -365,6 +375,11 @@ unsigned special; /* special feature: corpse, invis, detected, pet, ridden -
int attr;
int ry;
/* If statue glyph, map to the generic statue */
if (GLYPH_STATUE_OFF <= glyphnum && glyphnum < GLYPH_STATUE_OFF + NUMMONS) {
glyphnum = objnum_to_glyph(STATUE);
}
row = currow;
col = curcol;
if ((col < 0 || col >= COLNO)
@@ -380,20 +395,14 @@ unsigned special; /* special feature: corpse, invis, detected, pet, ridden -
vga_WriteChar((unsigned char) ch, col, row, attr);
} else if (!iflags.over_view) {
if ((col >= clipx) && (col <= clipxmax)) {
if (!ReadPlanarTileFile(glyph2tile[glyphnum], &planecell)) {
if (map[ry][col].special)
decal_planar(planecell, special);
vga_DisplayCell(planecell, col - clipx, row);
} else
pline("vga_xputg: Error reading tile (%d,%d) from file",
glyphnum, glyph2tile[glyphnum]);
read_planar_tile(glyphnum, &planecell);
if (map[ry][col].special)
decal_planar(&planecell, special);
vga_DisplayCell(&planecell, col - clipx, row);
}
} else {
if (!ReadPlanarTileFile_O(glyph2tile[glyphnum], &planecell_O))
vga_DisplayCell_O(planecell_O, col, row);
else
pline("vga_xputg: Error reading tile (%d,%d) from file", glyphnum,
glyph2tile[glyphnum]);
read_planar_tile_O(glyphnum, &planecell_O);
vga_DisplayCell_O(&planecell_O, col, row);
}
if (col < (CO - 1))
++col;
@@ -422,7 +431,7 @@ int col, row;
}
#if defined(USE_TILES) && defined(CLIPPING)
void
static void
vga_cliparound(x, y)
int x, y;
{
@@ -489,22 +498,13 @@ boolean clearfirst;
t = map[y][x].glyph;
if (!(clearfirst && t == cmap_to_glyph(S_stone))) {
if (!iflags.over_view) {
if (!ReadPlanarTileFile(glyph2tile[t], &planecell)) {
if (map[y][x].special)
decal_planar(planecell, map[y][x].special);
vga_DisplayCell(planecell, x - clipx,
y + TOP_MAP_ROW);
} else
pline("vga_redrawmap: Error reading tile (%d,%d)",
t, glyph2tile[t]);
read_planar_tile(t, &planecell);
if (map[y][x].special)
decal_planar(&planecell, map[y][x].special);
vga_DisplayCell(&planecell, x - clipx, y + TOP_MAP_ROW);
} else {
if (!ReadPlanarTileFile_O(glyph2tile[t],
&planecell_O)) {
vga_DisplayCell_O(planecell_O, x,
y + TOP_MAP_ROW);
} else
pline("vga_redrawmap: Error reading tile (%d,%d)",
t, glyph2tile[t]);
read_planar_tile_O(t, &planecell_O);
vga_DisplayCell_O(&planecell_O, x, y + TOP_MAP_ROW);
}
}
}
@@ -632,19 +632,98 @@ boolean left;
for (y = 0; y < ROWNO; ++y) {
for (x = i; x < j; x += 2) {
t = map[y][x].glyph;
if (!ReadPlanarTileFile(glyph2tile[t], &planecell)) {
if (map[y][x].special)
decal_planar(planecell, map[y][x].special);
vga_DisplayCell(planecell, x - clipx, y + TOP_MAP_ROW);
} else {
pline("vga_shiftmap: Error reading tile (%d,%d)", t,
glyph2tile[t]);
}
read_planar_tile(t, &planecell);
if (map[y][x].special)
decal_planar(&planecell, map[y][x].special);
vga_DisplayCell(&planecell, x - clipx, y + TOP_MAP_ROW);
}
}
}
#endif /* SCROLLMAP */
static void
read_planar_tile(glyph, cell)
unsigned glyph;
struct planar_cell_struct *cell;
{
unsigned char indexes[TILE_Y][TILE_X];
unsigned plane, y, byte, bit;
read_tile_indexes(glyph, indexes);
/* cell->plane[0..3].image[0..15][0..1] */
for (plane = 0; plane < SCREENPLANES; ++plane) {
for (y = 0; y < TILE_Y; ++y) {
for (byte = 0; byte < MAX_BYTES_PER_CELL; ++byte) {
unsigned char b = 0;
for (bit = 0; bit < 8; ++bit) {
unsigned char x = byte * 8 + bit;
unsigned char i = indexes[y][x];
b <<= 1;
if (i & (0x8 >> plane)) b |= 1;
}
cell->plane[plane].image[y][byte] = b;
}
}
}
}
static void
read_planar_tile_O(glyph, cell)
unsigned glyph;
struct overview_planar_cell_struct *cell;
{
unsigned char indexes[TILE_Y][TILE_X];
unsigned plane, y, bit;
read_tile_indexes(glyph, indexes);
/* cell->plane[0..3].image[0..15][0..0] */
for (plane = 0; plane < SCREENPLANES; ++plane) {
for (y = 0; y < TILE_Y; ++y) {
unsigned char b = 0;
for (bit = 0; bit < 8; ++bit) {
unsigned char x = bit * 2;
unsigned char i = indexes[y][x];
b <<= 1;
if (i & (0x8 >> plane)) b |= 1;
}
cell->plane[plane].image[y][0] = b;
}
}
}
static void
read_tile_indexes(glyph, indexes)
unsigned glyph;
unsigned char (*indexes)[TILE_X];
{
const struct TileImage *tile;
unsigned x, y;
/* We don't have enough colors to show the statues */
if (glyph >= GLYPH_STATUE_OFF) {
glyph = GLYPH_OBJ_OFF + STATUE;
}
/* Get the tile from the image */
tile = get_tile(glyph2tile[glyph]);
/* Map to a 16 bit palette; assume colors laid out as in default tileset */
memset(indexes, 0, sizeof(indexes));
for (y = 0; y < TILE_Y && y < tile->height; ++y) {
for (x = 0; x < TILE_X && x < tile->width; ++x) {
unsigned i = tile->indexes[y * tile->width + x];
if (i == 28) {
i = 0;
} else if (i == 16) {
i = 13;
} else if (i > 15) {
i = 15;
}
indexes[y][x] = i;
}
}
}
STATIC_OVL void
decal_planar(gp, special)
struct planar_cell_struct *gp;
@@ -671,17 +750,20 @@ vga_Init(void)
int i;
#ifdef USE_TILES
const char *tile_file;
int tilefailure = 0;
/*
* Attempt to open the required tile files. If we can't
* don't perform the video mode switch, use TTY code instead.
*
*/
if (OpenTileFile(NETHACK_PLANAR_TILEFILE, FALSE))
tile_file = iflags.wc_tile_file;
if (tile_file == NULL || tile_file == '\0') {
tile_file = "nhtiles.bmp";
}
if (!read_tiles(tile_file, FALSE))
tilefailure |= 1;
if (OpenTileFile(NETHACK_OVERVIEW_TILEFILE, TRUE))
tilefailure |= 2;
if (ReadTileFileHeader(&tibheader, FALSE))
if (get_palette() == NULL)
tilefailure |= 4;
if (tilefailure) {
@@ -708,7 +790,7 @@ vga_Init(void)
/* vga_NoBorder(BACKGROUND_VGA_COLOR); */ /* Not needed after palette
mod */
#ifdef USE_TILES
paletteptr = tibheader.palette;
paletteptr = get_palette();
iflags.tile_view = TRUE;
iflags.over_view = FALSE;
#else
@@ -730,7 +812,7 @@ vga_Init(void)
* mode (video mode 0x12). No other modes are currently supported.
*
*/
void
static void
vga_SwitchMode(unsigned int mode)
{
union REGS regs;
@@ -760,8 +842,7 @@ vga_SwitchMode(unsigned int mode)
void
vga_Finish(void)
{
CloseTileFile(0);
CloseTileFile(1);
free_tiles();
vga_SwitchMode(MODETEXT);
windowprocs.win_cliparound = tty_cliparound;
g_attribute = attrib_text_normal;
@@ -853,7 +934,7 @@ vga_detect()
* do it using the colour 'colour'.
*
*/
void
static void
vga_WriteChar(chr, col, row, colour)
int chr, col, row, colour;
{
@@ -901,7 +982,7 @@ int chr, col, row, colour;
* not the x,y pixel location.
*
*/
void
static void
vga_DisplayCell(gp, col, row)
struct planar_cell_struct *gp;
int col, row;
@@ -932,7 +1013,7 @@ int col, row;
egawriteplane(15);
}
void
static void
vga_DisplayCell_O(gp, col, row)
struct overview_planar_cell_struct *gp;
int col, row;
@@ -965,7 +1046,7 @@ int col, row;
* is 'len' at location (x,y) using the 'colour' colour.
*
*/
void
static void
vga_WriteStr(s, len, col, row, colour)
char *s;
int len, col, row, colour;
@@ -993,19 +1074,20 @@ int len, col, row, colour;
* 16 colour mode at 640 x 480.
*
*/
void
static void
vga_SetPalette(p)
char *p;
const struct Pixel *p;
{
union REGS regs;
int i;
outportb(0x3c6, 0xff);
for (i = 0; i < COLORDEPTH; ++i) {
struct Pixel color = (i == 13) ? p[16] : p[i];
outportb(0x3c8, i);
outportb(0x3c9, (*p++) >> 2);
outportb(0x3c9, (*p++) >> 2);
outportb(0x3c9, (*p++) >> 2);
outportb(0x3c9, color.r >> 2);
outportb(0x3c9, color.g >> 2);
outportb(0x3c9, color.b >> 2);
}
regs.x.bx = 0x0000;
for (i = 0; i < COLORDEPTH; ++i) {
@@ -1021,10 +1103,10 @@ static unsigned char colorbits[] = { 0x08, 0x04, 0x02, 0x01 };
#ifdef POSITIONBAR
#define PBAR_ROW (LI - 4)
#define PBAR_COLOR_ON 15 /* slate grey background colour of tiles */
#define PBAR_COLOR_OFF 12 /* bluish grey, used in old style only */
#define PBAR_COLOR_STAIRS 9 /* brown */
#define PBAR_COLOR_HERO 14 /* creamy white */
#define PBAR_COLOR_ON 13 /* slate grey background colour of tiles */
#define PBAR_COLOR_OFF 0 /* bluish grey, used in old style only */
#define PBAR_COLOR_STAIRS 10 /* brown */
#define PBAR_COLOR_HERO 15 /* creamy white */
static unsigned char pbar[COLNO];
@@ -1152,7 +1234,7 @@ int chr, col, color;
pixy = PBAR_ROW * MAX_ROWS_PER_CELL;
for (vplane = 0; vplane < SCREENPLANES; ++vplane) {
egareadplane(vplane);
egareadplane(SCREENPLANES - 1 - vplane);
y = pixy;
for (i = 0; i < ROWS_PER_CELL; ++i) {
tmp_d = screentable[y++] + col;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 pcmain.c $NHDT-Date: 1451697809 2016/01/02 01:23:29 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.68 $ */
/* NetHack 3.6 pcmain.c $NHDT-Date: 1457207045 2016/03/05 19:44:05 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -115,9 +115,11 @@ char *argv[];
{
register int fd;
register char *dir;
#if defined(WIN32)
#if defined(WIN32) || defined(MSDOS)
char *envp = NULL;
char *sptr = NULL;
#endif
#if defined(WIN32)
char fnamebuf[BUFSZ], encodedfnamebuf[BUFSZ];
boolean save_getreturn_status = getreturn_enabled;
#endif

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 nhraykey.c $NHDT-Date: 1432512794 2015/05/25 00:13:14 $ $NHDT-Branch: master $:$NHDT-Revision: 1.15 $ */
/* NetHack 3.6 nhraykey.c $NHDT-Date: 1457207047 2016/03/05 19:44:07 $ $NHDT-Branch: chasonr $:$NHDT-Revision: 1.16 $ */
/* Copyright (c) NetHack PC Development Team 2003 */
/* NetHack may be freely redistributed. See license for details. */
@@ -559,19 +559,24 @@ INPUT_RECORD *ir;
scan = ir->Event.KeyEvent.wVirtualScanCode;
shiftstate = ir->Event.KeyEvent.dwControlKeyState;
vk = ir->Event.KeyEvent.wVirtualKeyCode;
keycode = MapVirtualKey(vk, 2);
if (is_altseq(shiftstate)) {
if (ch || inmap(keycode, vk))
altseq = 1;
else
altseq = -1; /* invalid altseq */
}
if (ch || iskeypad(scan) || altseq) {
done = 1; /* Stop looking */
retval = 1; /* Found what we sought */
if (scan == 0 && vk == 0) {
/* It's the bogus_key. Discard it */
ReadConsoleInput(hConIn,ir,1,&count);
} else {
/* Strange Key event; let's purge it to avoid trouble */
ReadConsoleInput(hConIn, ir, 1, &count);
keycode = MapVirtualKey(vk, 2);
if (is_altseq(shiftstate)) {
if (ch || inmap(keycode, vk))
altseq = 1;
else
altseq = -1; /* invalid altseq */
}
if (ch || iskeypad(scan) || altseq) {
done = 1; /* Stop looking */
retval = 1; /* Found what we sought */
} else {
/* Strange Key event; let's purge it to avoid trouble */
ReadConsoleInput(hConIn, ir, 1, &count);
}
}
} else if ((ir->EventType == MOUSE_EVENT