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

@@ -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" />