pmnames mons gender naming plus a window port interface change
add MALE, FEMALE, and gender-neutral names for individual monster species
to the mons array. The gender-neutral name (NEUTRAL) is mandatory, the
MALE and FEMALE versions are not.
replace code uses of the mname field of permonst with one of the three
potentially-available gender-specific names.
consolidate some separate mons entries that differed only by species into a
single mons entry (caveman, cavewoman and priest,priestess etc.)
consolidate several "* lord" and "* queen/* king" monst entries into
their single species, and allow both genders on some where it makes some
sense (there is probably more work and cleanup to come out of this at some
point, and the chosen gender-neutral name variations are not cast in stone
if someone has better suggestions).
related function or macro additions:
pmname(pm, gender) to get the gender variation of the permonst name. It
guards against monsters that haven't got anything except NEUTRAL naming
and falls back to the NEUTRAL version if FEMALE and MALE versions are
missing.
Ugender to obtain the current hero gender.
Mgender(mtmp) to obtain the gender of a monster
While the code can safely refer directly to pmnames[NEUTRAL] safely in the
code because it always exists, the other two (pmnames[MALE] and
pmnames[FEMALE] may not exist so use:
pmname(ptr, gidx)
where -ptr is a permonst *
-gidx is an index into the pmnames array field of the
permonst struct
pmname() checks for a valid index and checks for null-pointers for
pmnames[MALE] and pmnames[FEMALE], and will fall back to pmnames[NEUTRAL] if
the pointer requested if the requested variation is unavailable, or if the
gidx is out-of-range.
Allow code to specify makemon flags to request female or male (via MM_MALE
and MM_FEMALE flags respectively)to makedefs, since the species alone doesn't
distinguish male/female anymore. Specifying MM_MALE or MM_FEMALE won't
override the pm M2_MALE and M2_FEMALE flags on a mons[] entry.
male and female tiles have been added to win/share/monsters.txt.
The majority are duplicated placeholders except for those that were
separate mons entries before. Perhaps someone will contribute artwork in the
future to make the male and female variations visually distinguishable.
tilemapping via has the MALE tile indexes in the glyph2tile[]
array produced at build time. If a window port has information that the
FEMALE tile is required, it just has to increment the index returned
from the glyph2tile[] array by 1.
statues already preserved gender of the monster through STATUE_FEMALE
and STATUE_MALE, so ensure that pmnames takes that into consideration.
I expect some refinement will be required after broad play-testing puts it to
the test.
consolidate caveman,cavewoman and priest,priestess monst.c entries etc
This commit will require a bump of editlevel in patchlevel.h because it alters
the index numbers of the monsters due to the consolidation of some. Those
index numbers are saved in some other structures, even though the mons[] array
itself is not part of the savefile.
Window Port Interface Change
Also add a parameter to print_glyph to convey additional information beyond
the glyph to the window ports. Every single window port was calling back to
mapglyph for the information anyway, so just included it in the interface and
produce the information right in the display core.
The mapglyph() function uses will be eliminated, although there are still some
in the code yet to be dealt with.
win32, tty, x11, Qt, msdos window ports have all had adjustments done to
utilize the new parameter instead of calling mapglyph, but some of those
window ports have not been thoroughly tested since the changes.
Interface change additional info:
print_glyph(window, x, y, glyph, bkglyph, *glyphmod)
-- Print the glyph at (x,y) on the given window. Glyphs are
integers at the interface, mapped to whatever the window-
port wants (symbol, font, color, attributes, ...there's
a 1-1 map between glyphs and distinct things on the map).
-- bkglyph is a background glyph for potential use by some
graphical or tiled environments to allow the depiction
to fall against a background consistent with the grid
around x,y. If bkglyph is NO_GLYPH, then the parameter
should be ignored (do nothing with it).
-- glyphmod provides extended information about the glyph
that window ports can use to enhance the display in
various ways.
unsigned int glyphmod[NUM_GLYPHMOD]
where:
glyphmod[GM_TTYCHAR] is the text characters associated
with the original NetHack display.
glyphmod[GM_FLAGS] are the special flags that denote
additional information that window
ports can use.
glyphmod[GM_COLOR] is the text character
color associated with the original
NetHack display.
Support for including the glyphmod info in the display glyph buffer
alongside the glyph itself was added and is the default operation.
That can be turned off by defining UNBUFFERED_GLYPHMOD at compile time.
With UNBUFFERED_GLYPHMOD operation, a call will be placed to map_glyphmod()
immediately prior to every print_glyph() call.
This commit is contained in:
+3
-2
@@ -474,11 +474,12 @@ void NetHackQtBind::qt_cliparound_window(winid wid, int x, int y)
|
||||
NetHackQtWindow* window=id_to_window[(int)wid];
|
||||
window->ClipAround(x,y);
|
||||
}
|
||||
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph,int bkglyph UNUSED)
|
||||
void NetHackQtBind::qt_print_glyph(winid wid,XCHAR_P x,XCHAR_P y,int glyph,
|
||||
int bkglyph UNUSED, unsigned *glyphmod)
|
||||
{
|
||||
/* TODO: bkglyph */
|
||||
NetHackQtWindow* window=id_to_window[(int)wid];
|
||||
window->PrintGlyph(x,y,glyph);
|
||||
window->PrintGlyph(x,y,glyph,glyphmod);
|
||||
}
|
||||
//void NetHackQtBind::qt_print_glyph_compose(winid wid,xchar x,xchar y,int glyph1, int glyph2)
|
||||
//{
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ public:
|
||||
static void qt_cliparound(int x, int y);
|
||||
static void qt_cliparound_window(winid wid, int x, int y);
|
||||
static void qt_print_glyph(winid wid, XCHAR_P x, XCHAR_P y,
|
||||
int glyph, int bkglyph);
|
||||
int glyph, int bkglyph, unsigned int *);
|
||||
static void qt_raw_print(const char *str);
|
||||
static void qt_raw_print_bold(const char *str);
|
||||
static int qt_nhgetch();
|
||||
|
||||
+13
-9
@@ -82,30 +82,32 @@ NetHackQtGlyphs::NetHackQtGlyphs()
|
||||
}
|
||||
|
||||
void NetHackQtGlyphs::drawGlyph(QPainter& painter, int glyph, int x, int y,
|
||||
bool reversed)
|
||||
bool fem, bool reversed)
|
||||
{
|
||||
if (!reversed) {
|
||||
int tile = glyph2tile[glyph];
|
||||
if (fem)
|
||||
++tile;
|
||||
int px = (tile % tiles_per_row) * width();
|
||||
int py = tile / tiles_per_row * height();
|
||||
|
||||
painter.drawPixmap(x, y, pm, px, py, width(), height());
|
||||
} else {
|
||||
// for paper doll; mirrored image for left side of two-handed weapon
|
||||
painter.drawPixmap(x, y, reversed_pixmap(glyph),
|
||||
painter.drawPixmap(x, y, reversed_pixmap(glyph, fem),
|
||||
0, 0, width(), height());
|
||||
}
|
||||
}
|
||||
|
||||
void NetHackQtGlyphs::drawCell(QPainter& painter, int glyph,
|
||||
int cellx, int celly)
|
||||
int cellx, int celly, bool fem)
|
||||
{
|
||||
drawGlyph(painter, glyph, cellx * width(), celly * height(), false);
|
||||
drawGlyph(painter, glyph, cellx * width(), celly * height(), fem, false);
|
||||
}
|
||||
|
||||
void NetHackQtGlyphs::drawBorderedCell(QPainter& painter, int glyph,
|
||||
int cellx, int celly, int border,
|
||||
bool reversed)
|
||||
bool reversed, bool fem)
|
||||
{
|
||||
int wd = width(),
|
||||
ht = height(),
|
||||
@@ -113,7 +115,7 @@ void NetHackQtGlyphs::drawBorderedCell(QPainter& painter, int glyph,
|
||||
lox = cellx * (wd + 2),
|
||||
loy = celly * (ht + 2) + yoffset;
|
||||
|
||||
drawGlyph(painter, glyph, lox + 1, loy + 1, reversed);
|
||||
drawGlyph(painter, glyph, lox + 1, loy + 1, fem, reversed);
|
||||
|
||||
#ifdef TEXTCOLOR
|
||||
if (border != NO_BORDER) {
|
||||
@@ -164,9 +166,11 @@ void NetHackQtGlyphs::drawBorderedCell(QPainter& painter, int glyph,
|
||||
}
|
||||
|
||||
// mis-named routine to get the pixmap for a particular glyph
|
||||
QPixmap NetHackQtGlyphs::glyph(int glyphindx)
|
||||
QPixmap NetHackQtGlyphs::glyph(int glyphindx, bool fem)
|
||||
{
|
||||
int tile = glyph2tile[glyphindx];
|
||||
if (fem)
|
||||
++tile;
|
||||
int px = (tile % tiles_per_row) * tilefile_tile_W;
|
||||
int py = tile / tiles_per_row * tilefile_tile_H;
|
||||
|
||||
@@ -175,9 +179,9 @@ QPixmap NetHackQtGlyphs::glyph(int glyphindx)
|
||||
}
|
||||
|
||||
// transpose a glyph's tile horizontally, scaled for use in paper doll
|
||||
QPixmap NetHackQtGlyphs::reversed_pixmap(int glyphindx)
|
||||
QPixmap NetHackQtGlyphs::reversed_pixmap(int glyphindx, bool fem)
|
||||
{
|
||||
QPixmap pxmp = glyph(glyphindx);
|
||||
QPixmap pxmp = glyph(glyphindx, fem);
|
||||
#ifdef ENHANCED_PAPERDOLL
|
||||
qreal wid = (qreal) pxmp.width(),
|
||||
//hgt = (qreal) pxmp.height(),
|
||||
|
||||
+5
-5
@@ -24,13 +24,13 @@ public:
|
||||
void setSize(int w, int h);
|
||||
|
||||
void drawGlyph(QPainter &, int glyph, int pixelx, int pixely,
|
||||
bool reversed = false);
|
||||
void drawCell(QPainter &, int glyph, int cellx, int celly);
|
||||
bool fem, bool reversed = false);
|
||||
void drawCell(QPainter &, int glyph, int cellx, int celly, bool fem);
|
||||
void drawBorderedCell(QPainter &, int glyph,
|
||||
int cellx, int celly, int bordercode,
|
||||
bool reversed);
|
||||
QPixmap glyph(int glyphindx);
|
||||
QPixmap reversed_pixmap(int glyphindx);
|
||||
bool reversed, bool fem = false);
|
||||
QPixmap glyph(int glyphindx, bool fem = false);
|
||||
QPixmap reversed_pixmap(int glyphindx, bool fem = false);
|
||||
|
||||
private:
|
||||
QImage img;
|
||||
|
||||
+53
-12
@@ -176,14 +176,19 @@ 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 color;
|
||||
int ch;
|
||||
unsigned special;
|
||||
|
||||
#else
|
||||
int color = Glyphcolor(i,j);
|
||||
int ch = Glyphttychar(i,j);
|
||||
unsigned special = Glyphflags(i,j);
|
||||
#endif
|
||||
painter.setPen( Qt::green );
|
||||
/* map glyph to character and color */
|
||||
mapglyph(g, &ch, &color, &special, i, j, 0);
|
||||
// mapglyph(g, &ch, &color, &special, i, j, 0);
|
||||
ch = cp437(ch);
|
||||
#ifdef TEXTCOLOR
|
||||
painter.setPen( nhcolor_to_pen(color) );
|
||||
@@ -220,15 +225,20 @@ void NetHackQtMapViewport::paintEvent(QPaintEvent* event)
|
||||
}
|
||||
|
||||
painter.setFont(font());
|
||||
} else {
|
||||
} else { // tiles
|
||||
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);
|
||||
qt_settings->glyphs().drawCell(painter, g, i, j);
|
||||
#else
|
||||
unsigned special = Glyphflags(i, j);
|
||||
#endif
|
||||
bool femflag = (special & MG_FEMALE) ? true : false;
|
||||
qt_settings->glyphs().drawCell(painter, g, i, j, femflag);
|
||||
#ifdef TEXTCOLOR
|
||||
if ((special & MG_PET) != 0 && ::iflags.hilite_pet) {
|
||||
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
|
||||
@@ -559,8 +569,14 @@ void NetHackQtMapViewport::Clear()
|
||||
// FIXME: map column 0 should be surpressed from being displayed
|
||||
//
|
||||
Glyph(0, j) = GLYPH_NOTHING;
|
||||
Glyphttychar(0, j) = ' ';
|
||||
Glyphcolor(0, j) = NO_COLOR;
|
||||
Glyphflags(0, j) = 0;
|
||||
for (int i = 1; i < COLNO; ++i)
|
||||
Glyph(i, j) = GLYPH_UNEXPLORED;
|
||||
Glyphttychar(0, j) = ' ';
|
||||
Glyphcolor(0, j) = NO_COLOR;
|
||||
Glyphflags(0, j) = 0;
|
||||
}
|
||||
|
||||
change.clear();
|
||||
@@ -594,9 +610,12 @@ void NetHackQtMapViewport::CursorTo(int x,int y)
|
||||
Changed(cursor.x(),cursor.y());
|
||||
}
|
||||
|
||||
void NetHackQtMapViewport::PrintGlyph(int x,int y,int theglyph)
|
||||
void NetHackQtMapViewport::PrintGlyph(int x,int y,int theglyph,unsigned *glyphmod)
|
||||
{
|
||||
Glyph(x,y)=theglyph;
|
||||
Glyphttychar(x,y)=glyphmod[GM_TTYCHAR];
|
||||
Glyphcolor(x,y)=glyphmod[GM_COLOR];
|
||||
Glyphflags(x,y)=glyphmod[GM_FLAGS];
|
||||
Changed(x,y);
|
||||
}
|
||||
|
||||
@@ -701,9 +720,9 @@ void NetHackQtMapWindow2::ClipAround(int x,int y)
|
||||
ensureVisible(x,y,width()*0.45,height()*0.45);
|
||||
}
|
||||
|
||||
void NetHackQtMapWindow2::PrintGlyph(int x,int y,int glyph)
|
||||
void NetHackQtMapWindow2::PrintGlyph(int x,int y,int glyph, unsigned *glyphmod)
|
||||
{
|
||||
m_viewport->PrintGlyph(x, y, glyph);
|
||||
m_viewport->PrintGlyph(x, y, glyph, glyphmod);
|
||||
}
|
||||
|
||||
#if 0 //RLC
|
||||
@@ -825,8 +844,15 @@ void NetHackQtMapWindow::Clear()
|
||||
{
|
||||
for (int j = 0; j < ROWNO; ++j) {
|
||||
Glyph(0, j) = GLYPH_NOTHING;
|
||||
for (int i = 1; i < COLNO; ++i)
|
||||
Glyphcolor(0, j) = NO_COLOR;
|
||||
Glyphttychar(0, j) = ' ';
|
||||
Glyphflags(0, j) = 0;
|
||||
for (int i = 1; i < COLNO; ++i) {
|
||||
Glyph(i, j) = GLYPH_UNEXPLORED;
|
||||
Glyphcolor(i, j) = NO_COLOR;
|
||||
Glyphttychar(i, j) = ' ';
|
||||
Glyphflags(i, j) = 0;
|
||||
}
|
||||
}
|
||||
|
||||
change.clear();
|
||||
@@ -897,13 +923,18 @@ 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;
|
||||
char32_t ch;
|
||||
unsigned special;
|
||||
|
||||
#else
|
||||
int color = Glyphcolor(i,j);
|
||||
char32_t ch = Glyphttychar(i,j);
|
||||
unsigned special = Glyphflags(i,j);
|
||||
#endif
|
||||
painter.setPen( Qt::green );
|
||||
/* map glyph to character and color */
|
||||
mapglyph(g, &ch, &color, &special, i, j, 0);
|
||||
// mapglyph(g, &ch, &color, &special, i, j, 0);
|
||||
#ifdef TEXTCOLOR
|
||||
painter.setPen( nhcolor_to_pen(color) );
|
||||
#endif
|
||||
@@ -935,11 +966,18 @@ 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);
|
||||
qt_settings->glyphs().drawCell(painter, g, i, j);
|
||||
#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
|
||||
if ((special & MG_PET) != 0 && ::iflags.hilite_pet) {
|
||||
painter.drawPixmap(QPoint(i*qt_settings->glyphs().width(),
|
||||
@@ -1048,9 +1086,12 @@ void NetHackQtMapWindow::ClipAround(int x,int y)
|
||||
viewport.center(x,y,0.45,0.45);
|
||||
}
|
||||
|
||||
void NetHackQtMapWindow::PrintGlyph(int x,int y,int glyph)
|
||||
void NetHackQtMapWindow::PrintGlyph(int x,int y,int glyph, unsigned *glyphmod)
|
||||
{
|
||||
Glyph(x,y)=glyph;
|
||||
Glyphttychar(x,y)=glyphmod[GM_TTYCHAR];
|
||||
Glyphcolor(x,y)=glyphmod[GM_COLOR];
|
||||
Glyphflags(x,y)=glyphmod[GM_FLAGS];
|
||||
Changed(x,y);
|
||||
}
|
||||
|
||||
|
||||
+8
-2
@@ -32,6 +32,12 @@ private:
|
||||
QFont *rogue_font;
|
||||
unsigned short glyph[ROWNO][COLNO];
|
||||
unsigned short& Glyph(int x, int y) { return glyph[y][x]; }
|
||||
unsigned int glyphttychar[ROWNO][COLNO];
|
||||
unsigned int& Glyphttychar(int x, int y) { return glyphttychar[y][x]; }
|
||||
unsigned int glyphcolor[ROWNO][COLNO];
|
||||
unsigned int& Glyphcolor(int x, int y) { return glyphcolor[y][x]; }
|
||||
unsigned int glyphflags[ROWNO][COLNO];
|
||||
unsigned int& Glyphflags(int x, int y) { return glyphflags[y][x]; }
|
||||
QPoint cursor;
|
||||
QPixmap pet_annotation;
|
||||
QPixmap pile_annotation;
|
||||
@@ -42,7 +48,7 @@ private:
|
||||
void Clear();
|
||||
void Display(bool block);
|
||||
void CursorTo(int x,int y);
|
||||
void PrintGlyph(int x,int y,int glyph);
|
||||
void PrintGlyph(int x,int y,int glyph,unsigned *glyphmod);
|
||||
void Changed(int x, int y);
|
||||
void updateTiles();
|
||||
|
||||
@@ -64,7 +70,7 @@ public:
|
||||
virtual void CursorTo(int x,int y);
|
||||
virtual void PutStr(int attr, const QString& text);
|
||||
virtual void ClipAround(int x,int y);
|
||||
virtual void PrintGlyph(int x,int y,int glyph);
|
||||
virtual void PrintGlyph(int x,int y,int glyph,unsigned *glyphmod);
|
||||
|
||||
signals:
|
||||
void resized();
|
||||
|
||||
+15
-10
@@ -82,14 +82,14 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
void setGlyph(int g)
|
||||
void setGlyph(int g, bool fem)
|
||||
{
|
||||
NetHackQtGlyphs& glyphs = qt_settings->glyphs();
|
||||
int gw = glyphs.width();
|
||||
int gh = glyphs.height();
|
||||
QPixmap pm(gw,gh);
|
||||
QPainter p(&pm);
|
||||
glyphs.drawGlyph(p, g, 0, 0);
|
||||
glyphs.drawGlyph(p, g, 0, 0, fem);
|
||||
p.end();
|
||||
setIcon(QIcon(pm));
|
||||
//RLC setHeight(std::max(pm.height()+1,height()));
|
||||
@@ -124,7 +124,7 @@ public:
|
||||
#endif
|
||||
)
|
||||
{
|
||||
setGlyph(monnum_to_glyph(roles[id].malenum));
|
||||
setGlyph(monnum_to_glyph(roles[id].malenum), false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -139,7 +139,7 @@ public:
|
||||
#endif
|
||||
)
|
||||
{
|
||||
setGlyph(monnum_to_glyph(races[id].malenum));
|
||||
setGlyph(monnum_to_glyph(races[id].malenum), false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -257,6 +257,7 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED)
|
||||
|
||||
chosen_gend = flags.initgend;
|
||||
chosen_align = flags.initalign;
|
||||
bool fem = (chosen_gend > ROLE_NONE);
|
||||
|
||||
// XXX QListView unsorted goes in rev.
|
||||
for (nrole=0; roles[nrole].name.m; nrole++)
|
||||
@@ -264,8 +265,8 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED)
|
||||
role->setRowCount(nrole);
|
||||
for (i=0; roles[i].name.m; i++) {
|
||||
QTableWidgetItem *item = new QTableWidgetItem(
|
||||
QIcon(qt_settings->glyphs().glyph(roles[i].malenum)),
|
||||
roles[i].name.m);
|
||||
QIcon(qt_settings->glyphs().glyph(roles[i].malenum, fem)),
|
||||
roles[i].name.m);
|
||||
item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
|
||||
role->setItem(i, 0, item);
|
||||
}
|
||||
@@ -280,7 +281,7 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED)
|
||||
race->setRowCount(nrace);
|
||||
for (i=0; races[i].noun; i++) {
|
||||
QTableWidgetItem *item = new QTableWidgetItem(
|
||||
QIcon(qt_settings->glyphs().glyph(races[i].malenum)),
|
||||
QIcon(qt_settings->glyphs().glyph(races[i].malenum, fem)),
|
||||
races[i].noun);
|
||||
item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
|
||||
race->setItem(i, 0, item);
|
||||
@@ -290,9 +291,13 @@ NetHackQtPlayerSelector::NetHackQtPlayerSelector(NetHackQtKeyBuffer& ks UNUSED)
|
||||
race->setHorizontalHeaderLabels(QStringList("Race"));
|
||||
race->resizeColumnToContents(0);
|
||||
|
||||
// TODO: render the alignment and gender labels smaller to match the
|
||||
// horizontal header labels for role and race; getting the font from
|
||||
// race table above and setting it for labels below made no difference
|
||||
// TODO:
|
||||
// Render the alignment and gender labels smaller to match the
|
||||
// horizontal header labels for role and race; getting the font from
|
||||
// race table above and setting it for labels below made no difference.
|
||||
//
|
||||
// Maybe, if the order of choosing becomes more dynamic:
|
||||
// Replace the role and race glyphs when gender gets set.
|
||||
|
||||
QLabel *gendlabel = new QLabel("Gender");
|
||||
genderbox->layout()->addWidget(gendlabel);
|
||||
|
||||
+2
-1
@@ -788,7 +788,8 @@ void NetHackQtStatusWindow::updateStats()
|
||||
if (u.usteed) ++k, ride.show(); else ride.hide();
|
||||
|
||||
if (Upolyd) {
|
||||
buf = nh_capitalize_words(mons[u.umonnum].mname);
|
||||
buf = nh_capitalize_words(pmname(&mons[u.umonnum],
|
||||
::flags.female ? FEMALE : MALE));
|
||||
} else {
|
||||
buf = rank_of(u.ulevel, g.pl_character[0], ::flags.female);
|
||||
}
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ void NetHackQtWindow::EndMenu(const QString& prompt UNUSED) { puts("unexpected E
|
||||
int NetHackQtWindow::SelectMenu(int how UNUSED, MENU_ITEM_P **menu_list UNUSED)
|
||||
{ puts("unexpected SelectMenu"); return 0; }
|
||||
void NetHackQtWindow::ClipAround(int x UNUSED,int y UNUSED) { puts("unexpected ClipAround"); }
|
||||
void NetHackQtWindow::PrintGlyph(int x UNUSED,int y UNUSED,int glyph UNUSED) { puts("unexpected PrintGlyph"); }
|
||||
void NetHackQtWindow::PrintGlyph(int x UNUSED,int y UNUSED,int glyph UNUSED, unsigned *glyphmod UNUSED) { puts("unexpected PrintGlyph"); }
|
||||
//void NetHackQtWindow::PrintGlyphCompose(int x,int y,int,int) { puts("unexpected PrintGlyphCompose"); }
|
||||
void NetHackQtWindow::UseRIP(int how UNUSED, time_t when UNUSED) { puts("unexpected UseRIP"); }
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ public:
|
||||
virtual void EndMenu(const QString& prompt);
|
||||
virtual int SelectMenu(int how, MENU_ITEM_P **menu_list);
|
||||
virtual void ClipAround(int x, int y);
|
||||
virtual void PrintGlyph(int x, int y, int glyph);
|
||||
virtual void PrintGlyph(int x, int y, int glyph, unsigned *glyphmod);
|
||||
virtual void UseRIP(int how, time_t when);
|
||||
|
||||
int nhid;
|
||||
|
||||
+4
-1
@@ -73,11 +73,12 @@ static void FDECL(display_cursor, (struct xwindow *));
|
||||
/* Global functions ======================================================= */
|
||||
|
||||
void
|
||||
X11_print_glyph(window, x, y, glyph, bkglyph)
|
||||
X11_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph;
|
||||
int bkglyph UNUSED;
|
||||
unsigned *glyphmod UNUSED;
|
||||
{
|
||||
struct map_info_t *map_info;
|
||||
boolean update_bbox = FALSE;
|
||||
@@ -1295,6 +1296,8 @@ boolean inverted;
|
||||
int dest_x = (cur_col - COL0_OFFSET) * tile_map->square_width;
|
||||
int dest_y = row * tile_map->square_height;
|
||||
|
||||
if ((tile_map->glyphs[row][cur_col].special & MG_FEMALE))
|
||||
tile++; /* advance to the female tile variation */
|
||||
src_x = (tile % TILES_PER_ROW) * tile_width;
|
||||
src_y = (tile / TILES_PER_ROW) * tile_height;
|
||||
XCopyArea(dpy, tile_pixmap, XtWindow(wp->w),
|
||||
|
||||
+6
-6
@@ -1453,15 +1453,15 @@ long new_value;
|
||||
buf[0] = highc(buf[0]);
|
||||
Strcat(buf, " the ");
|
||||
if (Upolyd) {
|
||||
char mname[BUFSZ];
|
||||
char mnam[BUFSZ];
|
||||
int k;
|
||||
|
||||
Strcpy(mname, mons[u.umonnum].mname);
|
||||
for (k = 0; mname[k] != '\0'; k++) {
|
||||
if (k == 0 || mname[k - 1] == ' ')
|
||||
mname[k] = highc(mname[k]);
|
||||
Strcpy(mnam, pmname(&mons[u.umonnum], Ugender));
|
||||
for (k = 0; mnam[k] != '\0'; k++) {
|
||||
if (k == 0 || mnam[k - 1] == ' ')
|
||||
mnam[k] = highc(mnam[k]);
|
||||
}
|
||||
Strcat(buf, mname);
|
||||
Strcat(buf, mnam);
|
||||
} else
|
||||
Strcat(buf,
|
||||
rank_of(u.ulevel, g.pl_character[0], flags.female));
|
||||
|
||||
@@ -272,12 +272,13 @@ char *posbar;
|
||||
|
||||
/* XXX can we decode the glyph in a meaningful way? */
|
||||
void
|
||||
chainin_print_glyph(window, x, y, glyph, bkglyph)
|
||||
chainin_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph, bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
{
|
||||
(*cibase->nprocs->win_print_glyph)(cibase->ndata, window, x, y, glyph, bkglyph);
|
||||
(*cibase->nprocs->win_print_glyph)(cibase->ndata, window, x, y, glyph, bkglyph, glyphmod);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -336,15 +336,16 @@ char *posbar;
|
||||
#endif
|
||||
|
||||
void
|
||||
chainout_print_glyph(vp, window, x, y, glyph, bkglyph)
|
||||
chainout_print_glyph(vp, window, x, y, glyph, bkglyph, glyphmod)
|
||||
void *vp;
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph, bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
{
|
||||
struct chainout_data *tdp = vp;
|
||||
|
||||
(*tdp->nprocs->win_print_glyph)(window, x, y, glyph, bkglyph);
|
||||
(*tdp->nprocs->win_print_glyph)(window, x, y, glyph, bkglyph, glyphmod);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -578,19 +578,20 @@ char *posbar;
|
||||
/* XXX can we decode the glyph in a meaningful way? see mapglyph()?
|
||||
genl_putmixed? */
|
||||
void
|
||||
trace_print_glyph(vp, window, x, y, glyph, bkglyph)
|
||||
trace_print_glyph(vp, window, x, y, glyph, bkglyph, glyphmod)
|
||||
void *vp;
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph, bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
{
|
||||
struct trace_data *tdp = vp;
|
||||
|
||||
fprintf(wc_tracelogf, "%sprint_glyph(%d, %d, %d, %d, %d)\n", INDENT, window,
|
||||
x, y, glyph, bkglyph);
|
||||
fprintf(wc_tracelogf, "%sprint_glyph(%d, %d, %d, %d, %d, %lu)\n", INDENT, window,
|
||||
x, y, glyph, bkglyph, glyphmod);
|
||||
|
||||
PRE;
|
||||
(*tdp->nprocs->win_print_glyph)(tdp->ndata, window, x, y, glyph, bkglyph);
|
||||
(*tdp->nprocs->win_print_glyph)(tdp->ndata, window, x, y, glyph, bkglyph, glyphmod);
|
||||
POST;
|
||||
}
|
||||
|
||||
|
||||
@@ -646,17 +646,21 @@ curses_cliparound(int x, int y)
|
||||
}
|
||||
|
||||
/*
|
||||
print_glyph(window, x, y, glyph, bkglyph)
|
||||
print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
-- Print the glyph at (x,y) on the given window. Glyphs are
|
||||
integers at the interface, mapped to whatever the window-
|
||||
port wants (symbol, font, color, attributes, ...there's
|
||||
a 1-1 map between glyphs and distinct things on the map).
|
||||
bkglyph is to render the background behind the glyph.
|
||||
It's not used here.
|
||||
-- glyphmod (glyphmod[NUM_GLYPHNOD]) provides extended
|
||||
information about the glyph that window ports can use to
|
||||
enhance the display in various ways.
|
||||
|
||||
*/
|
||||
void
|
||||
curses_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph,
|
||||
int bkglyph UNUSED)
|
||||
int bkglyph UNUSED, unsigned *glyphmod)
|
||||
{
|
||||
int ch;
|
||||
int color;
|
||||
|
||||
@@ -1468,7 +1468,7 @@ get_playerrank(char *rank)
|
||||
if (Upolyd) {
|
||||
int k = 0;
|
||||
|
||||
Strcpy(buf, mons[u.umonnum].mname);
|
||||
Strcpy(buf, pmname(&mons[u.umonnum], flags.female ? FEMALE : MALE));
|
||||
while(buf[k] != 0) {
|
||||
if ((k == 0 || (k > 0 && buf[k-1] == ' ')) &&
|
||||
'a' <= buf[k] && buf[k] <= 'z')
|
||||
|
||||
+7825
-434
File diff suppressed because it is too large
Load Diff
@@ -3,10 +3,7 @@
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
|
||||
/* must #define SAFEPROCS in xxxconf.h or via CFLAGS or this won't compile */
|
||||
#include "config.h"
|
||||
#include "color.h"
|
||||
#include "wintype.h"
|
||||
#include "winprocs.h"
|
||||
#include "hack.h"
|
||||
|
||||
/*
|
||||
* ***********************************************************
|
||||
@@ -324,11 +321,12 @@ int x, y;
|
||||
* Print the glyph to the output device. Don't flush the output device.
|
||||
*/
|
||||
void
|
||||
safe_print_glyph(window, x, y, glyph, bkglyph)
|
||||
safe_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph;
|
||||
int bkglyph UNUSED;
|
||||
int glyphmod[NUM_GLYPHMOD] UNUSED;
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
+279
-125
@@ -18,10 +18,22 @@
|
||||
|
||||
#define Fprintf (void) fprintf
|
||||
|
||||
const char *FDECL(tilename, (int, int));
|
||||
/*
|
||||
* Defining OBTAIN_TILEMAP to get a listing of the tile-mappings
|
||||
* for debugging purposes requires that your link to produce
|
||||
* the tilemap utility must also include:
|
||||
* objects.o, monst.o drawing.o
|
||||
*/
|
||||
/* #define OBTAIN_TILEMAP */
|
||||
|
||||
#if defined(OBTAIN_TILEMAP) && !defined(TILETEXT)
|
||||
FILE *tilemap_file;
|
||||
#endif
|
||||
|
||||
const char *FDECL(tilename, (int, int, int));
|
||||
void NDECL(init_tilemap);
|
||||
void FDECL(process_substitutions, (FILE *));
|
||||
boolean FDECL(acceptable_tilename, (int, const char *, const char *));
|
||||
boolean FDECL(acceptable_tilename, (int, int, const char *, const char *));
|
||||
|
||||
#if defined(MICRO) || defined(WIN32)
|
||||
#undef exit
|
||||
@@ -34,17 +46,14 @@ extern void FDECL(exit, (int));
|
||||
#define STATUES_LOOK_LIKE_MONSTERS
|
||||
#endif
|
||||
|
||||
#define MON_GLYPH 1
|
||||
#define OBJ_GLYPH 2
|
||||
#define OTH_GLYPH 3 /* fortunately unnecessary */
|
||||
|
||||
enum {MON_GLYPH, OBJ_GLYPH, OTH_GLYPH, TERMINATOR = -1};
|
||||
#define EXTRA_SCROLL_DESCR_COUNT ((SCR_BLANK_PAPER - SCR_STINKING_CLOUD) - 1)
|
||||
|
||||
/* note that the ifdefs here should be the opposite sense from monst.c/
|
||||
* objects.c/rm.h
|
||||
*/
|
||||
|
||||
struct conditionals {
|
||||
struct conditionals_t {
|
||||
int sequence, predecessor;
|
||||
const char *name;
|
||||
} conditionals[] = {
|
||||
@@ -56,7 +65,7 @@ struct conditionals {
|
||||
{ MON_GLYPH, PM_BABY_SILVER_DRAGON, "baby shimmering dragon" },
|
||||
{ MON_GLYPH, PM_SILVER_DRAGON, "shimmering dragon" },
|
||||
{ MON_GLYPH, PM_JABBERWOCK, "vorpal jabberwock" },
|
||||
{ MON_GLYPH, PM_VAMPIRE_LORD, "vampire mage" },
|
||||
{ MON_GLYPH, PM_VAMPIRE_LEADER, "vampire mage" },
|
||||
#ifndef CHARON /* not supported yet */
|
||||
{ MON_GLYPH, PM_CROESUS, "Charon" },
|
||||
#endif
|
||||
@@ -79,7 +88,7 @@ struct conditionals {
|
||||
{ OBJ_GLYPH, SCR_STINKING_CLOUD + EXTRA_SCROLL_DESCR_COUNT,
|
||||
"stamped / mail" },
|
||||
#endif
|
||||
{ 0, 0, 0 }
|
||||
{ TERMINATOR, 0, 0 }
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -103,42 +112,42 @@ struct substitute {
|
||||
{ GLYPH_CMAP_OFF + S_vwall, GLYPH_CMAP_OFF + S_trwall,
|
||||
"sokoban walls", "In_sokoban(plev)" } };
|
||||
|
||||
#ifdef TILETEXT
|
||||
|
||||
#if defined(TILETEXT) || defined(OBTAIN_TILEMAP)
|
||||
/*
|
||||
* entry is the position of the tile within the monsters/objects/other set
|
||||
* file_entry is the position of the tile within the monsters/objects/other set
|
||||
*/
|
||||
const char *
|
||||
tilename(set, entry)
|
||||
int set, entry;
|
||||
tilename(set, file_entry, gend)
|
||||
int set, file_entry, gend;
|
||||
{
|
||||
int i, j, condnum, tilenum;
|
||||
int i, j, condnum, tilenum, gendnum;
|
||||
static char buf[BUFSZ];
|
||||
|
||||
(void) def_char_to_objclass(']');
|
||||
|
||||
condnum = tilenum = 0;
|
||||
condnum = tilenum = gendnum = 0;
|
||||
|
||||
for (i = 0; i < NUMMONS; i++) {
|
||||
if (set == MON_GLYPH && tilenum == entry)
|
||||
return mons[i].mname;
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == MON_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
if (set == MON_GLYPH && tilenum == entry)
|
||||
return conditionals[condnum].name;
|
||||
condnum++;
|
||||
tilenum++;
|
||||
if (set == MON_GLYPH && tilenum == file_entry && gend == 0)
|
||||
return mons[i].pmnames[NEUTRAL];
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; ++condnum) {
|
||||
if (conditionals[condnum].sequence == MON_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
tilenum += 2;
|
||||
if (set == MON_GLYPH && tilenum == file_entry)
|
||||
return conditionals[condnum].name;
|
||||
}
|
||||
}
|
||||
tilenum += 2;
|
||||
}
|
||||
if (set == MON_GLYPH && tilenum == entry)
|
||||
if (set == MON_GLYPH && tilenum == file_entry)
|
||||
return "invisible monster";
|
||||
|
||||
tilenum = 0; /* set-relative number */
|
||||
for (i = 0; i < NUM_OBJECTS; i++) {
|
||||
/* prefer to give the description - that's all the tile's
|
||||
* appearance should reveal */
|
||||
if (set == OBJ_GLYPH && tilenum == entry) {
|
||||
if (set == OBJ_GLYPH && tilenum == file_entry) {
|
||||
if (!obj_descr[i].oc_descr)
|
||||
return obj_descr[i].oc_name;
|
||||
if (!obj_descr[i].oc_name)
|
||||
@@ -148,20 +157,20 @@ int set, entry;
|
||||
obj_descr[i].oc_name);
|
||||
return buf;
|
||||
}
|
||||
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == OBJ_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
if (set == OBJ_GLYPH && tilenum == entry)
|
||||
return conditionals[condnum].name;
|
||||
condnum++;
|
||||
tilenum++;
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; ++condnum) {
|
||||
if (conditionals[condnum].sequence == OBJ_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
tilenum++;
|
||||
if (set == OBJ_GLYPH && tilenum == file_entry)
|
||||
return conditionals[condnum].name;
|
||||
}
|
||||
}
|
||||
tilenum++;
|
||||
}
|
||||
|
||||
tilenum = 0; /* set-relative number */
|
||||
for (i = 0; i < (MAXPCHARS - MAXEXPCHARS); i++) {
|
||||
if (set == OTH_GLYPH && tilenum == entry) {
|
||||
if (set == OTH_GLYPH && tilenum == file_entry) {
|
||||
if (*defsyms[i].explanation) {
|
||||
return defsyms[i].explanation;
|
||||
} else {
|
||||
@@ -169,18 +178,19 @@ int set, entry;
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == OTH_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
if (set == OTH_GLYPH && tilenum == entry)
|
||||
return conditionals[condnum].name;
|
||||
condnum++;
|
||||
tilenum++;
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; ++condnum) {
|
||||
if (conditionals[condnum].sequence == OTH_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
tilenum++;
|
||||
if (set == OTH_GLYPH && tilenum == file_entry)
|
||||
return conditionals[condnum].name;
|
||||
}
|
||||
}
|
||||
tilenum++;
|
||||
}
|
||||
/* explosions */
|
||||
tilenum = MAXPCHARS - MAXEXPCHARS;
|
||||
i = entry - tilenum;
|
||||
i = file_entry - tilenum;
|
||||
if (i < (MAXEXPCHARS * EXPL_MAX)) {
|
||||
if (set == OTH_GLYPH) {
|
||||
static const char *explosion_types[] = {
|
||||
@@ -195,7 +205,7 @@ int set, entry;
|
||||
}
|
||||
tilenum += (MAXEXPCHARS * EXPL_MAX);
|
||||
|
||||
i = entry - tilenum;
|
||||
i = file_entry - tilenum;
|
||||
if (i < (NUM_ZAP << 2)) {
|
||||
if (set == OTH_GLYPH) {
|
||||
Sprintf(buf, "zap %d %d", i / 4, i % 4);
|
||||
@@ -204,7 +214,7 @@ int set, entry;
|
||||
}
|
||||
tilenum += (NUM_ZAP << 2);
|
||||
|
||||
i = entry - tilenum;
|
||||
i = file_entry - tilenum;
|
||||
if (i < WARNCOUNT) {
|
||||
if (set == OTH_GLYPH) {
|
||||
Sprintf(buf, "warning %d", i);
|
||||
@@ -213,7 +223,7 @@ int set, entry;
|
||||
}
|
||||
tilenum += WARNCOUNT;
|
||||
|
||||
i = entry - tilenum;
|
||||
i = file_entry - tilenum;
|
||||
if (i < 1) {
|
||||
if (set == OTH_GLYPH) {
|
||||
Sprintf(buf, "unexplored");
|
||||
@@ -222,17 +232,17 @@ int set, entry;
|
||||
}
|
||||
tilenum += 1;
|
||||
|
||||
i = entry - tilenum;
|
||||
i = file_entry - tilenum;
|
||||
if (i < 1) {
|
||||
if (set == OTH_GLYPH) {
|
||||
Sprintf(buf, "nothing");
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
tilenum += 1;
|
||||
tilenum++;
|
||||
|
||||
for (i = 0; i < SIZE(substitutes); i++) {
|
||||
j = entry - tilenum;
|
||||
j = file_entry - tilenum;
|
||||
if (j <= substitutes[i].last_glyph - substitutes[i].first_glyph) {
|
||||
if (set == OTH_GLYPH) {
|
||||
Sprintf(buf, "sub %s %d", substitutes[i].sub_name, j);
|
||||
@@ -242,12 +252,12 @@ int set, entry;
|
||||
tilenum += substitutes[i].last_glyph - substitutes[i].first_glyph + 1;
|
||||
}
|
||||
|
||||
Sprintf(buf, "unknown %d %d", set, entry);
|
||||
Sprintf(buf, "unknown %d %d", set, file_entry);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else /* TILETEXT */
|
||||
|
||||
#ifndef TILETEXT
|
||||
#define TILE_FILE "tile.c"
|
||||
|
||||
#ifdef AMIGA
|
||||
@@ -260,7 +270,14 @@ int set, entry;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
short tilemap[MAX_GLYPH];
|
||||
struct tilemap_t {
|
||||
short tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
char name[80];
|
||||
int glyph;
|
||||
#endif
|
||||
} tilemap[MAX_GLYPH];
|
||||
|
||||
|
||||
#ifdef STATUES_LOOK_LIKE_MONSTERS
|
||||
int lastmontile, lastobjtile, lastothtile, laststatuetile;
|
||||
@@ -275,7 +292,8 @@ int lastmontile, lastobjtile, lastothtile;
|
||||
* set up array to map glyph numbers to tile numbers
|
||||
*
|
||||
* assumes tiles are numbered sequentially through monsters/objects/other,
|
||||
* with entries for all supported compilation options
|
||||
* with entries for all supported compilation options. monsters have two
|
||||
* tiles for each (male + female).
|
||||
*
|
||||
* "other" contains cmap and zaps (the swallow sets are a repeated portion
|
||||
* of cmap), as well as the "flash" glyphs for the new warning system
|
||||
@@ -286,20 +304,21 @@ init_tilemap()
|
||||
{
|
||||
int i, j, condnum, tilenum;
|
||||
int corpsetile, swallowbase;
|
||||
int file_entry = 0;
|
||||
|
||||
for (i = 0; i < MAX_GLYPH; i++) {
|
||||
tilemap[i] = -1;
|
||||
tilemap[i].tilenum = -1;
|
||||
}
|
||||
|
||||
corpsetile = NUMMONS + NUM_INVIS_TILES + CORPSE;
|
||||
swallowbase = NUMMONS + NUM_INVIS_TILES + NUM_OBJECTS + S_sw_tl;
|
||||
corpsetile = NUMMONS + NUMMONS + NUM_INVIS_TILES + CORPSE;
|
||||
swallowbase = NUMMONS + NUMMONS + NUM_INVIS_TILES + NUM_OBJECTS + S_sw_tl;
|
||||
|
||||
/* add number compiled out */
|
||||
for (i = 0; conditionals[i].sequence; i++) {
|
||||
for (i = 0; conditionals[i].sequence != TERMINATOR; i++) {
|
||||
switch (conditionals[i].sequence) {
|
||||
case MON_GLYPH:
|
||||
corpsetile++;
|
||||
swallowbase++;
|
||||
corpsetile += 2;
|
||||
swallowbase += 2;
|
||||
break;
|
||||
case OBJ_GLYPH:
|
||||
if (conditionals[i].predecessor < CORPSE)
|
||||
@@ -313,116 +332,238 @@ init_tilemap()
|
||||
}
|
||||
}
|
||||
|
||||
condnum = tilenum = 0;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
tilemap_file = fopen("tilemappings.lst", "w");
|
||||
#endif
|
||||
tilenum = 0;
|
||||
for (i = 0; i < NUMMONS; i++) {
|
||||
tilemap[GLYPH_MON_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_PET_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_DETECT_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_RIDDEN_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_BODY_OFF + i] = corpsetile;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
char buf[256];
|
||||
#endif
|
||||
tilemap[GLYPH_MON_OFF + i].tilenum = tilenum;
|
||||
tilemap[GLYPH_PET_OFF + i].tilenum = tilenum;
|
||||
tilemap[GLYPH_DETECT_OFF + i].tilenum = tilenum;
|
||||
tilemap[GLYPH_RIDDEN_OFF + i].tilenum = tilenum;
|
||||
tilemap[GLYPH_BODY_OFF + i].tilenum = corpsetile;
|
||||
j = GLYPH_SWALLOW_OFF + 8 * i;
|
||||
tilemap[j] = swallowbase;
|
||||
tilemap[j + 1] = swallowbase + 1;
|
||||
tilemap[j + 2] = swallowbase + 2;
|
||||
tilemap[j + 3] = swallowbase + 3;
|
||||
tilemap[j + 4] = swallowbase + 4;
|
||||
tilemap[j + 5] = swallowbase + 5;
|
||||
tilemap[j + 6] = swallowbase + 6;
|
||||
tilemap[j + 7] = swallowbase + 7;
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == MON_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
condnum++;
|
||||
tilenum++;
|
||||
tilemap[j].tilenum = swallowbase;
|
||||
tilemap[j + 1].tilenum = swallowbase + 1;
|
||||
tilemap[j + 2].tilenum = swallowbase + 2;
|
||||
tilemap[j + 3].tilenum = swallowbase + 3;
|
||||
tilemap[j + 4].tilenum = swallowbase + 4;
|
||||
tilemap[j + 5].tilenum = swallowbase + 5;
|
||||
tilemap[j + 6].tilenum = swallowbase + 6;
|
||||
tilemap[j + 7].tilenum = swallowbase + 7;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(buf, "%s (%d)", tilename(MON_GLYPH, file_entry, 0), file_entry);
|
||||
Sprintf(tilemap[GLYPH_MON_OFF + i].name,
|
||||
"%s (%d)", buf, i);
|
||||
Sprintf(tilemap[GLYPH_PET_OFF + i].name,
|
||||
"%s %s (%d)", buf, "pet", i);
|
||||
Sprintf(tilemap[GLYPH_DETECT_OFF + i].name,
|
||||
"%s %s (%d)", buf, "detected", i);
|
||||
Sprintf(tilemap[GLYPH_RIDDEN_OFF + i].name,
|
||||
"%s %s (%d)", buf, "ridden", i);
|
||||
Sprintf(tilemap[GLYPH_BODY_OFF + i].name,
|
||||
"%s %s (%d)", buf, "corpse", i);
|
||||
Sprintf(tilemap[j + 0].name, "%s swallow0 (%d)", buf, i);
|
||||
Sprintf(tilemap[j + 1].name, "%s swallow1 (%d)", buf, i);
|
||||
Sprintf(tilemap[j + 2].name, "%s swallow2 (%d)", buf, i);
|
||||
Sprintf(tilemap[j + 3].name, "%s swallow3 (%d)", buf, i);
|
||||
Sprintf(tilemap[j + 4].name, "%s swallow4 (%d)", buf, i);
|
||||
Sprintf(tilemap[j + 5].name, "%s swallow5 (%d)", buf, i);
|
||||
Sprintf(tilemap[j + 6].name, "%s swallow6 (%d)", buf, i);
|
||||
Sprintf(tilemap[j + 7].name, "%s swallow7 (%d)", buf, i);
|
||||
#endif
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) {
|
||||
if (conditionals[condnum].sequence == MON_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
tilenum += 2;
|
||||
file_entry += 2;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Fprintf(tilemap_file, "skipping monst %s (%d)\n",
|
||||
tilename(MON_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
tilenum += 2; /* male + female tiles for each */
|
||||
file_entry += 2;
|
||||
}
|
||||
tilemap[GLYPH_INVISIBLE] = tilenum++;
|
||||
tilemap[GLYPH_INVISIBLE].tilenum = tilenum++;
|
||||
file_entry++;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_INVISIBLE].name,
|
||||
"%s (%d)", "invisible mon", file_entry);
|
||||
#endif
|
||||
lastmontile = tilenum - 1;
|
||||
|
||||
file_entry = 0;
|
||||
for (i = 0; i < NUM_OBJECTS; i++) {
|
||||
tilemap[GLYPH_OBJ_OFF + i] = tilenum;
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == OBJ_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
condnum++;
|
||||
tilenum++;
|
||||
tilemap[GLYPH_OBJ_OFF + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_OBJ_OFF + i].name, "%s (%d)",
|
||||
tilename(OBJ_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) {
|
||||
if (conditionals[condnum].sequence == OBJ_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Fprintf(tilemap_file, "skipping obj %s (%d)\n",
|
||||
tilename(OBJ_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
}
|
||||
lastobjtile = tilenum - 1;
|
||||
|
||||
file_entry = 0;
|
||||
for (i = 0; i < (MAXPCHARS - MAXEXPCHARS); i++) {
|
||||
tilemap[GLYPH_CMAP_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_CMAP_OFF + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_CMAP_OFF + i].name, "cmap %s (%d)",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == OTH_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
condnum++;
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) {
|
||||
if (conditionals[condnum].sequence == OTH_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Fprintf(tilemap_file, "skipping cmap %s (%d)\n",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < (MAXEXPCHARS * EXPL_MAX); i++) {
|
||||
tilemap[GLYPH_EXPLODE_OFF + i] = tilenum;
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == OTH_GLYPH
|
||||
&& conditionals[condnum].predecessor == (i + MAXPCHARS)) {
|
||||
condnum++;
|
||||
tilenum++;
|
||||
tilemap[GLYPH_EXPLODE_OFF + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_EXPLODE_OFF + i].name, "explosion %s (%d)",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) {
|
||||
if (conditionals[condnum].sequence == OTH_GLYPH
|
||||
&& conditionals[condnum].predecessor == i + MAXPCHARS) {
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Fprintf(tilemap_file, "skipping explosion %s (%d)\n",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_ZAP << 2; i++) {
|
||||
tilemap[GLYPH_ZAP_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_ZAP_OFF + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_ZAP_OFF + i].name, "zap %s (%d)",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == OTH_GLYPH
|
||||
file_entry++;
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) {
|
||||
if (conditionals[condnum].sequence == OTH_GLYPH
|
||||
&& conditionals[condnum].predecessor == (i + MAXEXPCHARS)) {
|
||||
condnum++;
|
||||
tilenum++;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Fprintf(tilemap_file, "skipping zap %s (%d)\n",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
file_entry++;
|
||||
tilenum++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < WARNCOUNT; i++) {
|
||||
tilemap[GLYPH_WARNING_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_WARNING_OFF + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_WARNING_OFF + i].name, "%s (%d)",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
}
|
||||
|
||||
for (i = 0; i < 1; i++) {
|
||||
tilemap[GLYPH_UNEXPLORED_OFF + i] = tilenum;
|
||||
tilemap[GLYPH_UNEXPLORED_OFF + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_UNEXPLORED_OFF + i].name, "unexplored %s (%d)",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
}
|
||||
|
||||
for (i = 0; i < 1; i++) {
|
||||
tilemap[GLYPH_NOTHING + i] = tilenum;
|
||||
tilemap[GLYPH_NOTHING + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_NOTHING + i].name, " nothing %s (%d)",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
tilenum++;
|
||||
file_entry++;
|
||||
}
|
||||
|
||||
#ifndef STATUES_LOOK_LIKE_MONSTERS
|
||||
/* statue patch: statues still use the same glyph as in vanilla */
|
||||
|
||||
for (i = 0; i < NUMMONS; i++) {
|
||||
tilemap[GLYPH_STATUE_OFF + i] = tilemap[GLYPH_OBJ_OFF + STATUE];
|
||||
tilemap[GLYPH_STATUE_OFF + i].tilenum = tilemap[GLYPH_OBJ_OFF + STATUE];
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_STATUE_OFF + i].name, "%s (%d)",
|
||||
tilename(OTH_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
lastothtile = tilenum - 1;
|
||||
|
||||
#ifdef STATUES_LOOK_LIKE_MONSTERS
|
||||
/* skip over the substitutes to get to the grayscale statues */
|
||||
file_entry = 0;
|
||||
/* fast-forward over the substitutes to grayscale statues loc */
|
||||
for (i = 0; i < SIZE(substitutes); i++) {
|
||||
tilenum += substitutes[i].last_glyph - substitutes[i].first_glyph + 1;
|
||||
}
|
||||
|
||||
/* statue patch: statues look more like the monster */
|
||||
condnum = 0; /* doing monsters again, so reset */
|
||||
for (i = 0; i < NUMMONS; i++) {
|
||||
tilemap[GLYPH_STATUE_OFF + i] = tilenum;
|
||||
tilenum++;
|
||||
while (conditionals[condnum].sequence == MON_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
condnum++;
|
||||
tilenum++;
|
||||
tilemap[GLYPH_STATUE_OFF + i].tilenum = tilenum;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Sprintf(tilemap[GLYPH_STATUE_OFF + i].name, "statue of %s (%d)",
|
||||
tilename(MON_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
for (condnum = 0; conditionals[condnum].sequence != -1; condnum++) {
|
||||
if (conditionals[condnum].sequence == MON_GLYPH
|
||||
&& conditionals[condnum].predecessor == i) {
|
||||
file_entry += 2; /* skip female tile too */
|
||||
tilenum += 2;
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
Fprintf(tilemap_file, "skipping statue of %s (%d)\n",
|
||||
tilename(MON_GLYPH, file_entry, 0), file_entry);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
tilenum += 2;
|
||||
file_entry += 2;
|
||||
}
|
||||
laststatuetile = tilenum - 1;
|
||||
laststatuetile = tilenum - 2;
|
||||
#endif /* STATUES_LOOK_LIKE_MONSTERS */
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
for (i = 0; i < MAX_GLYPH; ++i) {
|
||||
Fprintf(tilemap_file, "[%04d] [%04d] %-80s\n",
|
||||
i, tilemap[i].tilenum, tilemap[i].name);
|
||||
}
|
||||
fclose(tilemap_file);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -451,8 +592,8 @@ FILE *ofp;
|
||||
Fprintf(ofp, "short std_tiles%d[] = { ", span);
|
||||
for (k = substitutes[i].first_glyph;
|
||||
k < substitutes[i].last_glyph; k++)
|
||||
Fprintf(ofp, "%d, ", tilemap[k]);
|
||||
Fprintf(ofp, "%d };\n", tilemap[substitutes[i].last_glyph]);
|
||||
Fprintf(ofp, "%d, ", tilemap[k].tilenum);
|
||||
Fprintf(ofp, "%d };\n", tilemap[substitutes[i].last_glyph].tilenum);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -503,6 +644,11 @@ FILE *ofp;
|
||||
Fprintf(ofp, "\nint total_tiles_used = %d;\n", start);
|
||||
}
|
||||
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
extern void NDECL(monst_globals_init);
|
||||
extern void NDECL(objects_globals_init);
|
||||
#endif
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
@@ -510,6 +656,11 @@ main()
|
||||
char filename[30];
|
||||
FILE *ofp;
|
||||
|
||||
#ifdef OBTAIN_TILEMAP
|
||||
objects_globals_init();
|
||||
monst_globals_init();
|
||||
#endif
|
||||
|
||||
init_tilemap();
|
||||
|
||||
/*
|
||||
@@ -526,7 +677,7 @@ main()
|
||||
Fprintf(ofp, "\nshort glyph2tile[MAX_GLYPH] = {\n");
|
||||
|
||||
for (i = 0; i < MAX_GLYPH; i++) {
|
||||
Fprintf(ofp, " %4d,", tilemap[i]);
|
||||
Fprintf(ofp, " %4d,", tilemap[i].tilenum);
|
||||
if ((i % 12) == 11 || i == MAX_GLYPH - 1)
|
||||
Fprintf(ofp, "\n");
|
||||
}
|
||||
@@ -654,17 +805,20 @@ struct {
|
||||
};
|
||||
|
||||
boolean
|
||||
acceptable_tilename(idx, encountered, expected)
|
||||
int idx;
|
||||
acceptable_tilename(glyph_set, idx, encountered, expected)
|
||||
int glyph_set, idx;
|
||||
const char *encountered, *expected;
|
||||
{
|
||||
if (idx >= 0 && idx < SIZE(altlabels)) {
|
||||
if (!strcmp(altlabels[idx].expectedlabel, expected)) {
|
||||
if (!strcmp(altlabels[idx].betterlabel, encountered))
|
||||
return TRUE;
|
||||
if (glyph_set == OTH_GLYPH) {
|
||||
if (idx >= 0 && idx < SIZE(altlabels)) {
|
||||
if (!strcmp(altlabels[idx].expectedlabel, expected)) {
|
||||
if (!strcmp(altlabels[idx].betterlabel, encountered))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*tilemap.c*/
|
||||
|
||||
+40
-25
@@ -26,13 +26,15 @@ static const char *text_sets[] = { "monsters.txt", "objects.txt",
|
||||
"other.txt" };
|
||||
#endif
|
||||
|
||||
extern const char *FDECL(tilename, (int, int));
|
||||
extern boolean FDECL(acceptable_tilename, (int, const char *, const char *));
|
||||
extern const char *FDECL(tilename, (int, int, int));
|
||||
extern boolean FDECL(acceptable_tilename, (int, int, const char *, const char *));
|
||||
static void FDECL(read_text_colormap, (FILE *));
|
||||
static boolean FDECL(write_text_colormap, (FILE *));
|
||||
static boolean FDECL(read_txttile, (FILE *, pixel (*)[TILE_X]));
|
||||
static void FDECL(write_txttile, (FILE *, pixel (*)[TILE_X]));
|
||||
|
||||
enum { MONSTER_SET, OBJECT_SET, OTHER_SET};
|
||||
|
||||
/* Ugh. DICE doesn't like %[A-Z], so we have to spell it out... */
|
||||
#define FORMAT_STRING \
|
||||
"%[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.] = " \
|
||||
@@ -108,29 +110,37 @@ read_txttile(txtfile, pixels)
|
||||
FILE *txtfile;
|
||||
pixel (*pixels)[TILE_X];
|
||||
{
|
||||
int ph, i, j, k;
|
||||
char buf[BUFSZ], ttype[BUFSZ];
|
||||
int ph, i, j, k, reslt;
|
||||
char buf[BUFSZ], ttype[BUFSZ], gend[BUFSZ];
|
||||
const char *p;
|
||||
char c[2];
|
||||
static int gidx = 0;
|
||||
|
||||
if (fscanf(txtfile, "# %s %d (%[^)])", ttype, &i, buf) <= 0)
|
||||
gend[0] = '\0';
|
||||
if (tile_set == MONSTER_SET)
|
||||
reslt = fscanf(txtfile, "# %s %d (%[^,],%[^)])", ttype, &i, buf, gend);
|
||||
else
|
||||
reslt = fscanf(txtfile, "# %s %d (%[^)])", ttype, &i, buf);
|
||||
if (reslt <= 0)
|
||||
return FALSE;
|
||||
|
||||
if (tile_set == MONSTER_SET && gend[0] == 'f')
|
||||
gidx = 1;
|
||||
|
||||
ph = strcmp(ttype, "placeholder") == 0;
|
||||
|
||||
if (!ph && strcmp(ttype, "tile") != 0)
|
||||
Fprintf(stderr, "Keyword \"%s\" unexpected for entry %d\n", ttype, i);
|
||||
|
||||
if (tile_set != 0) {
|
||||
/* check tile name, but not relative number, which will
|
||||
* change when tiles are added
|
||||
*/
|
||||
p = tilename(tile_set, tile_set_indx);
|
||||
if (p && strcmp(p, buf) && !acceptable_tilename(tile_set_indx,buf,p)) {
|
||||
Fprintf(stderr, "warning: for tile %d (numbered %d) of %s,\n",
|
||||
tile_set_indx, i, text_sets[tile_set - 1]);
|
||||
Fprintf(stderr, "\tfound '%s' while expecting '%s'\n", buf, p);
|
||||
}
|
||||
/* check tile name, but not relative number, which will
|
||||
* change when tiles are added
|
||||
*/
|
||||
p = tilename(tile_set, tile_set_indx, gidx);
|
||||
if (p && strcmp(p, buf)
|
||||
&& !acceptable_tilename(tile_set, tile_set_indx, buf, p)) {
|
||||
Fprintf(stderr, "warning: for tile %d (numbered %d) of %s,\n",
|
||||
tile_set_indx, i, text_sets[tile_set]);
|
||||
Fprintf(stderr, "\tfound '%s' while expecting '%s'\n", buf, p);
|
||||
}
|
||||
tile_set_indx++;
|
||||
|
||||
@@ -196,21 +206,26 @@ pixel (*pixels)[TILE_X];
|
||||
{
|
||||
const char *p;
|
||||
const char *type;
|
||||
int i, j, k;
|
||||
int i = 0, j, k;
|
||||
|
||||
if (memcmp(placeholder, pixels, sizeof(placeholder)) == 0)
|
||||
type = "placeholder";
|
||||
else
|
||||
type = "tile";
|
||||
|
||||
if (tile_set == 0)
|
||||
Fprintf(txtfile, "# %s %d (unknown)\n", type, tile_set_indx);
|
||||
else {
|
||||
p = tilename(tile_set, tile_set_indx);
|
||||
if (p)
|
||||
Fprintf(txtfile, "# %s %d (%s)\n", type, tile_set_indx, p);
|
||||
else
|
||||
Fprintf(txtfile, "# %s %d (null)\n", type, tile_set_indx);
|
||||
if (tile_set == MONSTER_SET) {
|
||||
for (i = 0; i < 2; ++i) {
|
||||
Fprintf(txtfile, "# %s %d (unknown,%s)\n", type, tile_set_indx,
|
||||
i ? "female" : "male");
|
||||
if (i == 0)
|
||||
tile_set_indx++;
|
||||
}
|
||||
} else {
|
||||
p = tilename(tile_set, tile_set_indx, i);
|
||||
if (p)
|
||||
Fprintf(txtfile, "# %s %d (%s)\n", type, tile_set_indx, p);
|
||||
else
|
||||
Fprintf(txtfile, "# %s %d (null)\n", type, tile_set_indx);
|
||||
}
|
||||
tile_set_indx++;
|
||||
|
||||
@@ -302,7 +317,7 @@ const char *type;
|
||||
tile_set = 0;
|
||||
for (i = 0; i < SIZE(text_sets); i++) {
|
||||
if (!strcmp(p, text_sets[i]))
|
||||
tile_set = i + 1;
|
||||
tile_set = i;
|
||||
}
|
||||
tile_set_indx = 0;
|
||||
|
||||
|
||||
+2
-2
@@ -129,7 +129,7 @@ VDECLCB(shim_mark_synch,(void), "v")
|
||||
VDECLCB(shim_wait_synch,(void), "v")
|
||||
VDECLCB(shim_cliparound,(int x, int y), "vii", A2P x, A2P y)
|
||||
VDECLCB(shim_update_positionbar,(char *posbar), "vp", P2V posbar)
|
||||
VDECLCB(shim_print_glyph,(winid w, int x, int y, int glyph, int bkglyph), "viiiii", A2P w, A2P x, A2P y, A2P glyph, A2P bkglyph)
|
||||
VDECLCB(shim_print_glyph,(winid w, int x, int y, int glyph, int bkglyph, int glyphmod[NUM_GLYPHMOD]), "viiiii", A2P w, A2P x, A2P y, A2P glyph, A2P bkglyph, A2P glyphmod)
|
||||
VDECLCB(shim_raw_print,(const char *str), "vs", P2V str)
|
||||
VDECLCB(shim_raw_print_bold,(const char *str), "vs", P2V str)
|
||||
DECLCB(int, shim_nhgetch,(void), "i")
|
||||
@@ -311,4 +311,4 @@ EM_JS(void, local_callback, (const char *cb_name, const char *shim_name, void *r
|
||||
})
|
||||
#endif /* __EMSCRIPTEN__ */
|
||||
|
||||
#endif /* SHIM_GRAPHICS */
|
||||
#endif /* SHIM_GRAPHICS */
|
||||
|
||||
+7
-5
@@ -3415,15 +3415,15 @@ int x, y;
|
||||
*/
|
||||
|
||||
void
|
||||
tty_print_glyph(window, x, y, glyph, bkglyph)
|
||||
tty_print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
winid window;
|
||||
xchar x, y;
|
||||
int glyph;
|
||||
int bkglyph UNUSED;
|
||||
unsigned *glyphmod; /* don't mark UNUSED as we need to revisit */
|
||||
{
|
||||
int ch;
|
||||
boolean inverse_on = FALSE;
|
||||
int color;
|
||||
int ch, color;
|
||||
unsigned special;
|
||||
|
||||
HUPSKIP();
|
||||
@@ -3433,8 +3433,10 @@ int bkglyph UNUSED;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* map glyph to character and color */
|
||||
(void) mapglyph(glyph, &ch, &color, &special, x, y, 0);
|
||||
/* get glyph ttychar, color, and special flags */
|
||||
ch = (int) glyphmod[GM_TTYCHAR];
|
||||
color = (int) glyphmod[GM_COLOR];
|
||||
special = glyphmod[GM_FLAGS];
|
||||
|
||||
print_vt_code2(AVTC_SELECT_WINDOW, window);
|
||||
|
||||
|
||||
+48
-27
@@ -37,8 +37,8 @@ typedef struct mswin_nethack_map_window {
|
||||
|
||||
int map[COLNO][ROWNO]; /* glyph map */
|
||||
int bkmap[COLNO][ROWNO]; /* backround glyph map */
|
||||
unsigned glyphmod[COLNO][ROWNO][NUM_GLYPHMOD];
|
||||
boolean mapDirty[COLNO][ROWNO]; /* dirty flag for map */
|
||||
|
||||
int mapMode; /* current map mode */
|
||||
boolean bAsciiMode; /* switch ASCII/tiled mode */
|
||||
boolean bFitToScreenMode; /* switch Fit map to screen mode on/off */
|
||||
@@ -86,7 +86,7 @@ static void nhcoord2display(PNHMapWindow data, int x, int y, LPRECT lpOut);
|
||||
static void paint(PNHMapWindow data, int i, int j);
|
||||
static void dirtyAll(PNHMapWindow data);
|
||||
static void dirty(PNHMapWindow data, int i, int j);
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg);
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg, unsigned *glyphmod);
|
||||
static void clearAll(PNHMapWindow data);
|
||||
|
||||
#if (VERSION_MAJOR < 4) && (VERSION_MINOR < 4) && (PATCHLEVEL < 2)
|
||||
@@ -639,7 +639,7 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
case MSNH_MSG_PRINT_GLYPH: {
|
||||
PMSNHMsgPrintGlyph msg_data = (PMSNHMsgPrintGlyph) lParam;
|
||||
setGlyph(data, msg_data->x, msg_data->y,
|
||||
msg_data->glyph, msg_data->bkglyph);
|
||||
msg_data->glyph, msg_data->bkglyph, msg_data->glyphmod);
|
||||
} break;
|
||||
|
||||
case MSNH_MSG_CLIPAROUND: {
|
||||
@@ -708,8 +708,10 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
PMSNHMsgGetText msg_data = (PMSNHMsgGetText) lParam;
|
||||
size_t index;
|
||||
int col, row;
|
||||
#if 0
|
||||
int color;
|
||||
unsigned special;
|
||||
unsigned special = 0U;
|
||||
#endif
|
||||
int mgch;
|
||||
|
||||
index = 0;
|
||||
@@ -717,13 +719,14 @@ onMSNHCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
|
||||
for (col = 0; col < COLNO; col++) {
|
||||
if (index >= msg_data->max_size)
|
||||
break;
|
||||
if (data->map[col][row] == NO_GLYPH) {
|
||||
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] = 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++;
|
||||
}
|
||||
if (index >= msg_data->max_size - 1)
|
||||
@@ -785,9 +788,9 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
int glyph, bkglyph;
|
||||
int layer;
|
||||
#ifdef USE_PILEMARK
|
||||
int color;
|
||||
unsigned special;
|
||||
int mgch;
|
||||
// int color;
|
||||
// unsigned special = 0U;
|
||||
// int mgch;
|
||||
#endif
|
||||
layer = 0;
|
||||
glyph = data->map[i][j];
|
||||
@@ -811,8 +814,16 @@ 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];
|
||||
if (data->glyphmod[i][j][GM_FLAGS] & MG_FEMALE)
|
||||
ntile++;
|
||||
t_x = TILEBMP_X(ntile);
|
||||
t_y = TILEBMP_Y(ntile);
|
||||
|
||||
@@ -834,9 +845,9 @@ 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) && (special & MG_PET)
|
||||
// (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)
|
||||
#endif
|
||||
@@ -859,7 +870,7 @@ paintTile(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
DeleteDC(hdcPetMark);
|
||||
}
|
||||
#ifdef USE_PILEMARK
|
||||
if ((glyph != NO_GLYPH) && (special & MG_OBJPILE)
|
||||
if ((glyph != NO_GLYPH) && (data->glyphmod[i][j][GM_FLAGS] & MG_OBJPILE)
|
||||
&& iflags.hilite_pile) {
|
||||
/* apply pilemark transparently over other image */
|
||||
HDC hdcPileMark;
|
||||
@@ -893,8 +904,8 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
char ch;
|
||||
WCHAR wch;
|
||||
int color;
|
||||
unsigned special;
|
||||
int mgch;
|
||||
// unsigned special;
|
||||
// int mgch;
|
||||
HBRUSH back_brush;
|
||||
COLORREF OldFg;
|
||||
|
||||
@@ -909,11 +920,12 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
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) mgch;
|
||||
if (((special & MG_PET) && iflags.hilite_pet)
|
||||
|| ((special & (MG_DETECT | MG_BW_LAVA))
|
||||
// (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)
|
||||
|| ((data->glyphmod[i][j][GM_FLAGS] & (MG_DETECT | MG_BW_LAVA))
|
||||
&& iflags.use_inverse)) {
|
||||
back_brush =
|
||||
CreateSolidBrush(nhcolor_to_RGB(CLR_GRAY));
|
||||
@@ -972,13 +984,19 @@ paintGlyph(PNHMapWindow data, int i, int j, RECT * rect)
|
||||
}
|
||||
}
|
||||
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg)
|
||||
static void setGlyph(PNHMapWindow data, int i, int j, int fg, int bg, unsigned *glyphmod)
|
||||
{
|
||||
if ((data->map[i][j] != fg) || (data->bkmap[i][j] != bg)) {
|
||||
int gm;
|
||||
|
||||
if ((data->map[i][j] != fg) || (data->bkmap[i][j] != bg)
|
||||
|| data->glyphmod[i][j][GM_TTYCHAR] != glyphmod[GM_TTYCHAR]
|
||||
|| data->glyphmod[i][j][GM_COLOR] != glyphmod[GM_COLOR]
|
||||
|| data->glyphmod[i][j][GM_FLAGS] != glyphmod[GM_FLAGS]) {
|
||||
data->map[i][j] = fg;
|
||||
data->bkmap[i][j] = bg;
|
||||
data->mapDirty[i][j] = TRUE;
|
||||
|
||||
for (gm = 0; gm < NUM_GLYPHMOD; ++gm)
|
||||
data->glyphmod[i][j][gm] = glyphmod[gm];
|
||||
RECT rect;
|
||||
nhcoord2display(data, i, j, &rect);
|
||||
InvalidateRect(data->hWnd, &rect, FALSE);
|
||||
@@ -991,6 +1009,9 @@ static void clearAll(PNHMapWindow data)
|
||||
for (int y = 0; y < ROWNO; y++) {
|
||||
data->map[x][y] = NO_GLYPH;
|
||||
data->bkmap[x][y] = NO_GLYPH;
|
||||
data->glyphmod[x][y][GM_TTYCHAR] = ' ';
|
||||
data->glyphmod[x][y][GM_COLOR] = NO_COLOR;
|
||||
data->glyphmod[x][y][GM_FLAGS] = 0U;
|
||||
data->mapDirty[x][y] = TRUE;
|
||||
}
|
||||
InvalidateRect(data->hWnd, NULL, FALSE);
|
||||
|
||||
@@ -38,6 +38,7 @@ typedef struct mswin_nhmsg_print_glyph {
|
||||
XCHAR_P y;
|
||||
int glyph;
|
||||
int bkglyph;
|
||||
int glyphmod[NUM_GLYPHMOD];
|
||||
} MSNHMsgPrintGlyph, *PMSNHMsgPrintGlyph;
|
||||
|
||||
typedef struct mswin_nhmsg_cliparound {
|
||||
|
||||
+9
-3
@@ -1281,7 +1281,7 @@ mswin_cliparound(int x, int y)
|
||||
}
|
||||
|
||||
/*
|
||||
print_glyph(window, x, y, glyph, bkglyph)
|
||||
print_glyph(window, x, y, glyph, bkglyph, glyphmod)
|
||||
-- Print the glyph at (x,y) on the given window. Glyphs are
|
||||
integers at the interface, mapped to whatever the window-
|
||||
port wants (symbol, font, color, attributes, ...there's
|
||||
@@ -1290,12 +1290,15 @@ print_glyph(window, x, y, glyph, bkglyph)
|
||||
graphical or tiled environments to allow the depiction
|
||||
to fall against a background consistent with the grid
|
||||
around x,y.
|
||||
-- glyphmod provides extended information about the glyph
|
||||
that window ports can use to enhance the display in
|
||||
various ways.
|
||||
|
||||
*/
|
||||
void
|
||||
mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph)
|
||||
mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph, unsigned *glyphmod)
|
||||
{
|
||||
logDebug("mswin_print_glyph(%d, %d, %d, %d, %d)\n", wid, x, y, glyph, bkglyph);
|
||||
logDebug("mswin_print_glyph(%d, %d, %d, %d, %d, %lu)\n", wid, x, y, glyph, bkglyph, glyphmod);
|
||||
|
||||
if ((wid >= 0) && (wid < MAXWINDOWS)
|
||||
&& (GetNHApp()->windowlist[wid].win != NULL)) {
|
||||
@@ -1306,6 +1309,9 @@ mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph)
|
||||
data.y = y;
|
||||
data.glyph = glyph;
|
||||
data.bkglyph = bkglyph;
|
||||
data.glyphmod[GM_TTYCHAR] = glyphmod[GM_TTYCHAR];
|
||||
data.glyphmod[GM_COLOR] = glyphmod[GM_COLOR];
|
||||
data.glyphmod[GM_FLAGS] = glyphmod[GM_FLAGS];
|
||||
SendMessage(GetNHApp()->windowlist[wid].win, WM_MSNH_COMMAND,
|
||||
(WPARAM) MSNH_MSG_PRINT_GLYPH, (LPARAM) &data);
|
||||
}
|
||||
|
||||
+1
-1
@@ -162,7 +162,7 @@ void mswin_update_inventory(void);
|
||||
void mswin_mark_synch(void);
|
||||
void mswin_wait_synch(void);
|
||||
void mswin_cliparound(int x, int y);
|
||||
void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph);
|
||||
void mswin_print_glyph(winid wid, XCHAR_P x, XCHAR_P y, int glyph, int bkglyph, unsigned *glyphmod);
|
||||
void mswin_raw_print(const char *str);
|
||||
void mswin_raw_print_bold(const char *str);
|
||||
void mswin_raw_print_flush();
|
||||
|
||||
Reference in New Issue
Block a user