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
+5 -1
View File
@@ -1426,7 +1426,7 @@ void
u_on_newpos(coordxy x, coordxy y)
{
if (!isok(x, y)) { /* validate location */
void (*func)(const char *, ...);
void (*func)(const char *, ...) PRINTF_F_PTR(1, 2);
func = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic
: impossible;
@@ -1445,6 +1445,10 @@ u_on_newpos(coordxy x, coordxy y)
stale values from previous level */
if (!on_level(&u.uz, &u.uz0))
u.ux0 = u.ux, u.uy0 = u.uy;
else if (!Blind && !Hallucination)
/* still on same level; might have come close enough to
generic object(s) to redisplay them as specific objects */
see_nearby_objects();
}
/* place you on a random location when arriving on a level */