add a set of decals to stock tileset

win/share/decals.txt contains (initially) a decal_delimiter tile,
a decal_pet tile, and a decal_pile tile.
The latter two can be used for hilite_pet and hilite_pile implementations
that don't have something in place already. The implementation would
just need to apply (merge) the non-background decal pixels over a
regular tile.

The special decal_delimiter tile can be used to confirm the presence
of the delimiter tiles in the tileset and mark the end of the regular tiles,
and the start of the decal tiles.
   row 1 contains the background color whose pixels should be
   ignored when applying a decal to a tile.
   row 2 contains a row of pixels colored (0, 0, 0).
   row 3 contains a row of pixels colored pure green (0, 255, 0).
   row 3 contains a row of pixels colored pure blue  (0, 0, 255).
This commit is contained in:
nhmall
2026-07-29 20:47:50 -04:00
parent 1d3178a199
commit de842ec483
5 changed files with 171 additions and 27 deletions
+4 -2
View File
@@ -27,10 +27,12 @@ all: $(VARDAT) spec_levs quest_levs
x11tiles: ../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
../win/share/other.txt \
../win/share/monsters.txt
../win/share/monsters.txt \
../win/share/decals.txt
../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
../win/share/other.txt \
-grayscale ../win/share/monsters.txt
-grayscale ../win/share/monsters.txt \
../win/share/decals.txt
beostiles: ../util/tile2beos ../win/share/monsters.txt \
../win/share/objects.txt \
+95
View File
@@ -0,0 +1,95 @@
# decals.txt - definitions for 'decals'
# to merge over top of another tile
#
# Note: lines beginning with '# tile ' are not comments; other
# lines beginning with '#' are.
. = (71, 108, 108)
A = (0, 0, 0)
B = (0, 182, 255)
C = (255, 108, 0)
D = (255, 0, 0)
E = (0, 0, 255)
F = (0, 145, 0)
G = (108, 255, 0)
H = (255, 255, 0)
I = (255, 0, 255)
J = (145, 71, 0)
K = (204, 79, 0)
L = (255, 182, 145)
M = (237, 237, 237)
N = (255, 255, 255)
O = (215, 215, 215)
P = (108, 145, 182)
Q = (18, 18, 18)
R = (54, 54, 54)
S = (73, 73, 73)
T = (82, 82, 82)
U = (205,205,205)
V = (104, 104, 104)
W = (131, 131, 131)
X = (140, 140, 140)
Y = (149, 149, 149)
Z = (195, 195, 195)
0 = (100, 100, 100)
1 = (72, 108, 108)
2 = (0, 255, 0)
# tile 0 (decal_delimiter)
{
................
AAAAAAAAAAAAAAAA
2222222222222222
EEEEEEEEEEEEEEEE
................
................
................
................
................
................
................
................
................
................
................
................
}
# decals that can be overlayed
# onto an object tile
#
# tile 1 (decal_pet)
{
............D.D.
...........DDDDD
............DDD.
.............D..
................
................
................
................
................
................
................
................
................
................
................
................
}
# tile 2 (decal_pile)
{
..N.............
..N.............
NNNNN...........
..N.............
..N.N...........
.....N..........
................
................
................
................
................
................
................
................
................
................
}
+6 -8
View File
@@ -114,12 +114,9 @@ static void build_bmptile(pixel(*) [TILE_X]);
#define TILESETS 1
static const char *const relative_tiledir = "../win/share/";
/* monsters must be first because main uses it twice */
const char *const tilefilenames[TILESETS][3] = {
{"monsters.txt", "objects.txt", "other.txt"},
#if 0
{"mon32.txt", "obj32.txt", "oth32.txt"},
{"mon64.txt", "obj64.txt", "oth64.txt"},
#endif
const char *const tilefilenames[TILESETS][5] = {
{ "monsters.txt", "objects.txt", "other.txt",
"monsters.txt", "decals.txt" },
};
int tilecnt[SIZE(tilefilenames[0])];
@@ -191,8 +188,8 @@ main(int argc, char *argv[])
printf("Error creating tile file %s, aborting.\n", bmpname);
exit(EXIT_FAILURE);
}
while (pass < 4) {
filenum = pass % SIZE(tilefilenames[tilefileset]);
filenum = 0;
while (pass < SIZE(tilefilenames[tilefileset])) {
if (!set_tilefile_path(relative_tiledir,
tilefilenames[tilefileset][filenum],
tilefile_full_path, sizeof tilefile_full_path)) {
@@ -248,6 +245,7 @@ main(int argc, char *argv[])
}
(void) fclose_text_file();
++pass;
++filenum;
}
fwrite(newbmp, bmpsize, 1, fp);
fclose(fp);
+61 -12
View File
@@ -101,9 +101,9 @@ const char *zap_texts[] = {
"death", "lightning", "poison gas", "acid",
};
enum tilesrc { monsters_file, objects_file, other_file, generated };
enum tilesrc { monsters_file, objects_file, other_file, generated, decals_file };
const char *tilesrc_texts[] = {
"monsters.txt", "objects.txt", "other.txt", "generated",
"monsters.txt", "objects.txt", "other.txt", "generated", "decals.txt"
};
struct tilemap_t {
@@ -129,7 +129,11 @@ struct tiles_used *tilelist[2500] = { 0 };
int TILE_stone = 0, /* will get set to correct tile later */
TILE_unexplored = 0, /* will get set to correct tile later */
TILE_nothing = 0, /* will get set to correct tile later */
TILE_corr = 0; /* will get set to correct tile later; X11 uses it */
TILE_corr = 0, /* will get set to correct tile later; X11 uses it */
TILE_delimiter = 0, /* reference tile to indicate the two below exist */
TILE_petmark = 0, /* tile to overlay on another tile to mark pet */
TILE_pilemark = 0, /* tile to overlay on another tile to mark piletop */
TILE_very_last_tile = 0;
/* prototypes for functions in this file */
const char *tilename(int, const int, int);
@@ -195,6 +199,7 @@ tilename(int set, const int file_entry, int gend UNUSED)
{
int i, k, cmap, condnum, tilenum;
static char buf[BUFSZ];
boolean decal_flag = FALSE;
#if 0
int offset, gendnum;
#endif
@@ -203,6 +208,10 @@ tilename(int set, const int file_entry, int gend UNUSED)
tilenum = 0;
buf[0] = '\0';
if (set == 3)
set = MON_GLYPH;
else if (set == 4)
decal_flag = TRUE;
if (set == MON_GLYPH) {
for (i = 0; i < NUMMONS; i++) {
if (tilenum == file_entry) {
@@ -530,9 +539,28 @@ tilename(int set, const int file_entry, int gend UNUSED)
}
}
} /* OTH_GLYPH */
if (decal_flag) {
tilenum = 0; /* set-relative number */
for (i = 0; i < 3; i++) {
if (tilenum == file_entry)
switch(i) {
case 0:
return "decal_delimiter";
break;
case 1:
return "decal_pet";
break;
case 2:
return "decal_pile";
break;
}
tilenum++;
}
} /* DECALS */
Sprintf(buf, "unknown %d %d", set, file_entry);
return buf;
return buf;
}
#endif /* TILETEXT || OBTAIN_TILEMAP */
#ifndef TILETEXT
@@ -1282,16 +1310,31 @@ init_tilemap(void)
tilenum++;
file_entry++;
}
laststatuetile = tilenum - 1;
#endif /* STATUES_DONT_LOOK_LIKE_MONSTERS */
/* go beyond NUMMONS to cover off the invisible tile at the
end of monsters.txt so that the tile mapping matches things
in the .bmp file (for example) */
file_entry = 0;
#if defined(OBTAIN_TILEMAP)
add_tileref(tilenum, NO_GLYPH, monsters_file, file_entry,
file_entry = 0;
add_tileref(tilenum, NO_GLYPH, generated, file_entry,
"invisible statue", "");
#endif
laststatuetile = tilenum - 1;
#endif /* STATUES_DONT_LOOK_LIKE_MONSTERS */
tilenum++;
file_entry = 0;
TILE_delimiter = tilenum++; /* Used to init nul_glyphinfo tileidx entry */
TILE_petmark = tilenum++;
TILE_pilemark = tilenum++;
#if defined(OBTAIN_TILEMAP)
add_tileref(TILE_delimiter, NO_GLYPH, decals_file, file_entry++,
"decal_delimiter","");
add_tileref(TILE_petmark, NO_GLYPH, decals_file, file_entry++,
"decal_petmark","");
add_tileref(TILE_pilemark, NO_GLYPH, decals_file, file_entry++,
"decal_pilemark","");
#endif
TILE_very_last_tile = tilenum;
#if defined(OBTAIN_TILEMAP)
for (i = 0; i < MAX_GLYPH; ++i) {
@@ -1347,12 +1390,18 @@ main(int argc, char *argv[])
Fprintf(ofp, "\nenum special_tiles {\n");
Fprintf(ofp, " TILE_CORR = %d,\n", TILE_corr);
Fprintf(ofp, " TILE_STONE = %d,\n", TILE_stone);
Fprintf(ofp, " TILE_UNEXPLORED = %d\n", TILE_unexplored);
Fprintf(ofp, " TILE_UNEXPLORED = %d,\n", TILE_unexplored);
Fprintf(ofp, " TILE_DELIMITER = %d,\n", TILE_delimiter);
Fprintf(ofp, " TILE_PETMARK = %d,\n", TILE_petmark);
Fprintf(ofp, " TILE_PILEMARK = %d\n", TILE_pilemark);
Fprintf(ofp, "};\n");
Fprintf(ofp, "\nint total_tiles_used = %d,\n", laststatuetile + 1);
Fprintf(ofp, "\nint total_tiles_used = %d,\n", TILE_very_last_tile);
Fprintf(ofp, "%sTile_corr = TILE_CORR,\n", indent); /* X11 uses it */
Fprintf(ofp, "%sTile_stone = TILE_STONE,\n", indent);
Fprintf(ofp, "%sTile_unexplored = TILE_UNEXPLORED,\n", indent);
Fprintf(ofp, "%sTile_stone = TILE_STONE,\n", indent);
Fprintf(ofp, "%sTile_unexplored = TILE_UNEXPLORED,\n", indent);
Fprintf(ofp, "%sTile_delimiter = TILE_DELIMITER,\n", indent);
Fprintf(ofp, "%sTile_petmark = TILE_PETMARK,\n", indent);
Fprintf(ofp, "%sTile_pilemark = TILE_PILEMARK,\n", indent);
Fprintf(ofp, "%smaxmontile = %d,\n", indent, lastmontile);
Fprintf(ofp, "%smaxobjtile = %d,\n", indent, lastobjtile);
Fprintf(ofp, "%smaxothtile = %d;\n\n", indent, lastothtile);
+5 -5
View File
@@ -20,9 +20,9 @@ static FILE *tile_file;
static int tile_set, tile_set_indx;
static const char *const text_sets[] = {
#if (TILE_X == 8)
"monthin.txt", "objthin.txt", "oththin.txt"
"monthin.txt", "objthin.txt", "oththin.txt", "monthin.txt", "decthin.txt"
#else
"monsters.txt", "objects.txt", "other.txt"
"monsters.txt", "objects.txt", "other.txt", "monsters.txt", "decals.txt"
#endif
};
@@ -36,7 +36,7 @@ static boolean write_text_colormap(FILE *);
static boolean read_txttile(FILE *, pixel (*)[TILE_X]);
static void write_txttile(FILE *, pixel (*)[TILE_X]);
enum { MONSTER_SET, OBJECT_SET, OTHER_SET};
enum { MONSTER_SET, OBJECT_SET, OTHER_SET, STATUE_SET, DECAL_SET };
/* Ugh. DICE doesn't like %[A-Z], so we have to spell it out... */
#define FORMAT_STRING \
@@ -189,7 +189,7 @@ read_txttile(FILE *txtfile, pixel (*pixels)[TILE_X])
gend[0] = '\0';
reslt = 0;
if (get_next_line(txtfile, FALSE)) {
if (tile_set == MONSTER_SET)
if (tile_set == MONSTER_SET || tile_set == STATUE_SET)
reslt = sscanf(inbuf, "# %255s %d (%255[^,],%255[^)])",
ttype, &i, buf, gend);
else
@@ -202,7 +202,7 @@ read_txttile(FILE *txtfile, pixel (*pixels)[TILE_X])
ttype[sizeof ttype - 1] = '\0';
buf[sizeof buf - 1] = '\0';
if (tile_set == MONSTER_SET && gend[0] == 'f')
if ((tile_set == MONSTER_SET || tile_set == STATUE_SET) && gend[0] == 'f')
gidx = 1;
ph = strcmp(ttype, "placeholder") == 0;