miscellaneous objects[] macros
Replace FIRST_GEM and LAST_GEM with FIRST_REAL_GEM, LAST_REAL_GEM, FIRST_GLASS_GEM, and LAST_GLASS_GEM and define those along with objects[] rather than separately. Do the latter for FIRST_AMULET and LAST_AMULET too. Also new FIRST_SPELL and LAST_SPELL used to compute MAXSPELLS. (That value looks wrong to me, but this defines it with the same value as before. If it gets fixed, EDITLEVEL will need to be incremented.) This started as just proof of concept that extra information could be collected as objects[] gets initialized at compile time.
This commit is contained in:
@@ -529,11 +529,6 @@ struct entity {
|
||||
int ex, ey;
|
||||
};
|
||||
|
||||
/* these probably ought to be generated by makedefs, like LAST_GEM */
|
||||
#define FIRST_GEM DILITHIUM_CRYSTAL
|
||||
#define FIRST_AMULET AMULET_OF_ESP
|
||||
#define LAST_AMULET AMULET_OF_YENDOR
|
||||
|
||||
struct valuable_data {
|
||||
long count;
|
||||
int typ;
|
||||
@@ -651,7 +646,7 @@ struct repo { /* repossession context */
|
||||
|
||||
#define NUM_ROLES (13)
|
||||
struct role_filter {
|
||||
boolean roles[NUM_ROLES+1];
|
||||
boolean roles[NUM_ROLES + 1];
|
||||
short mask;
|
||||
};
|
||||
|
||||
@@ -977,7 +972,8 @@ struct instance_globals_g {
|
||||
const char *gate_str;
|
||||
|
||||
/* end.c */
|
||||
struct valuable_data gems[LAST_GEM + 1 - FIRST_GEM + 1]; /* +1 for glass */
|
||||
/* 1st +1: subtracting first from last, 2nd +1: one slot for all glass */
|
||||
struct valuable_data gems[LAST_REAL_GEM + 1 - FIRST_REAL_GEM + 1];
|
||||
|
||||
/* invent.c */
|
||||
long glyph_reset_timestamp;
|
||||
|
||||
@@ -171,9 +171,11 @@ enum objects_nums {
|
||||
};
|
||||
|
||||
enum misc_object_nums {
|
||||
LAST_GEM = (JADE),
|
||||
NUM_GLASS_GEMS = ((LUCKSTONE - JADE) - 1),
|
||||
MAXSPELL = ((SPE_BOOK_OF_THE_DEAD - SCR_BLANK_PAPER) + 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),
|
||||
};
|
||||
|
||||
extern NEARDATA struct objclass objects[NUM_OBJECTS + 1];
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#define OBJ(name,desc) name, desc
|
||||
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
||||
cost,sdam,ldam,oc1,oc2,nut,color,sn) { obj }
|
||||
#define MARKER(tag,sn) /*empty*/
|
||||
|
||||
#elif defined(OBJECTS_INIT)
|
||||
#define COLOR_FIELD(X) X,
|
||||
@@ -45,18 +46,21 @@
|
||||
cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
||||
{ 0, 0, (char *) 0, bits, prp, sym, dly, COLOR_FIELD(color) prob, wt, \
|
||||
cost, sdam, ldam, oc1, oc2, nut }
|
||||
#define MARKER(tag,sn) /*empty*/
|
||||
|
||||
#elif defined(OBJECTS_ENUM)
|
||||
#define OBJ(name,desc)
|
||||
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
||||
cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
||||
sn
|
||||
#define MARKER(tag,sn) tag = sn,
|
||||
|
||||
#elif defined(DUMP_ENUMS)
|
||||
#define OBJ(name,desc)
|
||||
#define OBJECT(obj,bits,prp,sym,prob,dly,wt, \
|
||||
cost,sdam,ldam,oc1,oc2,nut,color,sn) \
|
||||
{ sn, #sn }
|
||||
#define MARKER(tag,sn) { tag, #sn },
|
||||
|
||||
#else
|
||||
#error Unproductive inclusion of objects.h
|
||||
@@ -767,6 +771,7 @@ RING("protection from shape changers", "shiny",
|
||||
power, AMULET_CLASS, prob, 0, 20, 150, 0, 0, 0, 0, 20, HI_METAL, sn)
|
||||
AMULET("amulet of ESP", "circular", TELEPAT, 120,
|
||||
AMULET_OF_ESP),
|
||||
MARKER(FIRST_AMULET, AMULET_OF_ESP)
|
||||
AMULET("amulet of life saving", "spherical", LIFESAVED, 75,
|
||||
AMULET_OF_LIFE_SAVING),
|
||||
AMULET("amulet of strangulation", "oval", STRANGLED, 115,
|
||||
@@ -804,6 +809,7 @@ OBJECT(OBJ("Amulet of Yendor", /* note: description == name */
|
||||
BITS(0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, MITHRIL),
|
||||
0, AMULET_CLASS, 0, 0, 20, 30000, 0, 0, 0, 0, 20, HI_METAL,
|
||||
AMULET_OF_YENDOR),
|
||||
MARKER(LAST_AMULET, AMULET_OF_YENDOR)
|
||||
#undef AMULET
|
||||
|
||||
/* tools ... */
|
||||
@@ -1204,6 +1210,7 @@ SCROLL("blank paper", "unlabeled", 0, 28, 60, SCR_BLANK_PAPER),
|
||||
#define PAPER LEATHER /* override enum for use in SPELL() expansion */
|
||||
SPELL("dig", "parchment",
|
||||
P_MATTER_SPELL, 20, 6, 5, 1, RAY, HI_LEATHER, SPE_DIG),
|
||||
MARKER(FIRST_SPELL, SPE_DIG)
|
||||
/* magic missile ... finger of death must be in this order; see buzz() */
|
||||
SPELL("magic missile", "vellum",
|
||||
P_ATTACK_SPELL, 45, 2, 2, 1, RAY, HI_LEATHER, SPE_MAGIC_MISSILE),
|
||||
@@ -1329,7 +1336,8 @@ SPELL("freeze sphere", "hardcover",
|
||||
#endif
|
||||
/* books with fixed descriptions
|
||||
*/
|
||||
SPELL("blank paper", "plain", P_NONE, 18, 0, 0, 0, 0, HI_PAPER, SPE_BLANK_PAPER),
|
||||
SPELL("blank paper", "plain", P_NONE, 18, 0, 0, 0, 0, HI_PAPER,
|
||||
SPE_BLANK_PAPER),
|
||||
/* tribute book for 3.6 */
|
||||
OBJECT(OBJ("novel", "paperback"),
|
||||
BITS(0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, P_NONE, PAPER),
|
||||
@@ -1340,6 +1348,10 @@ OBJECT(OBJ("Book of the Dead", "papyrus"),
|
||||
BITS(0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, P_NONE, PAPER),
|
||||
0, SPBOOK_CLASS, 0, 0, 20, 10000, 0, 0, 0, 7, 20, HI_PAPER,
|
||||
SPE_BOOK_OF_THE_DEAD),
|
||||
/* LAST_SPELL is used to compute MAXSPELL and should probably be
|
||||
SPE_BLANK_PAPER-1 since there's no need for spl_book[] slots for
|
||||
blank, novel, and Book of the Dead */
|
||||
MARKER(LAST_SPELL, SPE_BOOK_OF_THE_DEAD)
|
||||
#undef SPELL
|
||||
|
||||
/* wands ... */
|
||||
@@ -1424,6 +1436,7 @@ COIN("gold piece", 1000, GOLD, 1, GOLD_PIECE),
|
||||
0, GEM_CLASS, prob, 0, wt, gval, sdam, ldam, 0, 0, nutr, color, sn)
|
||||
GEM("dilithium crystal", "white", 2, 1, 4500, 15, 5, GEMSTONE, CLR_WHITE,
|
||||
DILITHIUM_CRYSTAL),
|
||||
MARKER(FIRST_REAL_GEM, DILITHIUM_CRYSTAL)
|
||||
GEM("diamond", "white", 3, 1, 4000, 15, 10, GEMSTONE, CLR_WHITE,
|
||||
DIAMOND),
|
||||
GEM("ruby", "red", 4, 1, 3500, 15, 9, GEMSTONE, CLR_RED,
|
||||
@@ -1466,8 +1479,10 @@ GEM("agate", "orange", 12, 1, 200, 15, 6, GEMSTONE, CLR_ORANGE,
|
||||
AGATE),
|
||||
GEM("jade", "green", 10, 1, 300, 15, 6, GEMSTONE, CLR_GREEN,
|
||||
JADE),
|
||||
MARKER(LAST_REAL_GEM, JADE)
|
||||
GEM("worthless piece of white glass", "white",
|
||||
77, 1, 0, 6, 5, GLASS, CLR_WHITE, WORTHLESS_WHITE_GLASS),
|
||||
MARKER(FIRST_GLASS_GEM, WORTHLESS_WHITE_GLASS)
|
||||
GEM("worthless piece of blue glass", "blue",
|
||||
77, 1, 0, 6, 5, GLASS, CLR_BLUE, WORTHLESS_BLUE_GLASS),
|
||||
GEM("worthless piece of red glass", "red",
|
||||
@@ -1484,6 +1499,7 @@ GEM("worthless piece of green glass", "green",
|
||||
77, 1, 0, 6, 5, GLASS, CLR_GREEN, WORTHLESS_GREEN_GLASS),
|
||||
GEM("worthless piece of violet glass", "violet",
|
||||
77, 1, 0, 6, 5, GLASS, CLR_MAGENTA, WORTHLESS_VIOLET_GLASS),
|
||||
MARKER(LAST_GLASS_GEM, WORTHLESS_VIOLET_GLASS)
|
||||
|
||||
/* Placement note: there is a wishable subrange for
|
||||
* "gray stones" in the o_ranges[] array in objnam.c
|
||||
@@ -1548,6 +1564,7 @@ OBJECT(OBJ(NoDes, NoDes),
|
||||
|
||||
#undef OBJ
|
||||
#undef OBJECT
|
||||
#undef MARKER
|
||||
#undef HARDGEM
|
||||
#undef NoDes
|
||||
|
||||
|
||||
Reference in New Issue
Block a user