more symbol stuff (trunk only)
- reduce the number of symbol tables for each graphics
set {PRIMARY, ROGUESET} from three {map, oc, mon}
tables for each of the display symbols, the loadable symbols,
and the rogue symbols, to one continguous table for
each:
showsyms: the current display symbols
l_syms: the loaded, alterable symbols
r_syms: the rogue symbols
- Modify mapglyph so that the index into the symbolt table is
available as a return value (it was a void function), rather than
just the char converted from the glyph.
- That makes it possible for a window port to use the same
index value to extract from another table (perhaps a unicode
table) for a different set of display symbols. The index
is much more useful than trying to convert the character
into another type of symbol, as some contributed patches
have done.
- It is much easier to load a single alternative flat table to
make substitutions, since the corresponding value just
has to get placed into the same index offset in the
alternative table.
This also fixes a bug I found in botl.c, where you could
go to the rogue level, and the bottom line gold symbol
was not being updated with the new character as it should.
The reason was because the gold value had not changed,
only the field symbol used had changed.
This updates multiple ports to place a (void) cast on
the mapglyph call, now that it returns a value, so this
is going to generate a lot of diff e-mails.
This commit is contained in:
@@ -497,7 +497,7 @@ E void FDECL(assign_graphics, (int));
|
||||
E void NDECL(init_r_symbols);
|
||||
#endif
|
||||
E void NDECL(init_symbols);
|
||||
E void NDECL(init_disp_symbols);
|
||||
E void NDECL(init_showsyms);
|
||||
E void NDECL(init_l_symbols);
|
||||
E void FDECL(clear_symsetentry, (int,BOOLEAN_P));
|
||||
#ifdef ASCIIGRAPH
|
||||
@@ -1027,7 +1027,7 @@ E boolean FDECL(usmellmon, (struct permonst *));
|
||||
|
||||
/* ### mapglyph.c ### */
|
||||
|
||||
E void FDECL(mapglyph, (int, int *, int *, unsigned *, int, int));
|
||||
E int FDECL(mapglyph, (int, int *, int *, unsigned *, int, int));
|
||||
|
||||
/* ### mcastu.c ### */
|
||||
|
||||
|
||||
@@ -144,6 +144,14 @@ NEARDATA extern coord bhitpos; /* place where throw or zap hits or stops */
|
||||
#include "rect.h"
|
||||
#include "region.h"
|
||||
|
||||
/* Symbol offsets */
|
||||
#define SYM_OFF_P (0)
|
||||
#define SYM_OFF_O (SYM_OFF_P + MAXPCHARS)
|
||||
#define SYM_OFF_M (SYM_OFF_O + MAXOCLASSES)
|
||||
#define SYM_OFF_W (SYM_OFF_M + MAXMCLASSES)
|
||||
#define SYM_OFF_X (SYM_OFF_W + WARNCOUNT)
|
||||
#define SYM_MAX (SYM_OFF_X + MAXOTHER)
|
||||
|
||||
#ifdef USE_TRAMPOLI /* This doesn't belong here, but we have little choice */
|
||||
#undef NDECL
|
||||
#define NDECL(f) f()
|
||||
|
||||
13
include/rm.h
13
include/rm.h
@@ -227,13 +227,18 @@ struct symparse {
|
||||
unsigned range;
|
||||
#define SYM_CONTROL 1 /* start/finish markers */
|
||||
#define SYM_PCHAR 2 /* index into showsyms */
|
||||
#define SYM_MON 3 /* index into monsyms */
|
||||
#define SYM_OC 4 /* index into oc_syms */
|
||||
#define SYM_OBJ 5 /* index into objects */
|
||||
#define SYM_OC 3 /* index into oc_syms */
|
||||
#define SYM_MON 4 /* index into monsyms */
|
||||
#define SYM_OTH 5 /* misc */
|
||||
int idx;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/* misc symbol definitions */
|
||||
#define SYM_BOULDER 0
|
||||
#define SYM_INVISIBLE 1
|
||||
#define MAXOTHER 2
|
||||
|
||||
/* linked list of symsets and their characteristics */
|
||||
struct symsetentry {
|
||||
struct symsetentry *next; /* next in list */
|
||||
@@ -263,10 +268,10 @@ struct symsetentry {
|
||||
#define H_DEC 2
|
||||
|
||||
extern const struct symdef defsyms[MAXPCHARS]; /* defaults */
|
||||
extern uchar showsyms[MAXPCHARS];
|
||||
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[];
|
||||
|
||||
#define SYMHANDLING(ht) (symset[currentgraphics].handling == (ht))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user