Merge branch 'master' into background_tiles

Conflicts:
	src/display.c
This commit is contained in:
nhmall
2015-06-09 21:38:21 -04:00
19 changed files with 104 additions and 65 deletions

6
Files
View File

@@ -230,9 +230,9 @@ win/X11:
(files for X versions)
Install.X11 NetHack.ad Window.c dialogs.c ibm.bdf
nethack.rc nh10.bdf nh32icon nh56icon nh72icon
nh_icon.xpm pet_mark.xbm rip.xpm tile2x11.c winX.c
winmap.c winmenu.c winmesg.c winmisc.c winstat.c
wintext.c winval.c
nh_icon.xpm pet_mark.xbm pilemark.xbm rip.xpm tile2x11.c
winX.c winmap.c winmenu.c winmesg.c winmisc.c
winstat.c wintext.c winval.c
win/gem:
(files for GEM versions)

View File

@@ -1,4 +1,4 @@
.\" $NHDT-Branch: status_hilite $:$NHDT-Revision: 1.172 $ $NHDT-Date: 1433212164 2015/06/02 02:29:24 $
.\" $NHDT-Branch: master $:$NHDT-Revision: 1.174 $ $NHDT-Date: 1433842150 2015/06/09 09:29:10 $
.ds h0 "NetHack Guidebook
.ds h1
.ds h2 %
@@ -57,7 +57,7 @@ A Guide to the Mazes of Menace
(Guidebook for NetHack)
.au
Original version - Eric S. Raymond
(Edited and expanded for 3.6 by Michael Allison, Mike Stephenson)
(Edited and expanded for 3.6 by Mike Stephenson and others)
.hn 1
Preface - Version 3.6
\fBThis version of the game is special in a particular way. Near the end of

View File

@@ -45,7 +45,7 @@
%.au
\author{Original version - Eric S. Raymond\\
(Edited and expanded for 3.6 by Michael Allison, Mike Stephenson)}
(Edited and expanded for 3.6 by Mike Stephenson and others)}
\date{June 1, 2015}
\maketitle

View File

@@ -941,6 +941,7 @@ tty: fix crashing when a location has more than 32k items
tty: fix segfault when MD termcap is not defined
tty: do not cut off statuslines at 80 characters for wider term
tty: prevent accidental escapes from string entries
tty: hilight object piles
unix: remove use of parentheses in nethack man page usage that confused a
man page conversion tool
unix: new -wwindowtype option
@@ -990,6 +991,7 @@ X11: added support for hilite_pet to text map mode
X11: ensure vertical scrollbar shows up in text display windows
X11: fix typo in mouse click sanity check; result might have pointed to
spurious location after window resizing
X11: use a plus sign to mark piles of objects
platforms that support hangup: SAFERHANGUP to avoid losing objects in transit
between lists when hangup occurs, and also avoid cheats due to
well-timed hangups to stop a long melee

View File

@@ -840,7 +840,14 @@ int mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special, int x, int y
the default set.
If the glyph represents something special such as a pet,
that information is returned as set bits in "special."
that information is returned as set bits in "special.":
MG_CORPSE 0x01
MG_INVIS 0x02
MG_DETECT 0x04
MG_PET 0x08
MG_RIDDEN 0x10
MG_STATUE 0x20
MG_OBJPILE 0x40
Usually called from the window port's print_glyph()
routine.

View File

@@ -60,6 +60,7 @@
#define MG_PET 0x08
#define MG_RIDDEN 0x10
#define MG_STATUE 0x20
#define MG_OBJPILE 0x40 /* more than one stack of objects */
/* sellobj_state() states */
#define SELL_NORMAL (0)

View File

@@ -56,8 +56,13 @@ struct text_map_info_t {
square_lbearing;
};
struct tile_glyph_info_t {
unsigned short glyph;
unsigned special;
};
struct tile_map_info_t {
unsigned short glyphs[ROWNO][COLNO]; /* Saved glyph numbers. */
struct tile_glyph_info_t glyphs[ROWNO][COLNO]; /* Saved glyph numbers. */
GC white_gc;
GC black_gc;
unsigned long image_width; /* dimensions of tile image */
@@ -247,6 +252,8 @@ typedef struct {
int message_lines; /* number of lines to attempt to show */
String pet_mark_bitmap; /* X11 bitmap file used to mark pets */
Pixel pet_mark_color; /* color of pet mark */
String pilemark_bitmap; /* X11 bitmap file used to mark item piles */
Pixel pilemark_color; /* color of item pile mark */
#ifdef GRAPHIC_TOMBSTONE
String tombstone; /* name of XPM file for tombstone */
int tombtext_x; /* x-coord of center of first tombstone text */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1433840054 2015/06/09 08:54:14 $ $NHDT-Branch: win32-x64-working $:$NHDT-Revision: 1.62 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1433899975 2015/06/10 01:32:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.61 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1694,55 +1694,23 @@ xchar x, y;
}
/*
* This is used to get the glyph for background to merge into
* tile ports to improve the appearance of stuff on dark room
* squares and the plane of air there.
* This will be used to get the glyph for the background so that
* it can potentially be merged into graphical window ports
* to improve the appearance of stuff on dark room
* squares and the plane of air etc.
*
* Until that is working correctly in the branch, however, for now
* we just return the standard lit room background.
*/
STATIC_OVL int
get_bk_glyph(x,y)
xchar x, y;
{
int idx;
int retglyph = NO_GLYPH;
struct rm *lev = &levl[x][y];
switch (lev->typ) {
case SCORR:
case STONE:
idx = level.flags.arboreal ? S_tree : S_stone;
break;
case ROOM:
idx = S_room;
break;
case CORR:
idx = (lev->waslit || flags.lit_corridor) ? S_litcorr : S_corr;
break;
case ICE:
idx = S_ice;
break;
case AIR:
idx = S_air;
break;
case CLOUD:
idx = S_cloud;
break;
case WATER:
idx = S_water;
break;
default:
idx = S_room;
break;
}
if (!cansee(x, y) && !lev->waslit) {
/* Floor spaces are dark if unlit. Corridors are dark if unlit. */
if (lev->typ == ROOM && idx == S_room)
idx = (flags.dark_room && iflags.use_color) ?
(DARKROOMSYM) : S_stone;
else if (lev->typ == CORR && idx == S_litcorr)
idx = S_corr;
}
return cmap_to_glyph(idx);
return cmap_to_glyph(S_room);
}
/* -------------------------------------------------------------------------

View File

@@ -83,6 +83,8 @@ unsigned *ospecial;
else
obj_color(STATUE);
special |= MG_STATUE;
if (level.objects[x][y] && level.objects[x][y]->nexthere)
special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_WARNING_OFF))
>= 0) { /* a warning flash */
idx = offset + SYM_OFF_W;
@@ -149,6 +151,8 @@ unsigned *ospecial;
}
} else
obj_color(offset);
if (offset != BOULDER && level.objects[x][y] && level.objects[x][y]->nexthere)
special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)
@@ -166,6 +170,8 @@ unsigned *ospecial;
else
mon_color(offset);
special |= MG_CORPSE;
if (level.objects[x][y] && level.objects[x][y]->nexthere)
special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)

View File

@@ -150,7 +150,8 @@ histemple_at(priest, x, y)
register struct monst *priest;
register xchar x, y;
{
return ((boolean)((EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE))
return ((boolean)(priest && priest->ispriest
&& (EPRI(priest)->shroom == *in_rooms(x, y, TEMPLE))
&& on_level(&(EPRI(priest)->shrlevel), &u.uz)));
}
@@ -342,7 +343,7 @@ boolean
p_coaligned(priest)
struct monst *priest;
{
return ((boolean)(u.ualign.type == ((int) EPRI(priest)->shralign)));
return ((boolean)(u.ualign.type == mon_aligntyp(priest)));
}
STATIC_OVL boolean
@@ -542,7 +543,7 @@ register struct monst *priest;
}
/* priests don't chat unless peaceful and in their own temple */
if (!histemple_at(priest, priest->mx, priest->my) || !priest->mpeaceful
if (!inhistemple(priest) || !priest->mpeaceful
|| !priest->mcanmove || priest->msleeping) {
static const char *cranky_msg[3] = {
"Thou wouldst have words, eh? I'll give thee a word or two!",

View File

@@ -50,6 +50,9 @@ NetHack.ad: ../win/X11/NetHack.ad
pet_mark.xbm: ../win/X11/pet_mark.xbm
cp ../win/X11/pet_mark.xbm pet_mark.xbm
pilemark.xbm: ../win/X11/pilemark.xbm
cp ../win/X11/pilemark.xbm pilemark.xbm
rip.xpm: ../win/X11/rip.xpm
cp ../win/X11/rip.xpm rip.xpm
@@ -152,5 +155,5 @@ dungeon: dungeon.def ../util/makedefs ../util/dgn_comp
spotless:
-rm -f spec_levs quest_levs *.lev $(VARDAT) dungeon dungeon.pdf
-rm -f nhdat x11tiles beostiles pet_mark.xbm rip.xpm mapbg.xpm
-rm -f nhdat x11tiles beostiles pet_mark.xbm pilemark.xbm rip.xpm mapbg.xpm
-rm -f rip.img GEM_RSC.RSC title.img nh16.img NetHack.ad

View File

@@ -156,6 +156,9 @@ NetHack.ad: $(GAME)
pet_mark.xbm:
( cd dat ; $(MAKE) pet_mark.xbm )
pilemark.xbm:
( cd dat ; $(MAKE) pilemark.xbm )
rip.xpm:
( cd dat ; $(MAKE) rip.xpm )

View File

@@ -29,7 +29,7 @@ WINSRC = $(WINX11SRC)
WINOBJ = $(WINX11OBJ)
WINLIB = $(WINX11LIB)
VARDATND = x11tiles NetHack.ad pet_mark.xbm
VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xbm
#WINTTYLIB=-lcurses

View File

@@ -197,5 +197,6 @@ dialogs.c - A better dialog widget. Original code (modified slightly
Theisen. This is from his Ghostview program (which is under
the GNU public license, v2 or higher).
pet_mark.xbm - A pet indicator bitmap for tiles.
pilemark.xbm - Item pile indicator for tiles.
rip.xpm - A graphical tombstone.
tile2x11.c - Converts win/share tiles for X11 use.

View File

@@ -27,6 +27,9 @@ NetHack.tile_file: x11tiles
! The annotation of pets.
!NetHack.pet_mark_bitmap: pet_mark.xbm
!NetHack.pet_mark_color: Red
! The annotation of item piles.
!NetHack.pilemark_bitmap: pilemark.xbm
!NetHack.pilemark_color: Green
! Tombstone
! The image file

6
win/X11/pilemark.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define pilemark_width 16
#define pilemark_height 16
static unsigned char pilemark_bits[] = {
0x00, 0x00, 0x18, 0x00, 0x18, 0x00, 0x7e, 0x00, 0x7e, 0x00, 0x18, 0x00,
0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

View File

@@ -980,6 +980,12 @@ static XtResource resources[] = {
{ nhStr("pet_mark_color"), nhStr("Pet_mark_color"), XtRPixel,
sizeof(XtRPixel), XtOffset(AppResources *, pet_mark_color), XtRString,
nhStr("Red") },
{ nhStr("pilemark_bitmap"), nhStr("Pilemark_bitmap"), XtRString,
sizeof(String), XtOffset(AppResources *, pilemark_bitmap), XtRString,
nhStr("pilemark.xbm") },
{ nhStr("pilemark_color"), nhStr("Pilemark_color"), XtRPixel,
sizeof(XtRPixel), XtOffset(AppResources *, pilemark_color), XtRString,
nhStr("Green") },
#ifdef GRAPHIC_TOMBSTONE
{ nhStr("tombstone"), "Tombstone", XtRString, sizeof(String),
XtOffset(AppResources *, tombstone), XtRString, "rip.xpm" },

View File

@@ -88,7 +88,7 @@ int glyph, bkglyph;
/* update both the tile and text backing stores */
{
unsigned short *t_ptr = &map_info->tile_map.glyphs[y][x];
unsigned short *t_ptr = &map_info->tile_map.glyphs[y][x].glyph;
if (*t_ptr != glyph) {
*t_ptr = glyph;
@@ -108,6 +108,11 @@ int glyph, bkglyph;
(void) mapglyph(glyph, &och, &color, &special, x, y);
ch = (uchar) och;
if (special != map_info->tile_map.glyphs[y][x].special) {
map_info->tile_map.glyphs[y][x].special = special;
update_bbox = TRUE;
}
/* Only update if we need to. */
ch_ptr = &map_info->text_map.text[y][x];
@@ -122,6 +127,7 @@ int glyph, bkglyph;
#ifdef TEXTCOLOR
if ((special & MG_PET) && iflags.hilite_pet)
color += CLR_MAX;
if ((special & MG_OBJPILE) && iflags.use_inverse)
*co_ptr = color;
#endif
if (!map_info->is_tile)
@@ -178,6 +184,7 @@ struct tile_annotation {
};
static struct tile_annotation pet_annotation;
static struct tile_annotation pile_annotation;
static void
init_annotation(annotation, filename, colorpixel)
@@ -232,6 +239,8 @@ post_process_tiles()
init_annotation(&pet_annotation, appResources.pet_mark_bitmap,
appResources.pet_mark_color);
init_annotation(&pile_annotation, appResources.pilemark_bitmap,
appResources.pilemark_color);
}
/*
@@ -902,14 +911,15 @@ static void
map_all_stone(map_info)
struct map_info_t *map_info;
{
int i;
int x,y;
unsigned short *sp, stone;
stone = cmap_to_glyph(S_stone);
for (sp = (unsigned short *) map_info->tile_map.glyphs, i = 0;
i < ROWNO * COLNO; sp++, i++) {
*sp = stone;
}
for (x = 0; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {
map_info->tile_map.glyphs[y][x].glyph = stone;
map_info->tile_map.glyphs[y][x].special = 0;
}
}
/*
@@ -1248,7 +1258,7 @@ boolean inverted;
for (row = start_row; row <= stop_row; row++) {
for (cur_col = start_col; cur_col <= stop_col; cur_col++) {
int glyph = tile_map->glyphs[row][cur_col];
int glyph = tile_map->glyphs[row][cur_col].glyph;
int tile = glyph2tile[glyph];
int src_x, src_y;
int dest_x = cur_col * tile_map->square_width;
@@ -1276,6 +1286,21 @@ boolean inverted;
XSetForeground(dpy, tile_map->black_gc,
BlackPixelOfScreen(screen));
}
if ((tile_map->glyphs[row][cur_col].special & MG_OBJPILE)) {
/* draw object pile annotation (a plus sign) */
XSetForeground(dpy, tile_map->black_gc,
pile_annotation.foreground);
XSetClipOrigin(dpy, tile_map->black_gc, dest_x, dest_y);
XSetClipMask(dpy, tile_map->black_gc,
pile_annotation.bitmap);
XCopyPlane(dpy, pile_annotation.bitmap, XtWindow(wp->w),
tile_map->black_gc, 0, 0, pile_annotation.width,
pile_annotation.height, dest_x, dest_y, 1);
XSetClipOrigin(dpy, tile_map->black_gc, 0, 0);
XSetClipMask(dpy, tile_map->black_gc, None);
XSetForeground(dpy, tile_map->black_gc,
BlackPixelOfScreen(screen));
}
}
}
@@ -1284,7 +1309,7 @@ boolean inverted;
XtDisplay(wp->w), XtWindow(wp->w),
#ifdef USE_WHITE
/* kludge for white square... */
tile_map->glyphs[start_row][start_col] == cmap_to_glyph(S_ice)
tile_map->glyphs[start_row][start_col].glyph == cmap_to_glyph(S_ice)
? tile_map->black_gc
: tile_map->white_gc,
#else

View File

@@ -3040,7 +3040,7 @@ int glyph, bkglyph;
/* must be after color check; term_end_color may turn off inverse too */
if (((special & MG_PET) && iflags.hilite_pet)
|| ((special & MG_DETECT) && iflags.use_inverse)) {
|| ((special & (MG_DETECT|MG_OBJPILE)) && iflags.use_inverse)) {
term_start_attr(ATR_INVERSE);
reverse_on = TRUE;
}