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:
@@ -171,11 +171,12 @@ enum objects_nums {
|
||||
};
|
||||
|
||||
enum misc_object_nums {
|
||||
NUM_POTIONS = (LAST_POTION - FIRST_POTION + 1),
|
||||
NUM_REAL_GEMS = (LAST_REAL_GEM - FIRST_REAL_GEM + 1),
|
||||
NUM_GLASS_GEMS = (LAST_GLASS_GEM - FIRST_GLASS_GEM + 1),
|
||||
/* 1st +1: last-first subtraction; 2nd +1: extra empty spl_book[] slot;
|
||||
currently LAST_SPELL includes blank, novel, and DeadBook so this
|
||||
overallocates when used to define spl_book[] array */
|
||||
MAXSPELL = (LAST_SPELL + 1 - FIRST_SPELL + 1),
|
||||
/* LAST_SPELL is SPE_BLANK_PAPER, guaranteeing that spl_book[] will
|
||||
have at least one unused slot at end to be used as a terminator */
|
||||
MAXSPELL = (LAST_SPELL - FIRST_SPELL + 1),
|
||||
};
|
||||
|
||||
extern NEARDATA struct objclass objects[NUM_OBJECTS + 1];
|
||||
|
||||
Reference in New Issue
Block a user