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:
nethack.allison
2006-10-01 19:30:08 +00:00
parent fb8261769a
commit 374e9fbbb4
18 changed files with 294 additions and 282 deletions

View File

@@ -2087,7 +2087,7 @@ if(u.uz.dlevel != x){
else /* AMII, or Rogue level in either version */
{
/* map glyph to character and color */
mapglyph(glyph, &och, &color, &special, x, y);
(void) mapglyph(glyph, &och, &color, &special, x, y);
/* XXX next if should be ifdef REINCARNATION */
ch = (uchar)och;
if( WINVERS_AMIV ){ /* implies Rogue level here */

View File

@@ -588,7 +588,7 @@ void onPaint(HWND hWnd)
OldFg = SetTextColor (hDC, nhcolor_to_RGB(color) );
#else
/* rely on NetHack core helper routine */
mapglyph(data->map[i][j], &mgch, &color,
(void)mapglyph(data->map[i][j], &mgch, &color,
&special, i, j);
ch = (char)mgch;
if (((special & MG_PET) && iflags.hilite_pet) ||
@@ -851,30 +851,30 @@ void nhglyph2charcolor(short g, uchar* ch, int* color)
#endif
if ((offset = (g - GLYPH_WARNING_OFF)) >= 0) { /* a warning flash */
*ch = warnsyms[offset];
*ch = showsyms[offset + SYM_OFF_W];
warn_color(offset);
} else if ((offset = (g - GLYPH_SWALLOW_OFF)) >= 0) { /* swallow */
/* see swallow_to_glyph() in display.c */
*ch = (uchar) showsyms[S_sw_tl + (offset & 0x7)];
*ch = (uchar) showsyms[(S_sw_tl + (offset & 0x7)) + SYM_OFF_P];
mon_color(offset >> 3);
} else if ((offset = (g - GLYPH_ZAP_OFF)) >= 0) { /* zap beam */
/* see zapdir_to_glyph() in display.c */
*ch = showsyms[S_vbeam + (offset & 0x3)];
*ch = showsyms[(S_vbeam + (offset & 0x3)) + SYM_OFF_P];
zap_color((offset >> 2));
} else if ((offset = (g - GLYPH_CMAP_OFF)) >= 0) { /* cmap */
*ch = showsyms[offset];
*ch = showsyms[offset + SYM_OFF_P];
cmap_color(offset);
} else if ((offset = (g - GLYPH_OBJ_OFF)) >= 0) { /* object */
*ch = oc_syms[(int)objects[offset].oc_class];
*ch = showsyms[(int)objects[offset].oc_class + SYM_OFF_O];
obj_color(offset);
} else if ((offset = (g - GLYPH_BODY_OFF)) >= 0) { /* a corpse */
*ch = oc_syms[(int)objects[CORPSE].oc_class];
*ch = showsyms[(int)objects[CORPSE].oc_class + SYM_OFF_O];
mon_color(offset);
} else if ((offset = (g - GLYPH_PET_OFF)) >= 0) { /* a pet */
*ch = monsyms[(int)mons[offset].mlet];
*ch = showsyms[(int)mons[offset].mlet + SYM_OFF_M];
pet_color(offset);
} else { /* a monster */
*ch = monsyms[(int)mons[g].mlet];
*ch = showsyms[(int)mons[g].mlet + SYM_OFF_M];
mon_color(g);
}
// end of wintty code

View File

@@ -230,7 +230,7 @@ void FormatStatusString(char* text, int format)
if(hp < 0) hp = 0;
(void) describe_level(nb=eos(nb));
Sprintf(nb = eos(nb),
"%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", oc_syms[COIN_CLASS],
"%c:%-2ld HP:%d(%d) Pw:%d(%d) AC:%-2d", showsyms[COIN_CLASS + SYM_OFF_O],
#ifndef GOLDOBJ
u.ugold,
#else