displaying generic objects

Add 17 fake objects to objects[], one for each object class.  All
specific color as gray.  They're grouped at the start--actually near
the start since "strange object" is still objects[0]--rather than
being among the objects for each class.  init_object() knows to start
at [MAXOCLASSES] instead of [0]; other code that loops through every
object might need adjusting.

For potions, non-stone gems, and non-novel/non-Book_of_the_Dead
spellbooks that don't have obj->dknown set, display the corresponding
generic object rather the object itself.  Fixes the longstanding bug
of seeing color for not-yet-seen objects whose primary distinguishing
characteristic is their color.  Walking next to a generic object
while able to see its spot will set dknown and redraw as specific.
It's slightly disconcerting to have objects change as you reach them;
I hope it's just a matter of becoming used to that.  (If there is any
code still changing the hero's location manually instead of using
u_on_newpos(), it should be changed to use that routine.)

Most of the new tiles are just a big rendering of punctuation
characters.  The potion, gem, and spellbook ones could be cloned from
a specific object in their class and then have the color removed.  I
started out that way but wasn't happy with the result.  I'm not
artisticly inclined; hopefully someone else will do better.  Each of
them is preceded by a comment beginning with "#_"; the underscore
isn't required, just being used to make the comments stand out a bit.

Invalidates existing save and bones files.
This commit is contained in:
PatR
2023-01-10 14:33:21 -08:00
parent 3f3c581f65
commit 85c908cb03
13 changed files with 994 additions and 529 deletions

View File

@@ -1058,6 +1058,9 @@ dump_enums(void)
static const struct enum_dump omdump[] = {
dump_om(FIRST_AMULET),
dump_om(LAST_AMULET),
dump_om(FIRST_POTION),
dump_om(LAST_POTION),
dump_om(NUM_POTIONS),
dump_om(FIRST_SPELL),
dump_om(LAST_SPELL),
dump_om(MAXSPELL),
@@ -1065,7 +1068,9 @@ dump_enums(void)
dump_om(LAST_REAL_GEM),
dump_om(FIRST_GLASS_GEM),
dump_om(LAST_GLASS_GEM),
dump_om(NUM_REAL_GEMS),
dump_om(NUM_GLASS_GEMS),
dump_om(MAX_GLYPH),
};
#undef dump_om
static const struct enum_dump *const ed[NUM_ENUM_DUMPS] = {
@@ -1075,16 +1080,16 @@ dump_enums(void)
static int szd[NUM_ENUM_DUMPS] = {
SIZE(monsdump), SIZE(objdump), SIZE(omdump)
};
int i, j;
const char *nmprefix;
int i, j, nmwidth;
for (i = 0; i < NUM_ENUM_DUMPS; ++ i) {
raw_printf("enum %s = {", titles[i]);
for (j = 0; j < szd[i]; ++j) {
raw_printf(" %s%s = %i%s",
(j == szd[i] - 1) ? "" : pfx[i],
ed[i][j].nm,
ed[i][j].val,
(j == szd[i] - 1) ? "" : ",");
nmprefix = (j == szd[i] - 1) ? "" : pfx[i]; /* "" or "PM_" */
nmwidth = 27 - (int) strlen(nmprefix); /* 27 or 24 */
raw_printf(" %s%*s = %3d,",
nmprefix, -nmwidth, ed[i][j].nm, ed[i][j].val);
}
raw_print("};");
raw_print("");