start: RogueIBM
Handling: IBM
+ Restrictions: rogue
S_weapon: \x29
S_amulet: \x2c
S_food: \x3a
start: RogueEpyx
Description: Rogue level color symbol set like Epyx Rogue
+ Restrictions: rogue
Handling: IBM
Color: Yes
S_weapon: \x18 # up arrow
finish
start: RogueWindows
+ Restrictions: rogue
Handling: IBM
S_weapon: \x29
S_amulet: \x2c
/* linked list of symsets and their characteristics */
struct symsetentry {
- struct symsetentry *next; /* next in list */
- char *name; /* ptr to symset name */
- char *desc; /* ptr to description */
- int idx; /* an index value */
- int handling; /* known handlers value */
- Bitfield(nocolor,1); /* don't use color if set */
- /* 7 free bits */
+ struct symsetentry *next; /* next in list */
+ char *name; /* ptr to symset name */
+ char *desc; /* ptr to description */
+ int idx; /* an index value */
+ int handling; /* known handlers value */
+ Bitfield(nocolor,1); /* don't use color if set */
+ Bitfield(primary,1); /* restricted for use as primary set */
+ Bitfield(rogue,1); /* restricted for use as rogue lev set */
+ /* 5 free bits */
};
/*
* Graphics sets for display symbols
*/
#define DEFAULT_GRAPHICS 0 /* regular characters: '-', '+', &c */
-#define PRIMARY 0 /* primary graphics */
-#define ROGUESET 1 /* rogue graphics */
+#define PRIMARY 0 /* primary graphics set */
+#define ROGUESET 1 /* rogue graphics set */
#define NUM_GRAPHICS 2
/*
extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
extern const struct symdef def_warnsyms[WARNCOUNT];
-extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */
extern int currentgraphics; /* from drawing.c */
extern uchar showsyms[];
#ifdef LOADSYMSETS
+extern struct symsetentry symset[NUM_GRAPHICS]; /* from drawing.c */
#define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht))
#else
#define SYMHANDLING(ht) ((ht) == H_UNK)
symset[which_set].nocolor = 0;
symset[which_set].handling = H_UNK;
+ symset[which_set].desc = (char *)0;
+ symset[which_set].nocolor = 0;
+ /* initialize restriction bits */
+ symset[which_set].primary = 0;
+ symset[which_set].rogue = 0;
if (name_too) {
if (symset[which_set].name)
(const char *)0,
};
+/*
+ * Accepted keywords for symset restrictions.
+ * These can be virtually anything that you want to
+ * be able to test in the code someplace.
+ * Be sure to:
+ * - add a corresponding Bitfield to the symsetentry struct in rm.h
+ * - initialize the field to zero in parse_sym_line in the SYM_CONTROL
+ * case 0 section of the idx switch. The location is prefaced with
+ * with a comment stating "initialize restriction bits".
+ * - set the value appropriately based on the index of your keyword
+ * under the case 5 sections of the same SYM_CONTROL idx switches.
+ * - add the field to clear_symsetentry()
+ */
+const char *known_restrictions[] = {
+ "primary",
+ "rogue",
+ (const char *)0,
+};
+
struct symparse loadsyms[] = {
{SYM_CONTROL, 0, "start"},
{SYM_CONTROL, 0, "begin"},
{SYM_CONTROL, 3, "description"},
{SYM_CONTROL, 4, "color"},
{SYM_CONTROL, 4, "colour"},
+ {SYM_CONTROL, 5, "restrictions"},
{SYM_PCHAR, S_stone, "S_stone"},
{SYM_PCHAR, S_vwall, "S_vwall"},
{SYM_PCHAR, S_hwall, "S_hwall"},
#endif /*WIZARD*/
#ifdef LOADSYMSETS
-extern struct symsetentry *symset_list; /* options.c */
-extern struct symparse loadsyms[]; /* drawing.c */
-extern const char *known_handling[]; /* drawing.c */
+extern struct symsetentry *symset_list; /* options.c */
+extern struct symparse loadsyms[]; /* drawing.c */
+extern const char *known_handling[]; /* drawing.c */
+extern const char *known_restrictions[]; /* drawing.c */
static int symset_count = 0; /* for pick-list building only */
static boolean chosen_symset_start = FALSE, chosen_symset_end = FALSE;
char *buf;
int which_set;
{
- int val;
+ int i, val;
struct symparse *symp = (struct symparse *)0;
char *bufp, *commentp, *altp;
Strcpy(tmpsp->name, bufp);
tmpsp->desc = (char *)0;
tmpsp->nocolor = 0;
+ /* initialize restriction bits */
+ tmpsp->primary = 0;
+ tmpsp->rogue = 0;
break;
case 3: /* description:something */
tmpsp = symset_list; /* most recent symset */
Strcpy(tmpsp->desc, bufp);
}
break;
+ case 5:
+ /* restrictions: xxxx*/
+ tmpsp = symset_list; /* most recent symset */
+ i = 0;
+ while (known_restrictions[i]) {
+ if (!strcmpi(known_restrictions[i], bufp)) {
+ switch(i) {
+ case 0: tmpsp->primary = 1; break;
+ case 1: tmpsp->rogue = 1; break;
+ }
+ break; /* while loop */
+ }
+ i++;
+ }
+ break;
}
}
return 1;
if (!strcmpi(bufp, symset[which_set].name)) {
/* matches desired one */
chosen_symset_start = TRUE;
+ /* these init_*() functions clear symset fields too */
# ifdef REINCARNATION
if (which_set == ROGUESET) init_r_symbols();
# endif
}
}
break;
+ case 5: /* restrictions: xxxx*/
+ i = 0;
+ while (known_restrictions[i]) {
+ if (!strcmpi(known_restrictions[i], bufp)) {
+ switch(i) {
+ case 0: symset[which_set].primary = 1;
+ break;
+ case 1: symset[which_set].rogue = 1;
+ break;
+ }
+ break; /* while loop */
+ }
+ i++;
+ }
+ break;
}
} else { /* !SYM_CONTROL */
val = sym_val(bufp);
} else if (!strcmp("symset", optname) ||
!strcmp("roguesymset", optname)) {
menu_item *symset_pick = (menu_item *)0;
- boolean rogueflag = (*optname == 'r');
+ boolean primaryflag = (*optname == 's'),
+ rogueflag = (*optname == 'r'),
+ ready_to_switch = FALSE,
+ nothing_to_do = FALSE;
#ifdef LOADSYMSETS
int res;
char *symset_name, fmtstr[20];
struct symsetentry *sl;
+ int setcount = 0;
#endif
int chosen = -2, which_set =
#ifdef REINCARNATION
if (res && symset_list) {
char symsetchoice[BUFSZ];
int let = 'a', biggest = 0, thissize = 0;
- tmpwin = create_nhwindow(NHW_MENU);
- start_menu(tmpwin);
- any.a_int = 1;
- add_menu(tmpwin, NO_GLYPH, &any, let++, 0,
- ATR_NONE, "Default Symbols", MENU_UNSELECTED);
sl = symset_list;
while (sl) {
+ /* check restrictions */
+ if ((!rogueflag && sl->rogue) ||
+ (!primaryflag && sl->primary)) {
+ sl = sl->next;
+ continue;
+ }
+ setcount++;
/* find biggest name */
if (sl->name) thissize = strlen(sl->name);
if (thissize > biggest) biggest = thissize;
sl = sl->next;
}
+ if (!setcount) {
+ pline("There are no appropriate %ssymbol sets available.",
+ (rogueflag) ? "rogue level " :
+ (primaryflag) ? "primary " :
+ "");
+ return TRUE;
+ }
+
Sprintf(fmtstr,"%%-%ds %%s", biggest + 5);
-
+ tmpwin = create_nhwindow(NHW_MENU);
+ start_menu(tmpwin);
+ any.a_int = 1;
+ add_menu(tmpwin, NO_GLYPH, &any, let++, 0,
+ ATR_NONE, "Default Symbols", MENU_UNSELECTED);
+
sl = symset_list;
while (sl) {
+ /* check restrictions */
+ if ((!rogueflag && sl->rogue) ||
+ (!primaryflag && sl->primary)) {
+ sl = sl->next;
+ continue;
+ }
if (sl->name) {
any.a_int = sl->idx + 2;
Sprintf(symsetchoice, fmtstr, sl->name,