finish mapglyph() removal

This commit is contained in:
nhmall
2021-01-02 09:22:53 -05:00
parent 18116d4a7b
commit 1d94e65e45
26 changed files with 242 additions and 704 deletions

View File

@@ -369,7 +369,7 @@ Using the cross-compiler, build the following targets:
src/fountain.c, src/hack.c, src/hacklib.c,
src/insight.c, src/invent.c, src/isaac64.c,
src/light.c, src/lock.c, src/mail.c,
src/makemon.c, src/mapglyph.c, src/mcastu.c,
src/makemon.c, src/mcastu.c,
src/mdlib.c, src/mhitm.c, src/mhitu.c, src/minion.c,
src/mklev.c, src/mkmap.c, src/mkmaze.c, src/mkobj.c,
src/mkroom.c, src/mon.c, src/mondata.c,

View File

@@ -18,11 +18,10 @@ Contents:
III. Global variables
IV. WINCAP preferences support
V. New or respecified common, high level routines
VI. Helper routines
VII. Game startup
VIII. Conventions
IX. Implementation and Multi-window support
X. WINCHAIN
VI. Game startup
VII. Conventions
VIII. Implementation and Multi-window support
IX. WINCHAIN
I. Window Types and Terminology
@@ -140,7 +139,7 @@ putmixed(window, attr, str)
such as pet names, etc.
NNNN is a hexadecimal value representing the glyph.
If a window port does not yet support special handling of
the glyph value, it can use genl_putmixed (mapglyph.c)
the glyph value, it can use genl_putmixed (windows.c)
which converts the encoded glyph into a character symbol.
Multiple putmixed()s are output on separate lines. Attributes
@@ -945,33 +944,7 @@ pline(str, ...)
by Norep() and pline(). If the window system is not active
(!iflags.window_inited) pline() uses raw_print().
VI. Helper Routines
These are not part of the interface. They may be called by your
window port routines to perform the desired task, instead of duplicating
the necessary code in each window port.
int mapglyph(int glyph, int *ochar, int *ocolor, unsigned *special,
int x, int y, unsigned mgflags)
-- Maps glyph at x,y to NetHack ascii character and color.
The return value is an index into the showsyms[] array, in
case a port wants to index into its own alternative
set of display symbols (such as a unicode set) instead of
the default set.
If the glyph represents something special such as a pet,
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.
VII. Game startup
VI. Game startup
The following is the general order in which calls from main() should be made,
as they relate to the window system. The actual code may differ, but the
@@ -1010,7 +983,7 @@ Process_options() is currently still unique to each port. There may be need
in the future to make it possible to replace this on a per window-port basis.
VIII. Conventions
VII. Conventions
init_nhwindows() is expected to display a gee-whiz banner window, including
the Copyright message. It is recommended that the COPYRIGHT_BANNER_A,
@@ -1036,7 +1009,7 @@ in win/X11. The files in these directories contain _only_ window port code,
and may be replaced completely by other window ports.
IX. Implementation and Multi-window support
VIII. Implementation and Multi-window support
NetHack 3.2 and higher support multiple window systems in the same binary.
When writing a new window-port, you need to follow the following guidelines:
@@ -1129,7 +1102,7 @@ printing any message, because raw_print() cannot function without first
setting the window-port.
X. WINCHAIN
IX. WINCHAIN
WINCHAIN is an optional facility that allows the SYSCF_FILE to specify a
series of processors that will see each call from the core to the window

View File

@@ -1201,14 +1201,6 @@ E int FDECL(bagotricks, (struct obj *, BOOLEAN_P, int *));
E boolean FDECL(propagate, (int, BOOLEAN_P, BOOLEAN_P));
E boolean FDECL(usmellmon, (struct permonst *));
/* ### mapglyph.c ### */
E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int, unsigned));
E char *FDECL(encglyph, (int));
E char *FDECL(decode_mixed, (char *, const char *));
E void FDECL(genl_putmixed, (winid, int, const char *));
E boolean FDECL(menuitem_invert_test, (int, unsigned, BOOLEAN_P));
/* ### mcastu.c ### */
E int FDECL(castmu, (struct monst *, struct attack *, BOOLEAN_P, BOOLEAN_P));
@@ -3044,6 +3036,11 @@ E void NDECL(dump_close_log);
E void FDECL(dump_redirect, (BOOLEAN_P));
E void FDECL(dump_forward_putstr, (winid, int, const char*, int));
E int FDECL(has_color, (int));
E int FDECL(glyph2ttychar, (int));
E char *FDECL(encglyph, (int));
E char *FDECL(decode_mixed, (char *, const char *));
E void FDECL(genl_putmixed, (winid, int, const char *));
E boolean FDECL(menuitem_invert_test, (int, unsigned, BOOLEAN_P));
/* ### winnt.c ### */
#ifdef WIN32

View File

@@ -39,7 +39,6 @@ struct engr *head_engr;
#ifdef TEXTCOLOR
/*
* This must be the same order as used for buzz() in zap.c.
* (They're only used in mapglyph.c so probably shouldn't be here.)
*/
const int zapcolors[NUM_ZAP] = {
HI_ZAP, /* 0 - missile */

View File

@@ -1617,7 +1617,7 @@ boolean at_stairs, falling, portal;
/* Reset the screen. */
vision_reset(); /* reset the blockages */
g.glyphmap_perlevel_flags = 0L; /* force per-level mapglyph() changes */
g.glyphmap_perlevel_flags = 0L; /* force per-level map_glyphmod() changes */
docrt(); /* does a full vision recalc */
flush_screen(-1);

View File

@@ -152,7 +152,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '.', "floor of a room", C(CLR_GRAY) }, /* room */
/*20*/ { '.', "dark part of a room", C(CLR_BLACK) }, /* dark room */
{ '#', "corridor", C(CLR_GRAY) }, /* dark corr */
{ '#', "lit corridor", C(CLR_GRAY) }, /* lit corr (see mapglyph.c) */
{ '#', "lit corridor", C(CLR_GRAY) }, /* lit corr, see map_glyphmod() */
{ '<', "staircase up", C(CLR_GRAY) }, /* upstair */
{ '>', "staircase down", C(CLR_GRAY) }, /* dnstair */
{ '<', "ladder up", C(CLR_BROWN) }, /* upladder */
@@ -195,7 +195,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '^', "anti-magic field", C(HI_ZAP) }, /* trap */
{ '^', "polymorph trap", C(CLR_BRIGHT_GREEN) }, /* trap */
{ '~', "vibrating square", C(CLR_MAGENTA) }, /* "trap" */
/* zap colors are changed by mapglyph() to match type of beam */
/* zap colors are changed by map_glyphmod() to match type of beam */
{ '|', "", C(CLR_GRAY) }, /* vbeam */
{ '-', "", C(CLR_GRAY) }, /* hbeam */
{ '\\', "", C(CLR_GRAY) }, /* lslant */
@@ -210,7 +210,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '*', "", C(HI_ZAP) },
{ '#', "poison cloud", C(CLR_BRIGHT_GREEN) }, /* part of a cloud */
{ '?', "valid position", C(CLR_BRIGHT_GREEN) }, /* target position */
/* swallow colors are changed by mapglyph() to match engulfing monst */
/* swallow colors are changed by map_glyphmod() to match engulfing monst */
{ '/', "", C(CLR_GREEN) }, /* swallow top left */
{ '-', "", C(CLR_GREEN) }, /* swallow top center */
{ '\\', "", C(CLR_GREEN) }, /* swallow top right */
@@ -219,7 +219,7 @@ const struct symdef defsyms[MAXPCHARS] = {
{ '\\', "", C(CLR_GREEN) }, /* swallow bottom left */
{ '-', "", C(CLR_GREEN) }, /* swallow bottom center */
{ '/', "", C(CLR_GREEN) }, /* swallow bottom right */
/* explosion colors are changed by mapglyph() to match type of expl. */
/* explosion colors are changed by map_glyphmod() to match type of expl. */
{ '/', "", C(CLR_ORANGE) }, /* explosion top left */
{ '-', "", C(CLR_ORANGE) }, /* explosion top center */
{ '\\', "", C(CLR_ORANGE) }, /* explosion top right */

View File

@@ -1,497 +0,0 @@
/* NetHack 3.7 mapglyph.c $NHDT-Date: 1596498176 2020/08/03 23:42:56 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.65 $ */
/* Copyright (c) David Cohrs, 1991 */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
#if defined(TTY_GRAPHICS)
#include "wintty.h" /* for prototype of has_color() only */
#endif
#include "color.h"
#define HI_DOMESTIC CLR_WHITE /* monst.c */
#if 0
#if !defined(TTY_GRAPHICS)
#define has_color(n) TRUE
#endif
#endif
#ifdef TEXTCOLOR
static const int explcolors[] = {
CLR_BLACK, /* dark */
CLR_GREEN, /* noxious */
CLR_BROWN, /* muddy */
CLR_BLUE, /* wet */
CLR_MAGENTA, /* magical */
CLR_ORANGE, /* fiery */
CLR_WHITE, /* frosty */
};
#define zap_color(n) color = iflags.use_color ? zapcolors[n] : NO_COLOR
#define cmap_color(n) color = iflags.use_color ? defsyms[n].color : NO_COLOR
#define obj_color(n) color = iflags.use_color ? objects[n].oc_color : NO_COLOR
#define mon_color(n) color = iflags.use_color ? mons[n].mcolor : NO_COLOR
#define invis_color(n) color = NO_COLOR
#define pet_color(n) color = iflags.use_color ? mons[n].mcolor : NO_COLOR
#define warn_color(n) \
color = iflags.use_color ? def_warnsyms[n].color : NO_COLOR
#define explode_color(n) color = iflags.use_color ? explcolors[n] : NO_COLOR
#else /* no text color */
#define zap_color(n)
#define cmap_color(n)
#define obj_color(n)
#define mon_color(n)
#define invis_color(n)
#define pet_color(c)
#define warn_color(n)
#define explode_color(n)
#endif
#if defined(USE_TILES) && defined(MSDOS)
#define HAS_ROGUE_IBM_GRAPHICS \
(g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM) && !iflags.grmode)
#else
#define HAS_ROGUE_IBM_GRAPHICS \
(g.currentgraphics == ROGUESET && SYMHANDLING(H_IBM))
#endif
#define is_objpile(x,y) (!Hallucination && g.level.objects[(x)][(y)] \
&& g.level.objects[(x)][(y)]->nexthere)
#define GMAP_SET 0x00000001
#define GMAP_ROGUELEVEL 0x00000002
#define GMAP_ALTARCOLOR 0x00000004
/*ARGSUSED*/
int
mapglyph(glyph, ochar, ocolor, ospecial, x, y, mgflags)
int glyph, *ocolor, x, y;
int *ochar;
unsigned *ospecial;
unsigned mgflags;
{
register int offset, idx;
int color = NO_COLOR;
nhsym ch;
unsigned special = 0;
/* condense multiple tests in macro version down to single */
boolean has_rogue_ibm_graphics = HAS_ROGUE_IBM_GRAPHICS,
is_you = (x == u.ux && y == u.uy && !u.usteed),
has_rogue_color = (has_rogue_ibm_graphics
&& g.symset[g.currentgraphics].nocolor == 0),
do_mon_checks = FALSE;
if (!g.glyphmap_perlevel_flags) {
/*
* GMAP_SET 0x00000001
* GMAP_ROGUELEVEL 0x00000002
* GMAP_ALTARCOLOR 0x00000004
*/
g.glyphmap_perlevel_flags |= GMAP_SET;
if (Is_rogue_level(&u.uz)) {
g.glyphmap_perlevel_flags |= GMAP_ROGUELEVEL;
} else if ((Is_astralevel(&u.uz) || Is_sanctum(&u.uz))) {
g.glyphmap_perlevel_flags |= GMAP_ALTARCOLOR;
}
}
/*
* Map the glyph back to a character and color.
*
* Warning: For speed, this makes an assumption on the order of
* offsets. The order is set in display.h.
*/
if ((offset = (glyph - GLYPH_NOTHING_OFF)) >= 0) {
idx = SYM_NOTHING + SYM_OFF_X;
color = NO_COLOR;
special |= MG_NOTHING;
} else if ((offset = (glyph - GLYPH_UNEXPLORED_OFF)) >= 0) {
idx = SYM_UNEXPLORED + SYM_OFF_X;
color = NO_COLOR;
special |= MG_UNEXPL;
} else if ((offset = (glyph - GLYPH_STATUE_OFF)) >= 0) { /* a statue */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)
color = CLR_RED;
else
obj_color(STATUE);
special |= MG_STATUE;
if (is_objpile(x,y))
special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_WARNING_OFF)) >= 0) { /* warn flash */
idx = offset + SYM_OFF_W;
if (has_rogue_color)
color = NO_COLOR;
else
warn_color(offset);
} else if ((offset = (glyph - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */
/* see swallow_to_glyph() in display.c */
idx = (S_sw_tl + (offset & 0x7)) + SYM_OFF_P;
if (has_rogue_color && iflags.use_color)
color = NO_COLOR;
else
mon_color(offset >> 3);
} else if ((offset = (glyph - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */
/* see zapdir_to_glyph() in display.c */
idx = (S_vbeam + (offset & 0x3)) + SYM_OFF_P;
if (has_rogue_color && iflags.use_color)
color = NO_COLOR;
else
zap_color((offset >> 2));
} else if ((offset = (glyph - GLYPH_EXPLODE_OFF)) >= 0) { /* explosion */
idx = ((offset % MAXEXPCHARS) + S_explode1) + SYM_OFF_P;
explode_color(offset / MAXEXPCHARS);
} else if ((offset = (glyph - GLYPH_CMAP_OFF)) >= 0) { /* cmap */
idx = offset + SYM_OFF_P;
if (has_rogue_color && iflags.use_color) {
if (offset >= S_vwall && offset <= S_hcdoor)
color = CLR_BROWN;
else if (offset >= S_arrow_trap && offset <= S_polymorph_trap)
color = CLR_MAGENTA;
else if (offset == S_corr || offset == S_litcorr)
color = CLR_GRAY;
else if (offset >= S_room && offset <= S_water
&& offset != S_darkroom)
color = CLR_GREEN;
else
color = NO_COLOR;
#ifdef TEXTCOLOR
/* provide a visible difference if normal and lit corridor
use the same symbol */
} else if (iflags.use_color && offset == S_litcorr
&& g.showsyms[idx] == g.showsyms[S_corr + SYM_OFF_P]) {
color = CLR_WHITE;
#endif
/* try to provide a visible difference between water and lava
if they use the same symbol and color is disabled */
} else if (!iflags.use_color && offset == S_lava
&& (g.showsyms[idx] == g.showsyms[S_pool + SYM_OFF_P]
|| g.showsyms[idx]
== g.showsyms[S_water + SYM_OFF_P])) {
special |= MG_BW_LAVA;
/* similar for floor [what about empty doorway?] and ice */
} else if (!iflags.use_color && offset == S_ice
&& (g.showsyms[idx] == g.showsyms[S_room + SYM_OFF_P]
|| g.showsyms[idx]
== g.showsyms[S_darkroom + SYM_OFF_P])) {
special |= MG_BW_ICE;
} else if (offset == S_altar && iflags.use_color) {
int amsk = altarmask_at(x, y); /* might be a mimic */
if ((g.glyphmap_perlevel_flags & GMAP_ALTARCOLOR)
&& (amsk & AM_SHRINE) != 0) {
/* high altar */
color = CLR_BRIGHT_MAGENTA;
} else {
switch (amsk & AM_MASK) {
#if 0 /*
* On OSX with TERM=xterm-color256 these render as
* white -> tty: gray, curses: ok
* gray -> both tty and curses: black
* black -> both tty and curses: blue
* red -> both tty and curses: ok.
* Since the colors have specific associations (with the
* unicorns matched with each alignment), we shouldn't use
* scrambled colors and we don't have sufficient information
* to handle platform-specific color variations.
*/
case AM_LAWFUL: /* 4 */
color = CLR_WHITE;
break;
case AM_NEUTRAL: /* 2 */
color = CLR_GRAY;
break;
case AM_CHAOTIC: /* 1 */
color = CLR_BLACK;
break;
#else /* !0: TEMP? */
case AM_LAWFUL: /* 4 */
case AM_NEUTRAL: /* 2 */
case AM_CHAOTIC: /* 1 */
cmap_color(S_altar); /* gray */
break;
#endif /* 0 */
case AM_NONE: /* 0 */
color = CLR_RED;
break;
default: /* 3, 5..7 -- shouldn't happen but 3 was possible
* prior to 3.6.3 (due to faulty sink polymorph) */
color = NO_COLOR;
break;
}
}
} else {
cmap_color(offset);
}
} else if ((offset = (glyph - GLYPH_OBJ_OFF)) >= 0) { /* object */
idx = objects[offset].oc_class + SYM_OFF_O;
if (offset == BOULDER)
idx = SYM_BOULDER + SYM_OFF_X;
if (has_rogue_color && iflags.use_color) {
switch (objects[offset].oc_class) {
case COIN_CLASS:
color = CLR_YELLOW;
break;
case FOOD_CLASS:
color = CLR_RED;
break;
default:
color = CLR_BRIGHT_BLUE;
break;
}
} else
obj_color(offset);
if (offset != BOULDER && is_objpile(x,y))
special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_RIDDEN_OFF)) >= 0) { /* mon ridden */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)
/* This currently implies that the hero is here -- monsters */
/* don't ride (yet...). Should we set it to yellow like in */
/* the monster case below? There is no equivalent in rogue. */
color = NO_COLOR; /* no need to check iflags.use_color */
else
mon_color(offset);
special |= MG_RIDDEN;
do_mon_checks = TRUE;
} else if ((offset = (glyph - GLYPH_BODY_OFF)) >= 0) { /* a corpse */
idx = objects[CORPSE].oc_class + SYM_OFF_O;
if (has_rogue_color && iflags.use_color)
color = CLR_RED;
else
mon_color(offset);
special |= MG_CORPSE;
if (is_objpile(x,y))
special |= MG_OBJPILE;
} else if ((offset = (glyph - GLYPH_DETECT_OFF)) >= 0) { /* mon detect */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)
color = NO_COLOR; /* no need to check iflags.use_color */
else
mon_color(offset);
/* Disabled for now; anyone want to get reverse video to work? */
/* is_reverse = TRUE; */
special |= MG_DETECT;
do_mon_checks = TRUE;
} else if ((offset = (glyph - GLYPH_INVIS_OFF)) >= 0) { /* invisible */
idx = SYM_INVISIBLE + SYM_OFF_X;
if (has_rogue_color)
color = NO_COLOR; /* no need to check iflags.use_color */
else
invis_color(offset);
special |= MG_INVIS;
} else if ((offset = (glyph - GLYPH_PET_OFF)) >= 0) { /* a pet */
idx = mons[offset].mlet + SYM_OFF_M;
if (has_rogue_color)
color = NO_COLOR; /* no need to check iflags.use_color */
else
pet_color(offset);
special |= MG_PET;
do_mon_checks = TRUE;
} else { /* a monster */
idx = mons[glyph].mlet + SYM_OFF_M;
if (has_rogue_color && iflags.use_color) {
if (is_you)
/* actually player should be yellow-on-gray if in corridor */
color = CLR_YELLOW;
else
color = NO_COLOR;
} else {
mon_color(glyph);
#ifdef TEXTCOLOR
/* special case the hero for `showrace' option */
if (iflags.use_color && is_you && flags.showrace && !Upolyd)
color = HI_DOMESTIC;
#endif
}
do_mon_checks = TRUE;
}
if (do_mon_checks) {
struct monst *m;
if (is_you) {
if (Ugender == FEMALE)
special |= MG_FEMALE;
} else {
/* when hero is riding, steed will be shown at hero's location
but has not been placed on the map so m_at() won't find it */
m = (x == u.ux && y == u.uy && u.usteed) ? u.usteed : m_at(x, y);
if (m && m->female)
special |= MG_FEMALE;
}
}
/* These were requested by a blind player to enhance screen reader use */
if (sysopt.accessibility == 1 && !(mgflags & MG_FLAG_NOOVERRIDE)) {
int ovidx;
if ((special & MG_PET) != 0) {
ovidx = SYM_PET_OVERRIDE + SYM_OFF_X;
if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
? g.ov_rogue_syms[ovidx]
: g.ov_primary_syms[ovidx])
idx = ovidx;
}
if (is_you) {
ovidx = SYM_HERO_OVERRIDE + SYM_OFF_X;
if ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL)
? g.ov_rogue_syms[ovidx]
: g.ov_primary_syms[ovidx])
idx = ovidx;
}
}
ch = g.showsyms[idx];
#ifdef TEXTCOLOR
/* Turn off color if no color defined, or rogue level w/o PC graphics. */
if (!has_color(color)
|| ((g.glyphmap_perlevel_flags & GMAP_ROGUELEVEL) && !has_rogue_color))
#endif
color = NO_COLOR;
*ochar = (int) ch;
*ospecial = special;
*ocolor = color;
return idx;
}
char *
encglyph(glyph)
int glyph;
{
static char encbuf[20]; /* 10+1 would suffice */
Sprintf(encbuf, "\\G%04X%04X", g.context.rndencode, glyph);
return encbuf;
}
char *
decode_mixed(buf, str)
char *buf;
const char *str;
{
static const char hex[] = "00112233445566778899aAbBcCdDeEfF";
char *put = buf;
unsigned glyphmod[NUM_GLYPHMOD];
if (!str)
return strcpy(buf, "");
while (*str) {
if (*str == '\\') {
int rndchk, dcount, so, gv;
const char *dp, *save_str;
save_str = str++;
switch (*str) {
case 'G': /* glyph value \GXXXXNNNN*/
rndchk = dcount = 0;
for (++str; *str && ++dcount <= 4; ++str)
if ((dp = index(hex, *str)) != 0)
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
else
break;
if (rndchk == g.context.rndencode) {
gv = dcount = 0;
for (; *str && ++dcount <= 4; ++str)
if ((dp = index(hex, *str)) != 0)
gv = (gv * 16) + ((int) (dp - hex) / 2);
else
break;
map_glyphmod(0, 0, gv, MG_FLAG_RETURNIDX, glyphmod);
so = glyphmod[GM_TTYCHAR];
*put++ = g.showsyms[so];
/* 'str' is ready for the next loop iteration and '*str'
should not be copied at the end of this iteration */
continue;
} else {
/* possible forgery - leave it the way it is */
str = save_str;
}
break;
#if 0
case 'S': /* symbol offset */
so = rndchk = dcount = 0;
for (++str; *str && ++dcount <= 4; ++str)
if ((dp = index(hex, *str)) != 0)
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
else
break;
if (rndchk == g.context.rndencode) {
dcount = 0;
for (; *str && ++dcount <= 2; ++str)
if ((dp = index(hex, *str)) != 0)
so = (so * 16) + ((int) (dp - hex) / 2);
else
break;
}
*put++ = g.showsyms[so];
break;
#endif
case '\\':
break;
case '\0':
/* String ended with '\\'. This can happen when someone
names an object with a name ending with '\\', drops the
named object on the floor nearby and does a look at all
nearby objects. */
/* brh - should we perhaps not allow things to have names
that contain '\\' */
str = save_str;
break;
}
}
*put++ = *str++;
}
*put = '\0';
return buf;
}
/*
* This differs from putstr() because the str parameter can
* contain a sequence of characters representing:
* \GXXXXNNNN a glyph value, encoded by encglyph().
*
* For window ports that haven't yet written their own
* XXX_putmixed() routine, this general one can be used.
* It replaces the encoded glyph sequence with a single
* showsyms[] char, then just passes that string onto
* putstr().
*/
void
genl_putmixed(window, attr, str)
winid window;
int attr;
const char *str;
{
char buf[BUFSZ];
/* now send it to the normal putstr */
putstr(window, attr, decode_mixed(buf, str));
}
/*
* Window port helper function for menu invert routines to move the decision
* logic into one place instead of 7 different window-port routines.
*/
boolean
menuitem_invert_test(mode, itemflags, is_selected)
int mode;
unsigned itemflags; /* The itemflags for the item */
boolean is_selected; /* The current selection status of the item */
{
boolean skipinvert = (itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0;
if ((iflags.menuinvertmode == 1 || iflags.menuinvertmode == 2)
&& !mode && skipinvert && !is_selected)
return FALSE;
else if (iflags.menuinvertmode == 2
&& !mode && skipinvert && is_selected)
return TRUE;
else
return TRUE;
}
/*mapglyph.c*/

View File

@@ -1430,4 +1430,157 @@ int color;
);
}
int
glyph2ttychar(glyph)
int glyph;
{
int so;
unsigned glyphmod[NUM_GLYPHMOD];
map_glyphmod(0, 0, glyph, MG_FLAG_RETURNIDX, glyphmod);
so = (int) glyphmod[GM_TTYCHAR];
if (so >= 0 && so < SYM_MAX)
return (int) g.showsyms[so];
else
return ' ';
}
char *
encglyph(glyph)
int glyph;
{
static char encbuf[20]; /* 10+1 would suffice */
Sprintf(encbuf, "\\G%04X%04X", g.context.rndencode, glyph);
return encbuf;
}
char *
decode_mixed(buf, str)
char *buf;
const char *str;
{
static const char hex[] = "00112233445566778899aAbBcCdDeEfF";
char *put = buf;
unsigned glyphmod[NUM_GLYPHMOD];
if (!str)
return strcpy(buf, "");
while (*str) {
if (*str == '\\') {
int rndchk, dcount, so, gv;
const char *dp, *save_str;
save_str = str++;
switch (*str) {
case 'G': /* glyph value \GXXXXNNNN*/
rndchk = dcount = 0;
for (++str; *str && ++dcount <= 4; ++str)
if ((dp = index(hex, *str)) != 0)
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
else
break;
if (rndchk == g.context.rndencode) {
gv = dcount = 0;
for (; *str && ++dcount <= 4; ++str)
if ((dp = index(hex, *str)) != 0)
gv = (gv * 16) + ((int) (dp - hex) / 2);
else
break;
map_glyphmod(0, 0, gv, MG_FLAG_RETURNIDX, glyphmod);
so = glyphmod[GM_TTYCHAR];
*put++ = g.showsyms[so];
/* 'str' is ready for the next loop iteration and '*str'
should not be copied at the end of this iteration */
continue;
} else {
/* possible forgery - leave it the way it is */
str = save_str;
}
break;
#if 0
case 'S': /* symbol offset */
so = rndchk = dcount = 0;
for (++str; *str && ++dcount <= 4; ++str)
if ((dp = index(hex, *str)) != 0)
rndchk = (rndchk * 16) + ((int) (dp - hex) / 2);
else
break;
if (rndchk == g.context.rndencode) {
dcount = 0;
for (; *str && ++dcount <= 2; ++str)
if ((dp = index(hex, *str)) != 0)
so = (so * 16) + ((int) (dp - hex) / 2);
else
break;
}
*put++ = g.showsyms[so];
break;
#endif
case '\\':
break;
case '\0':
/* String ended with '\\'. This can happen when someone
names an object with a name ending with '\\', drops the
named object on the floor nearby and does a look at all
nearby objects. */
/* brh - should we perhaps not allow things to have names
that contain '\\' */
str = save_str;
break;
}
}
*put++ = *str++;
}
*put = '\0';
return buf;
}
/*
* This differs from putstr() because the str parameter can
* contain a sequence of characters representing:
* \GXXXXNNNN a glyph value, encoded by encglyph().
*
* For window ports that haven't yet written their own
* XXX_putmixed() routine, this general one can be used.
* It replaces the encoded glyph sequence with a single
* showsyms[] char, then just passes that string onto
* putstr().
*/
void
genl_putmixed(window, attr, str)
winid window;
int attr;
const char *str;
{
char buf[BUFSZ];
/* now send it to the normal putstr */
putstr(window, attr, decode_mixed(buf, str));
}
/*
* Window port helper function for menu invert routines to move the decision
* logic into one place instead of 7 different window-port routines.
*/
boolean
menuitem_invert_test(mode, itemflags, is_selected)
int mode;
unsigned itemflags; /* The itemflags for the item */
boolean is_selected; /* The current selection status of the item */
{
boolean skipinvert = (itemflags & MENU_ITEMFLAGS_SKIPINVERT) != 0;
if ((iflags.menuinvertmode == 1 || iflags.menuinvertmode == 2)
&& !mode && skipinvert && !is_selected)
return FALSE;
else if (iflags.menuinvertmode == 2
&& !mode && skipinvert && is_selected)
return TRUE;
else
return TRUE;
}
/*windows.c*/

View File

@@ -767,38 +767,10 @@ EM_JS(void, js_helpers_init, (), {
globalThis.nethackGlobal = globalThis.nethackGlobal || {};
globalThis.nethackGlobal.helpers = globalThis.nethackGlobal.helpers || {};
installHelper(mapglyphHelper);
installHelper(displayInventory);
installHelper(getPointerValue);
installHelper(setPointerValue);
// used by print_glyph
function mapglyphHelper(glyph, x, y, mgflags) {
let ochar = _malloc(4);
let ocolor = _malloc(4);
let ospecial = _malloc(4);
_mapglyph(glyph, ochar, ocolor, ospecial, x, y, mgflags);
let ch = getValue(ochar, "i32");
let color = getValue(ocolor, "i32");
let special = getValue(ospecial, "i32");
_free (ochar);
_free (ocolor);
_free (ospecial);
return {
glyph,
ch,
color,
special,
x,
y,
mgflags
};
}
// used by update_inventory
function displayInventory() {
// Asyncify.handleAsync(async () => {

View File

@@ -256,27 +256,27 @@ DLBOBJ = $(O)dlb.o
VOBJ01 = $(O)allmain.o $(O)alloc.o $(O)apply.o $(O)artifact.o $(O)attrib.o
VOBJ02 = $(O)ball.o $(O)bones.o $(O)botl.o $(O)cmd.o $(O)dbridge.o
VOBJ03 = $(O)decl.o $(O)detect.o $(O)display.o $(O)do.o $(O)do_name.o
VOBJ04 = $(O)do_wear.o $(O)dog.o $(O)dogmove.o $(O)dokick.o $(O)dothrow.o
VOBJ05 = $(O)drawing.o $(O)dungeon.o $(O)eat.o $(O)end.o $(O)engrave.o
VOBJ06 = $(O)exper.o $(O)explode.o $(O)extralev.o $(O)files.o $(O)fountain.o
VOBJ07 = $(O)getline.o $(O)hack.o $(O)hacklib.o $(O)isaac64.o $(O)invent.o
VOBJ08 = $(O)lock.o $(O)mail.o $(O)main.o $(O)makemon.o $(O)mapglyph.o
VOBJ03 = $(O)decl.o $(O)detect.o $(O)dig.o $(O)display.o $(O)do.o
VOBJ04 = $(O)do_name.o $(O)do_wear.o $(O)dog.o $(O)dogmove.o $(O)dokick.o
VOBJ05 = $(O)dothrow.o $(O)drawing.o $(O)dungeon.o $(O)eat.o $(O)end.o
VOBJ06 = $(O)engrave.o $(O)exper.o $(O)explode.o $(O)extralev.o $(O)files.o
VOBJ07 = $(O)fountain.o $(O)getline.o $(O)hack.o $(O)hacklib.o $(O)invent.o
VOBJ08 = $(O)isaac64.o $(O)lock.o $(O)mail.o $(O)main.o $(O)makemon.o
VOBJ09 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o $(O)mkmap.o
VOBJ10 = $(O)mklev.o $(O)mkmaze.o $(O)mkobj.o $(O)mkroom.o $(O)mon.o
VOBJ11 = $(O)mondata.o $(O)monmove.o $(O)monst.o $(O)mplayer.o $(O)mthrowu.o
VOBJ12 = $(O)muse.o $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o
VOBJ13 = $(O)options.o $(O)pickup.o $(O)pline.o $(O)polyself.o $(O)potion.o
VOBJ14 = $(O)quest.o $(O)questpgr.o $(O)pager.o $(O)pray.o $(O)priest.o
VOBJ15 = $(O)read.o $(O)rect.o $(O)restore.o $(O)rip.o $(O)rnd.o
VOBJ16 = $(O)role.o $(O)rumors.o $(O)save.o $(O)sfstruct.o $(O)shk.o
VOBJ17 = $(O)shknam.o $(O)sit.o $(O)sounds.o $(O)sp_lev.o $(O)spell.o
VOBJ18 = $(O)steal.o $(O)steed.o $(O)symbols.o $(O)sys.o $(O)termcap.o
VOBJ19 = $(O)timeout.o $(O)topl.o $(O)topten.o $(O)track.o $(O)trap.o
VOBJ20 = $(O)u_init.o $(O)uhitm.o $(O)vault.o $(O)vision.o
VOBJ21 = $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows.o $(O)wintty.o
VOBJ22 = $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o
VOBJ23 = $(O)light.o $(O)dlb.o $(O)dig.o $(O)teleport.o $(O)region.o
VOBJ15 = $(O)read.o $(O)rect.o $(O)region.o $(O)restore.o $(O)rip.o
VOBJ16 = $(O)rnd.o $(O)role.o $(O)rumors.o $(O)save.o $(O)sfstruct.o
VOBJ17 = $(O)shk.o $(O)shknam.o $(O)sit.o $(O)sounds.o $(O)sp_lev.o
VOBJ18 = $(O)spell.o $(O)steal.o $(O)steed.o $(O)symbols.o $(O)sys.o
VOBJ19 = $(O)teleport.o $(O)termcap.o $(O)timeout.o $(O)topl.o $(O)topten.o
VOBJ20 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o $(O)vault.o
VOBJ21 = $(O)vision.o $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows.o
VOBJ22 = $(O)wintty.o $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o
VOBJ23 = $(O)zap.o $(O)light.o $(O)dlb.o
VOBJ24 = $(REGEX)
SOBJ = $(O)msdos.o $(O)pcsys.o $(O)tty.o $(O)unix.o \
@@ -1248,7 +1248,6 @@ $(O)light.o: light.c $(HACK_H)
$(O)lock.o: lock.c $(HACK_H)
$(O)mail.o: mail.c $(HACK_H) $(INCL)/mail.h
$(O)makemon.o: makemon.c $(HACK_H)
$(O)mapglyph.o: mapglyph.c $(HACK_H)
$(O)mcastu.o: mcastu.c $(HACK_H)
$(O)mhitm.o: mhitm.c $(HACK_H) $(INCL)/artifact.h
$(O)mhitu.o: mhitu.c $(HACK_H) $(INCL)/artifact.h

View File

@@ -511,7 +511,7 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
files.c fountain.c hack.c hacklib.c \
insight.c invent.c isaac64.c light.c \
lock.c mail.c makemon.c mapglyph.c mcastu.c mdlib.c mhitm.c \
lock.c mail.c makemon.c mcastu.c mdlib.c mhitm.c \
mhitu.c minion.c mklev.c mkmap.c mkmaze.c mkobj.c mkroom.c mon.c \
mondata.c monmove.c monst.c mplayer.c mthrowu.c muse.c music.c \
nhlua.c nhlsel.c nhlobj.c o_init.c objects.c objnam.c \
@@ -589,7 +589,7 @@ HOBJ = $(TARGETPFX)allmain.o $(TARGETPFX)alloc.o \
$(TARGETPFX)hack.o $(TARGETPFX)hacklib.o $(TARGETPFX)insight.o \
$(TARGETPFX)invent.o $(TARGETPFX)isaac64.o $(TARGETPFX)light.o \
$(TARGETPFX)lock.o $(TARGETPFX)mail.o $(TARGETPFX)makemon.o \
$(TARGETPFX)mapglyph.o $(TARGETPFX)mcastu.o $(TARGETPFX)mdlib.o \
$(TARGETPFX)mcastu.o $(TARGETPFX)mdlib.o \
$(TARGETPFX)mhitm.o $(TARGETPFX)mhitu.o $(TARGETPFX)minion.o \
$(TARGETPFX)mklev.o $(TARGETPFX)mkmap.o $(TARGETPFX)mkmaze.o \
$(TARGETPFX)mkobj.o $(TARGETPFX)mkroom.o $(TARGETPFX)mon.o \
@@ -1105,7 +1105,6 @@ $(TARGETPFX)light.o: light.c $(HACK_H)
$(TARGETPFX)lock.o: lock.c $(HACK_H)
$(TARGETPFX)mail.o: mail.c $(HACK_H) ../include/mail.h
$(TARGETPFX)makemon.o: makemon.c $(HACK_H)
$(TARGETPFX)mapglyph.o: mapglyph.c $(HACK_H)
$(TARGETPFX)mcastu.o: mcastu.c $(HACK_H)
$(TARGETPFX)mdlib.o: mdlib.c $(CONFIG_H) ../include/permonst.h \
../include/align.h ../include/monattk.h ../include/monflag.h \

View File

@@ -16,7 +16,6 @@
31B8A37E21A238060055BD01 /* steal.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A31821A238000055BD01 /* steal.c */; };
31B8A37F21A238060055BD01 /* extralev.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A31921A238000055BD01 /* extralev.c */; };
31B8A38021A238060055BD01 /* sit.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A31A21A238000055BD01 /* sit.c */; };
31B8A38121A238060055BD01 /* mapglyph.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A31B21A238000055BD01 /* mapglyph.c */; };
31B8A38221A238060055BD01 /* teleport.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A31C21A238000055BD01 /* teleport.c */; };
31B8A38321A238060055BD01 /* mhitu.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A31D21A238000055BD01 /* mhitu.c */; };
31B8A38421A238060055BD01 /* do_name.c in Sources */ = {isa = PBXBuildFile; fileRef = 31B8A31E21A238000055BD01 /* do_name.c */; };
@@ -325,7 +324,6 @@
31B8A31821A238000055BD01 /* steal.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = steal.c; path = ../../src/steal.c; sourceTree = "<group>"; };
31B8A31921A238000055BD01 /* extralev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = extralev.c; path = ../../src/extralev.c; sourceTree = "<group>"; };
31B8A31A21A238000055BD01 /* sit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = sit.c; path = ../../src/sit.c; sourceTree = "<group>"; };
31B8A31B21A238000055BD01 /* mapglyph.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mapglyph.c; path = ../../src/mapglyph.c; sourceTree = "<group>"; };
31B8A31C21A238000055BD01 /* teleport.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = teleport.c; path = ../../src/teleport.c; sourceTree = "<group>"; };
31B8A31D21A238000055BD01 /* mhitu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = mhitu.c; path = ../../src/mhitu.c; sourceTree = "<group>"; };
31B8A31E21A238000055BD01 /* do_name.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = do_name.c; path = ../../src/do_name.c; sourceTree = "<group>"; };
@@ -570,7 +568,6 @@
31B8A34921A238030055BD01 /* lock.c */,
31B8A33221A238010055BD01 /* mail.c */,
31B8A34021A238020055BD01 /* makemon.c */,
31B8A31B21A238000055BD01 /* mapglyph.c */,
31B8A32E21A238010055BD01 /* mcastu.c */,
31B8A33D21A238020055BD01 /* mhitm.c */,
31B8A31D21A238000055BD01 /* mhitu.c */,
@@ -1389,7 +1386,6 @@
31B8A3C621A238060055BD01 /* dbridge.c in Sources */,
31B8A38521A238060055BD01 /* rnd.c in Sources */,
31B8A38B21A238060055BD01 /* topten.c in Sources */,
31B8A38121A238060055BD01 /* mapglyph.c in Sources */,
5462D14823E7B19200969423 /* insight.c in Sources */,
31B8A41321A23F650055BD01 /* version.c in Sources */,
31B8A3BB21A238060055BD01 /* allmain.c in Sources */,

View File

@@ -311,7 +311,7 @@ EMCC_LFLAGS += -s ALLOW_TABLE_GROWTH
EMCC_LFLAGS += -s ASYNCIFY -s ASYNCIFY_IMPORTS='["local_callback"]'
EMCC_LFLAGS += -O3
EMCC_LFLAGS += -s MODULARIZE
EMCC_LFLAGS += -s EXPORTED_FUNCTIONS='["_main", "_shim_graphics_set_callback", "_mapglyph", "_display_inventory"]'
EMCC_LFLAGS += -s EXPORTED_FUNCTIONS='["_main", "_shim_graphics_set_callback", "_display_inventory"]'
EMCC_LFLAGS += -s EXPORTED_RUNTIME_METHODS='["cwrap", "ccall", "addFunction", \
"removeFunction", "UTF8ToString", "getValue", "setValue"]'
EMCC_LFLAGS += -s ERROR_ON_UNDEFINED_SYMBOLS=0

View File

@@ -152,7 +152,7 @@ HACKCSRC = allmain.c alloc.c apply.c artifact.c attrib.c ball.c bones.c \
dungeon.c eat.c end.c engrave.c exper.c explode.c extralev.c \
files.c fountain.c hack.c hacklib.c \
insight.c invent.c light.c lock.c \
mail.c makemon.c mapglyph.c mcastu.c mhitm.c mhitu.c minion.c \
mail.c makemon.c mcastu.c mhitm.c mhitu.c minion.c \
mklev.c mkmap.c \
mkmaze.c mkobj.c mkroom.c mon.c mondata.c monmove.c monst.c \
mplayer.c mthrowu.c muse.c music.c o_init.c objects.c objnam.c \
@@ -198,7 +198,7 @@ HOBJ2 = dog.obj,dogmove.obj,dokick.obj,dothrow.obj,drawing.obj, \
dungeon.obj,eat.obj,end.obj,engrave.obj,exper.obj,explode.obj, \
extralev.obj,files.obj,fountain.obj,hack.obj,hacklib.obj, \
insight.obj,invent.obj
HOBJ3 = light.obj,lock.obj,mail.obj,makemon.obj,mapglyph.obj,mcastu.obj, \
HOBJ3 = light.obj,lock.obj,mail.obj,makemon.obj,mcastu.obj, \
mhitm.obj,mhitu.obj,minion.obj,mklev.obj,mkmap.obj,mkmaze.obj, \
mkobj.obj,mkroom.obj,mon.obj,mondata.obj,monmove.obj
HOBJ4 = mplayer.obj,mthrowu.obj,muse.obj,music.obj,o_init.obj,objnam.obj, \
@@ -531,7 +531,6 @@ light.obj : light.c $(HACK_H)
lock.obj : lock.c $(HACK_H)
mail.obj : mail.c $(HACK_H) $(INC)mail.h
makemon.obj : makemon.c $(HACK_H)
mapglyph.obj : mapglyph.c $(HACK_H) $(INC)wintty.h $(INC)color.h
mcastu.obj : mcastu.c $(HACK_H)
mhitm.obj : mhitm.c $(HACK_H) $(INC)artifact.h
mhitu.obj : mhitu.c $(HACK_H) $(INC)artifact.h

View File

@@ -308,7 +308,7 @@ $ c_list = "allmain,apply,artifact,attrib,ball,bones,botl,cmd,dbridge" -
+ ",extralev,files,fountain"
$ gosub compile_list
$ c_list = "hack,hacklib,insight,invent,light,lock,mail,makemon" -
+ ",mapglyph,mcastu,mhitm,mhitu,minion,mklev,mkmap,mkmaze" -
+ ",mcastu,mhitm,mhitu,minion,mklev,mkmap,mkmaze" -
+ ",mkobj,mkroom,mon,mondata,monmove,mplayer,mthrowu,muse" -
+ ",music,o_init,objnam,options,pager,pickup"
$ gosub compile_list

View File

@@ -315,24 +315,24 @@ VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o
VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o
VOBJ09 = $(O)hacklib.o $(O)insight.o $(O)invent.o $(O)isaac64.o
VOBJ10 = $(O)light.o $(O)lock.o $(O)mail.o $(O)makemon.o
VOBJ11 = $(O)mapglyph.o $(O)mdlib.o $(O)mcastu.o $(O)mhitm.o
VOBJ12 = $(O)mhitu.o $(O)minion.o $(O)mklev.o $(O)mkmap.o
VOBJ13 = $(O)mkmaze.o $(O)mkobj.o $(O)mkroom.o $(O)mon.o
VOBJ14 = $(O)mondata.o $(O)monmove.o $(O)monst.o $(O)mplayer.o
VOBJ15 = $(O)mthrowu.o $(O)muse.o $(O)music.o $(O)o_init.o
VOBJ16 = $(O)objects.o $(O)objnam.o $(O)options.o $(O)pager.o
VOBJ17 = $(O)pickup.o $(O)pline.o $(O)polyself.o $(O)potion.o
VOBJ18 = $(O)pray.o $(O)priest.o $(O)quest.o $(O)questpgr.o
VOBJ19 = $(RANDOM) $(O)read.o $(O)rect.o $(O)region.o
VOBJ20 = $(O)restore.o $(O)rip.o $(O)rnd.o $(O)role.o
VOBJ21 = $(O)rumors.o $(O)save.o $(O)sfstruct.o $(O)shk.o
VOBJ22 = $(O)shknam.o $(O)sit.o $(O)sounds.o $(O)sp_lev.o
VOBJ23 = $(O)spell.o $(O)steal.o $(O)steed.o $(O)symbols.o
VOBJ24 = $(O)sys.o $(O)teleport.o $(O)timeout.o $(O)topten.o
VOBJ25 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o
VOBJ26 = $(O)vault.o $(O)vision.o $(O)weapon.o $(O)were.o
VOBJ27 = $(O)wield.o $(O)windows.o $(O)wizard.o $(O)worm.o
VOBJ28 = $(O)worn.o $(O)write.o $(O)zap.o
VOBJ11 = $(O)mdlib.o $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o
VOBJ12 = $(O)minion.o $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o
VOBJ13 = $(O)mkobj.o $(O)mkroom.o $(O)mon.o $(O)mondata.o
VOBJ14 = $(O)monmove.o $(O)monst.o $(O)mplayer.o $(O)mthrowu.o
VOBJ15 = $(O)muse.o $(O)music.o $(O)o_init.o $(O)objects.o
VOBJ16 = $(O)objnam.o $(O)options.o $(O)pager.o $(O)pickup.o
VOBJ17 = $(O)pline.o $(O)polyself.o $(O)potion.o $(O)pray.o
VOBJ18 = $(O)priest.o $(O)quest.o $(O)questpgr.o $(RANDOM)
VOBJ19 = $(O)read.o $(O)rect.o $(O)region.o $(O)restore.o
VOBJ20 = $(O)rip.o $(O)rnd.o $(O)role.o $(O)rumors.o
VOBJ21 = $(O)save.o $(O)sfstruct.o $(O)shk.o $(O)shknam.o
VOBJ22 = $(O)sit.o $(O)sounds.o $(O)sp_lev.o $(O)spell.o
VOBJ23 = $(O)steal.o $(O)steed.o $(O)symbols.o $(O)sys.o
VOBJ24 = $(O)teleport.o $(O)timeout.o $(O)topten.o $(O)track.o
VOBJ25 = $(O)trap.o $(O)u_init.o $(O)uhitm.o $(O)vault.o
VOBJ26 = $(O)vision.o $(O)weapon.o $(O)were.o $(O)wield.o
VOBJ27 = $(O)windows.o $(O)wizard.o $(O)worm.o $(O)worn.o
VOBJ28 = $(O)write.o $(O)zap.o
ifeq "$(ADD_LUA)" "Y"
LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o
@@ -360,8 +360,7 @@ OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \
$(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \
$(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \
$(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \
$(VOBJ26) $(VOBJ27) $(VOBJ28) $(VOBJ29) $(REGEX) \
$(CURSESOBJ)
$(VOBJ26) $(VOBJ27) $(VOBJ28) $(REGEX) $(CURSESOBJ)
ifneq "$(SKIP_NETHACKW)" "Y"
GUIOBJ = $(O)mhaskyn.o $(O)mhdlg.o \
@@ -1639,7 +1638,6 @@ $(O)light.o: light.c $(HACK_H)
$(O)lock.o: lock.c $(HACK_H)
$(O)mail.o: mail.c $(HACK_H) $(INCL)/mail.h
$(O)makemon.o: makemon.c $(HACK_H)
$(O)mapglyph.o: mapglyph.c $(HACK_H)
$(O)mcastu.o: mcastu.c $(HACK_H)
$(O)mhitm.o: mhitm.c $(HACK_H) $(INCL)/artifact.h
$(O)mhitu.o: mhitu.c $(HACK_H) $(INCL)/artifact.h

View File

@@ -300,24 +300,24 @@ VOBJ07 = $(O)end.o $(O)engrave.o $(O)exper.o $(O)explode.o
VOBJ08 = $(O)extralev.o $(O)files.o $(O)fountain.o $(O)hack.o
VOBJ09 = $(O)hacklib.o $(O)insight.o $(O)invent.o $(O)isaac64.o
VOBJ10 = $(O)light.o $(O)lock.o $(O)mail.o $(O)makemon.o
VOBJ11 = $(O)mapglyph.o $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o
VOBJ12 = $(O)minion.o $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o
VOBJ13 = $(O)mkobj.o $(O)mkroom.o $(O)mon.o $(O)mondata.o
VOBJ14 = $(O)monmove.o $(O)monst.o $(O)mplayer.o $(O)mthrowu.o
VOBJ15 = $(O)muse.o $(O)music.o $(O)o_init.o $(O)objects.o
VOBJ16 = $(O)objnam.o $(O)options.o $(O)pager.o $(O)pickup.o
VOBJ17 = $(O)pline.o $(O)polyself.o $(O)potion.o $(O)pray.o
VOBJ18 = $(O)priest.o $(O)quest.o $(O)questpgr.o $(RANDOM)
VOBJ19 = $(O)read.o $(O)rect.o $(O)region.o $(O)restore.o
VOBJ20 = $(O)rip.o $(O)rnd.o $(O)role.o $(O)rumors.o
VOBJ21 = $(O)save.o $(O)sfstruct.o $(O)shk.o $(O)shknam.o
VOBJ22 = $(O)sit.o $(O)sounds.o $(O)sp_lev.o $(O)spell.o
VOBJ23 = $(O)steal.o $(O)steed.o $(O)symbols.o $(O)sys.o
VOBJ24 = $(O)teleport.o $(O)timeout.o $(O)topten.o $(O)track.o
VOBJ25 = $(O)trap.o $(O)u_init.o $(O)uhitm.o $(O)vault.o
VOBJ26 = $(O)vision.o $(O)weapon.o $(O)were.o $(O)wield.o
VOBJ27 = $(O)windows.o $(O)wizard.o $(O)worm.o $(O)worn.o
VOBJ28 = $(O)write.o $(O)zap.o
VOBJ11 = $(O)mcastu.o $(O)mhitm.o $(O)mhitu.o $(O)minion.o
VOBJ12 = $(O)mklev.o $(O)mkmap.o $(O)mkmaze.o $(O)mkobj.o
VOBJ13 = $(O)mkroom.o $(O)mon.o $(O)mondata.o $(O)monmove.o
VOBJ14 = $(O)monst.o $(O)mplayer.o $(O)mthrowu.o $(O)muse.o
VOBJ15 = $(O)music.o $(O)o_init.o $(O)objects.o $(O)objnam.o
VOBJ16 = $(O)options.o $(O)pager.o $(O)pickup.o $(O)pline.o
VOBJ17 = $(O)polyself.o $(O)potion.o $(O)pray.o $(O)priest.o
VOBJ18 = $(O)quest.o $(O)questpgr.o $(RANDOM) $(O)read.o
VOBJ19 = $(O)rect.o $(O)region.o $(O)restore.o $(O)rip.o
VOBJ20 = $(O)rnd.o $(O)role.o $(O)rumors.o $(O)save.o
VOBJ21 = $(O)sfstruct.o $(O)shk.o $(O)shknam.o $(O)sit.o
VOBJ22 = $(O)sounds.o $(O)sp_lev.o $(O)spell.o $(O)steal.o
VOBJ23 = $(O)steed.o $(O)symbols.o $(O)sys.o $(O)teleport.o
VOBJ24 = $(O)timeout.o $(O)topten.o $(O)track.o $(O)trap.o
VOBJ25 = $(O)u_init.o $(O)uhitm.o $(O)vault.o $(O)vision.o
VOBJ26 = $(O)weapon.o $(O)were.o $(O)wield.o $(O)windows.o
VOBJ27 = $(O)wizard.o $(O)worm.o $(O)worn.o $(O)write.o
VOBJ28 = $(O)zap.o
LUAOBJ = $(O)nhlua.o $(O)nhlsel.o $(O)nhlobj.o
@@ -1968,7 +1968,6 @@ $(O)light.o: light.c $(HACK_H)
$(O)lock.o: lock.c $(HACK_H)
$(O)mail.o: mail.c $(HACK_H) $(INCL)\mail.h
$(O)makemon.o: makemon.c $(HACK_H)
$(O)mapglyph.o: mapglyph.c $(HACK_H)
$(O)mcastu.o: mcastu.c $(HACK_H)
$(O)mdlib.o: mdlib.c $(CONFIG_H) $(INCL)\permonst.h $(INCL)\align.h \
$(INCL)\monattk.h $(INCL)\monflag.h \

View File

@@ -181,20 +181,9 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
for (int j = garea.top(); j <= garea.bottom(); j++) {
for (int i = garea.left(); i <= garea.right(); i++) {
#if 0
unsigned short g = Glyph(i, j);
int colortmp;
int chtmp;
unsigned special;
/* map glyph to character and color */
mapglyph(g, &chtmp, &colortmp, &special, i, j, 0);
unsigned short ch = (unsigned short) chtmp,
color = (unsigned short) colortmp;
#else
unsigned short color = Glyphcolor(i, j);
unsigned short ch = Glyphttychar(i, j);
unsigned special = Glyphflags(i, j);
#endif
ch = cp437(ch);
#ifdef TEXTCOLOR
painter.setPen( nhcolor_to_pen(color) );
@@ -223,14 +212,7 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
for (int j = garea.top(); j <= garea.bottom(); j++) {
for (int i = garea.left(); i <= garea.right(); i++) {
unsigned short g = Glyph(i,j);
#if 0
int color;
int ch;
unsigned special;
mapglyph(g, &ch, &color, &special, i, j, 0);
#else
unsigned special = Glyphflags(i, j);
#endif
bool femflag = (special & MG_FEMALE) ? true : false;
glyphs.drawCell(painter, g, i, j, femflag);
@@ -878,8 +860,6 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
unsigned special = Glyphflags(i,j);
#endif
painter.setPen( Qt::green );
/* map glyph to character and color */
// mapglyph(g, &ch, &color, &special, i, j, 0);
#ifdef TEXTCOLOR
painter.setPen( nhcolor_to_pen(color) );
#endif
@@ -911,16 +891,9 @@ void NetHackQtMapWindow::paintEvent(QPaintEvent* event)
for (int j=garea.top(); j<=garea.bottom(); j++) {
for (int i=garea.left(); i<=garea.right(); i++) {
unsigned short g=Glyph(i,j);
#if 0
int color;
int ch;
unsigned special;
mapglyph(g, &ch, &color, &special, i, j, 0);
#else
int color = Glyphcolor(i,j);
int ch = Glyphttychar(i,j);
unsigned special = Glyphflags(i,j);
#endif
bool femflag = (special & MG_FEMALE) ? true : false;
qt_settings->glyphs().drawCell(painter, g, i, j, femflag);
#ifdef TEXTCOLOR

View File

@@ -110,8 +110,9 @@ unsigned *glyphmod UNUSED;
register unsigned char *co_ptr;
#endif
/* map glyph to character and color */
(void) mapglyph(glyph, &och, &color, &special, x, y, 0);
color = glyphmod[GM_COLOR];
special = glyphmod[GM_FLAGS];
och = glyphmod[GM_TTYCHAR];
ch = (uchar) och;
if (special != map_info->tile_map.glyphs[y][x].special) {
@@ -931,15 +932,16 @@ map_all_unexplored(map_info) /* [was map_all_stone()] */
struct map_info_t *map_info;
{
int x, y;
char buf1[BUFSZ], buf2[BUFSZ];
/* unsigned short g_stone = cmap_to_glyph(S_stone); */
unsigned short g_unexp = GLYPH_UNEXPLORED, g_nothg = GLYPH_NOTHING;
int mgunexp = ' ', mgnothg = ' ', mgcolor = NO_COLOR;
unsigned mgspecial = 0;
struct tile_map_info_t *tile_map = &map_info->tile_map;
struct text_map_info_t *text_map = &map_info->text_map;
mapglyph(GLYPH_UNEXPLORED, &mgunexp, &mgcolor, &mgspecial, 0, 0, 0U);
mapglyph(GLYPH_NOTHING, &mgnothg, &mgcolor, &mgspecial, 0, 0, 0U);
mgunexp = glyph2ttychar(GLYPH_UNEXPLORED);
mgnothg = glyph2ttychar(GLYPH_NOTHING);
/*
* Tiles map tracks glyphs.
* Text map tracks characters derived from glyphs.

View File

@@ -575,7 +575,7 @@ char *posbar;
}
#endif
/* XXX can we decode the glyph in a meaningful way? see mapglyph()?
/* XXX can we decode the glyph in a meaningful way? see map_glyphmod()?
genl_putmixed? */
void
trace_print_glyph(vp, window, x, y, glyph, bkglyph, glyphmod)

View File

@@ -125,7 +125,7 @@ curses_add_inv(int y,
int symbol = 0;
attr_t glyphclr;
mapglyph(glyph, &symbol, &color, &dummy, u.ux, u.uy, 0);
/* mapglyph(glyph, &symbol, &color, &dummy, u.ux, u.uy, 0); */
glyphclr = curses_color_attr(color, 0);
wattron(win, glyphclr);
wprintw(win, "%c ", symbol);

View File

@@ -667,10 +667,6 @@ curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
unsigned int special;
int attr = -1;
#if 0
/* map glyph to character and color */
mapglyph(glyph, &ch, &color, &special, x, y, 0); */
#endif
special = glyphmod[GM_FLAGS];
ch = (int) glyphmod[GM_TTYCHAR];
color = (int) glyphmod[GM_COLOR];

View File

@@ -721,11 +721,6 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
break;
if (data->map[col][row] == NO_GLYPH)
mgch = ' ';
// } else {
// (void) mapglyph(data->map[col][row], &mgch, &color,
// &special, col, row, 0);
// }
msg_data->buffer[index] = data->glyphmod[col][row][GM_TTYCHAR];
index++;
}
@@ -814,11 +809,6 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
layer++;
}
// (void) mapglyph(glyph, &mgch, &color, &special, i, j, 0);
// mgch = (int) data.glyphmod[GM_TTYCHAR];
// color = (int) data.glyphmod[GM_COLOR];
// special = glyphmod[GM_FLAGS];
if ((glyph != NO_GLYPH) && (glyph != bkglyph)) {
/* rely on NetHack core helper routine */
ntile = glyph2tile[glyph];
@@ -844,9 +834,6 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
}
#ifdef USE_PILEMARK
/* rely on NetHack core helper routine */
// (void) mapglyph(data->map[i][j], &mgch, &color, &special,
// i, j, 0);
if ((glyph != NO_GLYPH) && (data->glyphmod[i][j][GM_FLAGS] & MG_PET)
#else
if ((glyph != NO_GLYPH) && glyph_is_pet(glyph)
@@ -919,9 +906,6 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
nhglyph2charcolor(data->map[i][j], &ch, &color);
OldFg = SetTextColor(hDC, nhcolor_to_RGB(color));
#else
/* rely on NetHack core helper routine */
// (void) mapglyph(data->map[i][j], &mgch, &color,
// &special, i, j, 0);
ch = (char) data->glyphmod[i][j][GM_TTYCHAR];
color = (int) data->glyphmod[i][j][GM_COLOR];
if (((data->glyphmod[i][j][GM_FLAGS] & MG_PET) && iflags.hilite_pet)

View File

@@ -3077,8 +3077,7 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color,
long cond, *condptr = (long *) ptr;
char *text = (char *) ptr;
MSNHMsgUpdateStatus update_cmd_data;
int ocolor, ochar, ci;
unsigned ospecial;
int ochar, ci;
logDebug("mswin_status_update(%d, %p, %d, %d, %x, %p)\n", idx, ptr, chg, percent, color, condmasks);
@@ -3130,8 +3129,7 @@ mswin_status_update(int idx, genericptr_t ptr, int chg, int percent, int color,
if (iflags.invis_goldsym)
ochar = GOLD_SYM;
else
mapglyph(objnum_to_glyph(GOLD_PIECE),
&ochar, &ocolor, &ospecial, 0, 0, 0);
ochar = glyph2ttychar(objnum_to_glyph(GOLD_PIECE));
buf[0] = ochar;
p = strchr(text, ':');
if (p) {

View File

@@ -130,7 +130,6 @@
<ClCompile Include="$(SrcDir)lock.c" />
<ClCompile Include="$(SrcDir)mail.c" />
<ClCompile Include="$(SrcDir)makemon.c" />
<ClCompile Include="$(SrcDir)mapglyph.c" />
<ClCompile Include="$(SrcDir)mcastu.c" />
<ClCompile Include="$(SrcDir)mdlib.c" />
<ClCompile Include="$(SrcDir)mhitm.c" />

View File

@@ -124,7 +124,6 @@
<ClCompile Include="$(SrcDir)lock.c" />
<ClCompile Include="$(SrcDir)mail.c" />
<ClCompile Include="$(SrcDir)makemon.c" />
<ClCompile Include="$(SrcDir)mapglyph.c" />
<ClCompile Include="$(SrcDir)mcastu.c" />
<ClCompile Include="$(SrcDir)mdlib.c" />
<ClCompile Include="$(SrcDir)mhitm.c" />