Source:NetHack 3.6.0/src/drawing.c

From NetHackWiki
(Redirected from Source:Drawing.c)
Jump to: navigation, search

Below is the full text to drawing.c from the source code of NetHack 3.6.0. To link to a particular line, write [[Source:NetHack 3.6.0/src/drawing.c#line123]], for example.

The NetHack General Public License applies to screenshots, source code and other content from NetHack.

This content was modified from the original NetHack source code distribution (by splitting up NetHack content between wiki pages, and possibly further editing). See the page history for a list of who changed it, and on what dates.

Top of file

  1.  /* NetHack 3.6	drawing.c	$NHDT-Date: 1447124657 2015/11/10 03:04:17 $  $NHDT-Branch: master $:$NHDT-Revision: 1.49 $ */
  2.  /* Copyright (c) NetHack Development Team 1992.                   */
  3.  /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5.  #include "hack.h"
  6.  #include "tcap.h"
  7.  
  8.  /* Relevant header information in rm.h, objclass.h, and monsym.h. */
  9.  
  10.  #ifdef C
  11.  #undef C
  12.  #endif
  13.  
  14.  #ifdef TEXTCOLOR
  15.  #define C(n) n
  16.  #else
  17.  #define C(n)
  18.  #endif
  19.  
  20.  struct symsetentry symset[NUM_GRAPHICS];
  21.  
  22.  int currentgraphics = 0;
  23.  
  24.  nhsym showsyms[SYM_MAX] = DUMMY; /* symbols to be displayed */
  25.  nhsym l_syms[SYM_MAX] = DUMMY;   /* loaded symbols          */
  26.  nhsym r_syms[SYM_MAX] = DUMMY;   /* rogue symbols           */
  27.  
  28.  nhsym warnsyms[WARNCOUNT] = DUMMY; /* the current warning display symbols */
  29.  const char invisexplain[] = "remembered, unseen, creature";
  30.  

Object class symbols

  1.  /* Default object class symbols.  See objclass.h.
  2.   * {symbol, name, explain}
  3.   *     name:    used in object_detect().
  4.   *     explain: used in do_look().
  5.   */
  6.  const struct class_sym def_oc_syms[MAXOCLASSES] = {
  7.      { '\0', "", "" }, /* placeholder for the "random class" */
  8.      { ILLOBJ_SYM, "illegal objects", "strange object" },
  9.      { WEAPON_SYM, "weapons", "weapon" },
  10.      { ARMOR_SYM, "armor", "suit or piece of armor" },
  11.      { RING_SYM, "rings", "ring" },
  12.      { AMULET_SYM, "amulets", "amulet" },
  13.      { TOOL_SYM, "tools", "useful item (pick-axe, key, lamp...)" },
  14.      { FOOD_SYM, "food", "piece of food" },
  15.      { POTION_SYM, "potions", "potion" },
  16.      { SCROLL_SYM, "scrolls", "scroll" },
  17.      { SPBOOK_SYM, "spellbooks", "spellbook" },
  18.      { WAND_SYM, "wands", "wand" },
  19.      { GOLD_SYM, "coins", "pile of coins" },
  20.      { GEM_SYM, "rocks", "gem or rock" },
  21.      { ROCK_SYM, "large stones", "boulder or statue" },
  22.      { BALL_SYM, "iron balls", "iron ball" },
  23.      { CHAIN_SYM, "chains", "iron chain" },
  24.      { VENOM_SYM, "venoms", "splash of venom" }
  25.  };
  26.  

Monster class symbols

  1.  /* Default monster class symbols.  See monsym.h. */
  2.  const struct class_sym def_monsyms[MAXMCLASSES] = {
  3.      { '\0', "", "" },
  4.      { DEF_ANT, "", "ant or other insect" },
  5.      { DEF_BLOB, "", "blob" },
  6.      { DEF_COCKATRICE, "", "cockatrice" },
  7.      { DEF_DOG, "", "dog or other canine" },
  8.      { DEF_EYE, "", "eye or sphere" },
  9.      { DEF_FELINE, "", "cat or other feline" },
  10.      { DEF_GREMLIN, "", "gremlin" },
  11.      { DEF_HUMANOID, "", "humanoid" },
  12.      { DEF_IMP, "", "imp or minor demon" },
  13.      { DEF_JELLY, "", "jelly" },
  14.      { DEF_KOBOLD, "", "kobold" },
  15.      { DEF_LEPRECHAUN, "", "leprechaun" },
  16.      { DEF_MIMIC, "", "mimic" },
  17.      { DEF_NYMPH, "", "nymph" },
  18.      { DEF_ORC, "", "orc" },
  19.      { DEF_PIERCER, "", "piercer" },
  20.      { DEF_QUADRUPED, "", "quadruped" },
  21.      { DEF_RODENT, "", "rodent" },
  22.      { DEF_SPIDER, "", "arachnid or centipede" },
  23.      { DEF_TRAPPER, "", "trapper or lurker above" },
  24.      { DEF_UNICORN, "", "unicorn or horse" },
  25.      { DEF_VORTEX, "", "vortex" },
  26.      { DEF_WORM, "", "worm" },
  27.      { DEF_XAN, "", "xan or other mythical/fantastic insect" },
  28.      { DEF_LIGHT, "", "light" },
  29.      { DEF_ZRUTY, "", "zruty" },
  30.      { DEF_ANGEL, "", "angelic being" },
  31.      { DEF_BAT, "", "bat or bird" },
  32.      { DEF_CENTAUR, "", "centaur" },
  33.      { DEF_DRAGON, "", "dragon" },
  34.      { DEF_ELEMENTAL, "", "elemental" },
  35.      { DEF_FUNGUS, "", "fungus or mold" },
  36.      { DEF_GNOME, "", "gnome" },
  37.      { DEF_GIANT, "", "giant humanoid" },
  38.      { '\0', "", "invisible monster" },
  39.      { DEF_JABBERWOCK, "", "jabberwock" },
  40.      { DEF_KOP, "", "Keystone Kop" },
  41.      { DEF_LICH, "", "lich" },
  42.      { DEF_MUMMY, "", "mummy" },
  43.      { DEF_NAGA, "", "naga" },
  44.      { DEF_OGRE, "", "ogre" },
  45.      { DEF_PUDDING, "", "pudding or ooze" },
  46.      { DEF_QUANTMECH, "", "quantum mechanic" },
  47.      { DEF_RUSTMONST, "", "rust monster or disenchanter" },
  48.      { DEF_SNAKE, "", "snake" },
  49.      { DEF_TROLL, "", "troll" },
  50.      { DEF_UMBER, "", "umber hulk" },
  51.      { DEF_VAMPIRE, "", "vampire" },
  52.      { DEF_WRAITH, "", "wraith" },
  53.      { DEF_XORN, "", "xorn" },
  54.      { DEF_YETI, "", "apelike creature" },
  55.      { DEF_ZOMBIE, "", "zombie" },
  56.      { DEF_HUMAN, "", "human or elf" },
  57.      { DEF_GHOST, "", "ghost" },
  58.      { DEF_GOLEM, "", "golem" },
  59.      { DEF_DEMON, "", "major demon" },
  60.      { DEF_EEL, "", "sea monster" },
  61.      { DEF_LIZARD, "", "lizard" },
  62.      { DEF_WORM_TAIL, "", "long worm tail" },
  63.      { DEF_MIMIC_DEF, "", "mimic" },
  64.  };
  65.  

Warning symbols

  1.  const struct symdef def_warnsyms[WARNCOUNT] = {
  2.      /* white warning  */
  3.      { '0', "unknown creature causing you worry",    C(CLR_WHITE) },
  4.      /* pink warning   */
  5.      { '1', "unknown creature causing you concern",  C(CLR_RED) },
  6.      /* red warning    */
  7.      { '2', "unknown creature causing you anxiety",  C(CLR_RED) },
  8.      /* ruby warning   */
  9.      { '3', "unknown creature causing you disquiet", C(CLR_RED) },
  10.      /* purple warning */
  11.      { '4', "unknown creature causing you alarm",    C(CLR_MAGENTA) },
  12.      /* black warning  */
  13.      { '5', "unknown creature causing you dread",    C(CLR_BRIGHT_MAGENTA) },
  14.  };
  15.  

Screen symbols

  1.  /*
  2.   *  Default screen symbols with explanations and colors.
  3.   */
  4.  const struct symdef defsyms[MAXPCHARS] = {
  5.  /* 0*/ { ' ', "dark part of a room", C(NO_COLOR) },  /* stone */
  6.         { '|', "wall", C(CLR_GRAY) },                 /* vwall */
  7.         { '-', "wall", C(CLR_GRAY) },                 /* hwall */
  8.         { '-', "wall", C(CLR_GRAY) },                 /* tlcorn */
  9.         { '-', "wall", C(CLR_GRAY) },                 /* trcorn */
  10.         { '-', "wall", C(CLR_GRAY) },                 /* blcorn */
  11.         { '-', "wall", C(CLR_GRAY) },                 /* brcorn */
  12.         { '-', "wall", C(CLR_GRAY) },                 /* crwall */
  13.         { '-', "wall", C(CLR_GRAY) },                 /* tuwall */
  14.         { '-', "wall", C(CLR_GRAY) },                 /* tdwall */
  15.  /*10*/ { '|', "wall", C(CLR_GRAY) },                 /* tlwall */
  16.         { '|', "wall", C(CLR_GRAY) },                 /* trwall */
  17.         { '.', "doorway", C(CLR_GRAY) },              /* ndoor */
  18.         { '-', "open door", C(CLR_BROWN) },           /* vodoor */
  19.         { '|', "open door", C(CLR_BROWN) },           /* hodoor */
  20.         { '+', "closed door", C(CLR_BROWN) },         /* vcdoor */
  21.         { '+', "closed door", C(CLR_BROWN) },         /* hcdoor */
  22.         { '#', "iron bars", C(HI_METAL) },            /* bars */
  23.         { '#', "tree", C(CLR_GREEN) },                /* tree */
  24.         { '.', "floor of a room", C(CLR_GRAY) },      /* room */
  25.  /*20*/ { '.', "dark part of a room", C(CLR_BLACK) }, /* dark room */
  26.         { '#', "corridor", C(CLR_GRAY) },             /* dark corr */
  27.         { '#', "lit corridor", C(CLR_GRAY) },   /* lit corr (see mapglyph.c) */
  28.         { '<', "staircase up", C(CLR_GRAY) },         /* upstair */
  29.         { '>', "staircase down", C(CLR_GRAY) },       /* dnstair */
  30.         { '<', "ladder up", C(CLR_BROWN) },           /* upladder */
  31.         { '>', "ladder down", C(CLR_BROWN) },         /* dnladder */
  32.         { '_', "altar", C(CLR_GRAY) },                /* altar */
  33.         { '|', "grave", C(CLR_GRAY) },                /* grave */
  34.         { '\\', "opulent throne", C(HI_GOLD) },       /* throne */
  35.  /*30*/ { '#', "sink", C(CLR_GRAY) },                 /* sink */
  36.         { '{', "fountain", C(CLR_BLUE) },             /* fountain */
  37.         { '}', "water", C(CLR_BLUE) },                /* pool */
  38.         { '.', "ice", C(CLR_CYAN) },                  /* ice */
  39.         { '}', "molten lava", C(CLR_RED) },           /* lava */
  40.         { '.', "lowered drawbridge", C(CLR_BROWN) },  /* vodbridge */
  41.         { '.', "lowered drawbridge", C(CLR_BROWN) },  /* hodbridge */
  42.         { '#', "raised drawbridge", C(CLR_BROWN) },   /* vcdbridge */
  43.         { '#', "raised drawbridge", C(CLR_BROWN) },   /* hcdbridge */
  44.         { ' ', "air", C(CLR_CYAN) },                  /* open air */
  45.  /*40*/ { '#', "cloud", C(CLR_GRAY) },                /* [part of] a cloud */
  46.         { '}', "water", C(CLR_BLUE) },                /* under water */
  47.         { '^', "arrow trap", C(HI_METAL) },           /* trap */
  48.         { '^', "dart trap", C(HI_METAL) },            /* trap */
  49.         { '^', "falling rock trap", C(CLR_GRAY) },    /* trap */
  50.         { '^', "squeaky board", C(CLR_BROWN) },       /* trap */
  51.         { '^', "bear trap", C(HI_METAL) },            /* trap */
  52.         { '^', "land mine", C(CLR_RED) },             /* trap */
  53.         { '^', "rolling boulder trap", C(CLR_GRAY) }, /* trap */
  54.         { '^', "sleeping gas trap", C(HI_ZAP) },      /* trap */
  55.  /*50*/ { '^', "rust trap", C(CLR_BLUE) },            /* trap */
  56.         { '^', "fire trap", C(CLR_ORANGE) },          /* trap */
  57.         { '^', "pit", C(CLR_BLACK) },                 /* trap */
  58.         { '^', "spiked pit", C(CLR_BLACK) },          /* trap */
  59.         { '^', "hole", C(CLR_BROWN) },                /* trap */
  60.         { '^', "trap door", C(CLR_BROWN) },           /* trap */
  61.         { '^', "teleportation trap", C(CLR_MAGENTA) },  /* trap */
  62.         { '^', "level teleporter", C(CLR_MAGENTA) },    /* trap */
  63.         { '^', "magic portal", C(CLR_BRIGHT_MAGENTA) }, /* trap */
  64.         { '"', "web", C(CLR_GRAY) },                    /* web */
  65.  /*60*/ { '^', "statue trap", C(CLR_GRAY) },            /* trap */
  66.         { '^', "magic trap", C(HI_ZAP) },               /* trap */
  67.         { '^', "anti-magic field", C(HI_ZAP) },         /* trap */
  68.         { '^', "polymorph trap", C(CLR_BRIGHT_GREEN) }, /* trap */
  69.         { '^', "vibrating square", C(CLR_YELLOW) },     /* trap */
  70.         { '|', "wall", C(CLR_GRAY) },            /* vbeam */
  71.         { '-', "wall", C(CLR_GRAY) },            /* hbeam */
  72.         { '\\', "wall", C(CLR_GRAY) },           /* lslant */
  73.         { '/', "wall", C(CLR_GRAY) },            /* rslant */
  74.         { '*', "", C(CLR_WHITE) },               /* dig beam */
  75.         { '!', "", C(CLR_WHITE) },               /* camera flash beam */
  76.         { ')', "", C(HI_WOOD) },                 /* boomerang open left */
  77.  /*70*/ { '(', "", C(HI_WOOD) },                 /* boomerang open right */
  78.         { '0', "", C(HI_ZAP) },                  /* 4 magic shield symbols */
  79.         { '#', "", C(HI_ZAP) },
  80.         { '@', "", C(HI_ZAP) },
  81.         { '*', "", C(HI_ZAP) },
  82.         { '#', "poison cloud", C(CLR_BRIGHT_GREEN) },   /* part of a cloud */
  83.         { '?', "valid position", C(CLR_BRIGHT_GREEN) }, /*  target position */
  84.         { '/', "", C(CLR_GREEN) },         /* swallow top left      */
  85.         { '-', "", C(CLR_GREEN) },         /* swallow top center    */
  86.         { '\\', "", C(CLR_GREEN) },        /* swallow top right     */
  87.  /*80*/ { '|', "", C(CLR_GREEN) },         /* swallow middle left   */
  88.         { '|', "", C(CLR_GREEN) },         /* swallow middle right  */
  89.         { '\\', "", C(CLR_GREEN) },        /* swallow bottom left   */
  90.         { '-', "", C(CLR_GREEN) },         /* swallow bottom center */
  91.         { '/', "", C(CLR_GREEN) },         /* swallow bottom right  */
  92.         { '/', "", C(CLR_ORANGE) },        /* explosion top left     */
  93.         { '-', "", C(CLR_ORANGE) },        /* explosion top center   */
  94.         { '\\', "", C(CLR_ORANGE) },       /* explosion top right    */
  95.         { '|', "", C(CLR_ORANGE) },        /* explosion middle left  */
  96.         { ' ', "", C(CLR_ORANGE) },        /* explosion middle center*/
  97.  /*90*/ { '|', "", C(CLR_ORANGE) },        /* explosion middle right */
  98.         { '\\', "", C(CLR_ORANGE) },       /* explosion bottom left  */
  99.         { '-', "", C(CLR_ORANGE) },        /* explosion bottom center*/
  100.         { '/', "", C(CLR_ORANGE) },        /* explosion bottom right */
  101.  };
  102.  

Rogue level symbols

  1.  /* default rogue level symbols */
  2.  static const uchar def_r_oc_syms[MAXOCLASSES] = {
  3.  /* 0*/ '\0', ILLOBJ_SYM, WEAPON_SYM, ']', /* armor */
  4.         RING_SYM,
  5.  /* 5*/ ',',                     /* amulet */
  6.         TOOL_SYM, ':',           /* food */
  7.         POTION_SYM, SCROLL_SYM,
  8.  /*10*/ SPBOOK_SYM, WAND_SYM,
  9.         GEM_SYM,                /* gold -- yes it's the same as gems */
  10.         GEM_SYM, ROCK_SYM,
  11.  /*15*/ BALL_SYM, CHAIN_SYM, VENOM_SYM
  12.  };
  13.  
  14.  #undef C
  15.  
  16.  #ifdef TERMLIB
  17.  void NDECL((*decgraphics_mode_callback)) = 0; /* set in tty_start_screen() */
  18.  #endif /* TERMLIB */
  19.  
  20.  #ifdef PC9800
  21.  void NDECL((*ibmgraphics_mode_callback)) = 0; /* set in tty_start_screen() */
  22.  void NDECL((*ascgraphics_mode_callback)) = 0; /* set in tty_start_screen() */
  23.  #endif
  24.  

Symbol class derivation functions

def_char_to_objclass

  1.  /*
  2.   * Convert the given character to an object class.  If the character is not
  3.   * recognized, then MAXOCLASSES is returned.  Used in detect.c, invent.c,
  4.   * objnam.c, options.c, pickup.c, sp_lev.c, lev_main.c, and tilemap.c.
  5.   */
  6.  int
  7.  def_char_to_objclass(ch)
  8.  char ch;
  9.  {
  10.      int i;
  11.      for (i = 1; i < MAXOCLASSES; i++)
  12.          if (ch == def_oc_syms[i].sym)
  13.              break;
  14.      return i;
  15.  }
  16.  

def_char_to_monclass

  1.  /*
  2.   * Convert a character into a monster class.  This returns the _first_
  3.   * match made.  If there are are no matches, return MAXMCLASSES.
  4.   * Used in detect.c, options.c, read.c, sp_lev.c, and lev_main.c
  5.   */
  6.  int
  7.  def_char_to_monclass(ch)
  8.  char ch;
  9.  {
  10.      int i;
  11.      for (i = 1; i < MAXMCLASSES; i++)
  12.          if (ch == def_monsyms[i].sym)
  13.              break;
  14.      return i;
  15.  }
  16.  

Symset display functions

  1.  /*
  2.   * Explanations of the functions found below:
  3.   *
  4.   * init_symbols()
  5.   *                     Sets the current display symbols, the
  6.   *                     loadable symbols to the default NetHack
  7.   *                     symbols, including the r_syms rogue level
  8.   *                     symbols. This would typically be done
  9.   *                     immediately after execution begins. Any
  10.   *                     previously loaded external symbol sets are
  11.   *                     discarded.
  12.   *
  13.   * switch_symbols(arg)
  14.   *                     Called to swap in new current display symbols
  15.   *                     (showsyms) from either the default symbols,
  16.   *                     or from the loaded symbols.
  17.   *
  18.   *                     If (arg == 0) then showsyms are taken from
  19.   *                     defsyms, def_oc_syms, and def_monsyms.
  20.   *
  21.   *                     If (arg != 0), which is the normal expected
  22.   *                     usage, then showsyms are taken from the
  23.   *                     adjustable display symbols found in l_syms.
  24.   *                     l_syms may have been loaded from an external
  25.   *                     symbol file by config file options or interactively
  26.   *                     in the Options menu.
  27.   *
  28.   * assign_graphics(arg)
  29.   *
  30.   *                     This is used in the game core to toggle in and
  31.   *                     out of other {rogue} level display modes.
  32.   *
  33.   *                     If arg is ROGUESET, this places the rogue level
  34.   *                     symbols from r_syms into showsyms.
  35.   *
  36.   *                     If arg is PRIMARY, this places the symbols
  37.   *                     from l_monsyms into showsyms.
  38.   *
  39.   * update_l_symset()
  40.   *                     Update a member of the loadable (l_*) symbol set.
  41.   *
  42.   * update_r_symset()
  43.   *                     Update a member of the rogue (r_*) symbol set.
  44.   *
  45.   */
  46.  

init_symbols

  1.  void
  2.  init_symbols()
  3.  {
  4.      init_l_symbols();
  5.      init_showsyms();
  6.      init_r_symbols();
  7.  }
  8.  

update_bouldersym

  1.  void
  2.  update_bouldersym()
  3.  {
  4.      showsyms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym;
  5.      l_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym;
  6.      r_syms[SYM_BOULDER + SYM_OFF_X] = iflags.bouldersym;
  7.  }
  8.  

init_showsyms

  1.  void
  2.  init_showsyms()
  3.  {
  4.      register int i;
  5.  
  6.      for (i = 0; i < MAXPCHARS; i++)
  7.          showsyms[i + SYM_OFF_P] = defsyms[i].sym;
  8.      for (i = 0; i < MAXOCLASSES; i++)
  9.          showsyms[i + SYM_OFF_O] = def_oc_syms[i].sym;
  10.      for (i = 0; i < MAXMCLASSES; i++)
  11.          showsyms[i + SYM_OFF_M] = def_monsyms[i].sym;
  12.      for (i = 0; i < WARNCOUNT; i++)
  13.          showsyms[i + SYM_OFF_W] = def_warnsyms[i].sym;
  14.      for (i = 0; i < MAXOTHER; i++) {
  15.          if (i == SYM_BOULDER)
  16.              showsyms[i + SYM_OFF_X] = iflags.bouldersym
  17.                                          ? iflags.bouldersym
  18.                                          : def_oc_syms[ROCK_CLASS].sym;
  19.          else if (i == SYM_INVISIBLE)
  20.              showsyms[i + SYM_OFF_X] = DEF_INVISIBLE;
  21.      }
  22.  }
  23.  

init_l_symbols

  1.  /* initialize defaults for the loadable symset */
  2.  void
  3.  init_l_symbols()
  4.  {
  5.      register int i;
  6.  
  7.      for (i = 0; i < MAXPCHARS; i++)
  8.          l_syms[i + SYM_OFF_P] = defsyms[i].sym;
  9.      for (i = 0; i < MAXOCLASSES; i++)
  10.          l_syms[i + SYM_OFF_O] = def_oc_syms[i].sym;
  11.      for (i = 0; i < MAXMCLASSES; i++)
  12.          l_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
  13.      for (i = 0; i < WARNCOUNT; i++)
  14.          l_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
  15.      for (i = 0; i < MAXOTHER; i++) {
  16.          if (i == SYM_BOULDER)
  17.              l_syms[i + SYM_OFF_X] = iflags.bouldersym
  18.                                        ? iflags.bouldersym
  19.                                        : def_oc_syms[ROCK_CLASS].sym;
  20.          else if (i == SYM_INVISIBLE)
  21.              l_syms[i + SYM_OFF_X] = DEF_INVISIBLE;
  22.      }
  23.  
  24.      clear_symsetentry(PRIMARY, FALSE);
  25.  }
  26.  

init_r_symbols

  1.  void
  2.  init_r_symbols()
  3.  {
  4.      register int i;
  5.  
  6.      /* These are defaults that can get overwritten
  7.         later by the roguesymbols option */
  8.  
  9.      for (i = 0; i < MAXPCHARS; i++)
  10.          r_syms[i + SYM_OFF_P] = defsyms[i].sym;
  11.      r_syms[S_vodoor] = r_syms[S_hodoor] = r_syms[S_ndoor] = '+';
  12.      r_syms[S_upstair] = r_syms[S_dnstair] = '%';
  13.  
  14.      for (i = 0; i < MAXOCLASSES; i++)
  15.          r_syms[i + SYM_OFF_O] = def_r_oc_syms[i];
  16.      for (i = 0; i < MAXMCLASSES; i++)
  17.          r_syms[i + SYM_OFF_M] = def_monsyms[i].sym;
  18.      for (i = 0; i < WARNCOUNT; i++)
  19.          r_syms[i + SYM_OFF_W] = def_warnsyms[i].sym;
  20.      for (i = 0; i < MAXOTHER; i++) {
  21.          if (i == SYM_BOULDER)
  22.              r_syms[i + SYM_OFF_X] = iflags.bouldersym
  23.                                        ? iflags.bouldersym
  24.                                        : def_oc_syms[ROCK_CLASS].sym;
  25.          else if (i == SYM_INVISIBLE)
  26.              r_syms[i + SYM_OFF_X] = DEF_INVISIBLE;
  27.      }
  28.  
  29.      clear_symsetentry(ROGUESET, FALSE);
  30.      /* default on Rogue level is no color
  31.       * but some symbol sets can override that
  32.       */
  33.      symset[ROGUESET].nocolor = 1;
  34.  }
  35.  

assign_graphics

  1.  void
  2.  assign_graphics(whichset)
  3.  int whichset;
  4.  {
  5.      register int i;
  6.  
  7.      switch (whichset) {
  8.      case ROGUESET:
  9.          /* Adjust graphics display characters on Rogue levels */
  10.  
  11.          for (i = 0; i < SYM_MAX; i++)
  12.              showsyms[i] = r_syms[i];
  13.  
  14.  #if defined(MSDOS) && defined(USE_TILES)
  15.          if (iflags.grmode)
  16.              tileview(FALSE);
  17.  #endif
  18.          currentgraphics = ROGUESET;
  19.          break;
  20.  
  21.      case PRIMARY:
  22.      default:
  23.          for (i = 0; i < SYM_MAX; i++)
  24.              showsyms[i] = l_syms[i];
  25.  
  26.  #if defined(MSDOS) && defined(USE_TILES)
  27.          if (iflags.grmode)
  28.              tileview(TRUE);
  29.  #endif
  30.          currentgraphics = PRIMARY;
  31.          break;
  32.      }
  33.  }
  34.  

switch_symbols

  1.  void
  2.  switch_symbols(nondefault)
  3.  int nondefault;
  4.  {
  5.      register int i;
  6.  
  7.      if (nondefault) {
  8.          for (i = 0; i < SYM_MAX; i++)
  9.              showsyms[i] = l_syms[i];
  10.  #ifdef PC9800
  11.          if (SYMHANDLING(H_IBM) && ibmgraphics_mode_callback)
  12.              (*ibmgraphics_mode_callback)();
  13.          else if (!symset[currentgraphics].name && ascgraphics_mode_callback)
  14.              (*ascgraphics_mode_callback)();
  15.  #endif
  16.  #ifdef TERMLIB
  17.          if (SYMHANDLING(H_DEC) && decgraphics_mode_callback)
  18.              (*decgraphics_mode_callback)();
  19.  #endif
  20.      } else
  21.          init_symbols();
  22.  }
  23.  

update_l_symset

  1.  void
  2.  update_l_symset(symp, val)
  3.  struct symparse *symp;
  4.  int val;
  5.  {
  6.      l_syms[symp->idx] = val;
  7.  }
  8.  

update_r_symset

  1.  void
  2.  update_r_symset(symp, val)
  3.  struct symparse *symp;
  4.  int val;
  5.  {
  6.      r_syms[symp->idx] = val;
  7.  }
  8.  

clear_symsetentry

  1.  void
  2.  clear_symsetentry(which_set, name_too)
  3.  int which_set;
  4.  boolean name_too;
  5.  {
  6.      if (symset[which_set].desc)
  7.          free((genericptr_t) symset[which_set].desc);
  8.      symset[which_set].desc = (char *) 0;
  9.  
  10.      symset[which_set].handling = H_UNK;
  11.      symset[which_set].nocolor = 0;
  12.      /* initialize restriction bits */
  13.      symset[which_set].primary = 0;
  14.      symset[which_set].rogue = 0;
  15.  
  16.      if (name_too) {
  17.          if (symset[which_set].name)
  18.              free((genericptr_t) symset[which_set].name);
  19.          symset[which_set].name = (char *) 0;
  20.      }
  21.  }
  22.  

Additional symset data

  1.  /*
  2.   * If you are adding code somewhere to be able to recognize
  3.   * particular types of symset "handling", define a
  4.   * H_XXX macro in include/rm.h and add the name
  5.   * to this array at the matching offset.
  6.   */
  7.  const char *known_handling[] = {
  8.      "UNKNOWN", /* H_UNK */
  9.      "IBM",     /* H_IBM */
  10.      "DEC",     /* H_DEC */
  11.      (const char *) 0,
  12.  };
  13.  
  14.  /*
  15.   * Accepted keywords for symset restrictions.
  16.   * These can be virtually anything that you want to
  17.   * be able to test in the code someplace.
  18.   * Be sure to:
  19.   *    - add a corresponding Bitfield to the symsetentry struct in rm.h
  20.   *    - initialize the field to zero in parse_sym_line in the SYM_CONTROL
  21.   *      case 0 section of the idx switch. The location is prefaced with
  22.   *      with a comment stating "initialize restriction bits".
  23.   *    - set the value appropriately based on the index of your keyword
  24.   *      under the case 5 sections of the same SYM_CONTROL idx switches.
  25.   *    - add the field to clear_symsetentry()
  26.   */
  27.  const char *known_restrictions[] = {
  28.      "primary", "rogue", (const char *) 0,
  29.  };
  30.  
  31.  struct symparse loadsyms[] = {
  32.      { SYM_CONTROL, 0, "start" },
  33.      { SYM_CONTROL, 0, "begin" },
  34.      { SYM_CONTROL, 1, "finish" },
  35.      { SYM_CONTROL, 2, "handling" },
  36.      { SYM_CONTROL, 3, "description" },
  37.      { SYM_CONTROL, 4, "color" },
  38.      { SYM_CONTROL, 4, "colour" },
  39.      { SYM_CONTROL, 5, "restrictions" },
  40.      { SYM_PCHAR, S_stone, "S_stone" },
  41.      { SYM_PCHAR, S_vwall, "S_vwall" },
  42.      { SYM_PCHAR, S_hwall, "S_hwall" },
  43.      { SYM_PCHAR, S_tlcorn, "S_tlcorn" },
  44.      { SYM_PCHAR, S_trcorn, "S_trcorn" },
  45.      { SYM_PCHAR, S_blcorn, "S_blcorn" },
  46.      { SYM_PCHAR, S_brcorn, "S_brcorn" },
  47.      { SYM_PCHAR, S_crwall, "S_crwall" },
  48.      { SYM_PCHAR, S_tuwall, "S_tuwall" },
  49.      { SYM_PCHAR, S_tdwall, "S_tdwall" },
  50.      { SYM_PCHAR, S_tlwall, "S_tlwall" },
  51.      { SYM_PCHAR, S_trwall, "S_trwall" },
  52.      { SYM_PCHAR, S_ndoor, "S_ndoor" },
  53.      { SYM_PCHAR, S_vodoor, "S_vodoor" },
  54.      { SYM_PCHAR, S_hodoor, "S_hodoor" },
  55.      { SYM_PCHAR, S_vcdoor, "S_vcdoor" },
  56.      { SYM_PCHAR, S_hcdoor, "S_hcdoor" },
  57.      { SYM_PCHAR, S_bars, "S_bars" },
  58.      { SYM_PCHAR, S_tree, "S_tree" },
  59.      { SYM_PCHAR, S_room, "S_room" },
  60.      { SYM_PCHAR, S_corr, "S_corr" },
  61.      { SYM_PCHAR, S_litcorr, "S_litcorr" },
  62.      { SYM_PCHAR, S_upstair, "S_upstair" },
  63.      { SYM_PCHAR, S_dnstair, "S_dnstair" },
  64.      { SYM_PCHAR, S_upladder, "S_upladder" },
  65.      { SYM_PCHAR, S_dnladder, "S_dnladder" },
  66.      { SYM_PCHAR, S_altar, "S_altar" },
  67.      { SYM_PCHAR, S_grave, "S_grave" },
  68.      { SYM_PCHAR, S_throne, "S_throne" },
  69.      { SYM_PCHAR, S_sink, "S_sink" },
  70.      { SYM_PCHAR, S_fountain, "S_fountain" },
  71.      { SYM_PCHAR, S_pool, "S_pool" },
  72.      { SYM_PCHAR, S_ice, "S_ice" },
  73.      { SYM_PCHAR, S_lava, "S_lava" },
  74.      { SYM_PCHAR, S_vodbridge, "S_vodbridge" },
  75.      { SYM_PCHAR, S_hodbridge, "S_hodbridge" },
  76.      { SYM_PCHAR, S_vcdbridge, "S_vcdbridge" },
  77.      { SYM_PCHAR, S_hcdbridge, "S_hcdbridge" },
  78.      { SYM_PCHAR, S_air, "S_air" },
  79.      { SYM_PCHAR, S_cloud, "S_cloud" },
  80.      { SYM_PCHAR, S_poisoncloud, "S_poisoncloud" },
  81.      { SYM_PCHAR, S_water, "S_water" },
  82.      { SYM_PCHAR, S_arrow_trap, "S_arrow_trap" },
  83.      { SYM_PCHAR, S_dart_trap, "S_dart_trap" },
  84.      { SYM_PCHAR, S_falling_rock_trap, "S_falling_rock_trap" },
  85.      { SYM_PCHAR, S_squeaky_board, "S_squeaky_board" },
  86.      { SYM_PCHAR, S_bear_trap, "S_bear_trap" },
  87.      { SYM_PCHAR, S_land_mine, "S_land_mine" },
  88.      { SYM_PCHAR, S_rolling_boulder_trap, "S_rolling_boulder_trap" },
  89.      { SYM_PCHAR, S_sleeping_gas_trap, "S_sleeping_gas_trap" },
  90.      { SYM_PCHAR, S_rust_trap, "S_rust_trap" },
  91.      { SYM_PCHAR, S_fire_trap, "S_fire_trap" },
  92.      { SYM_PCHAR, S_pit, "S_pit" },
  93.      { SYM_PCHAR, S_spiked_pit, "S_spiked_pit" },
  94.      { SYM_PCHAR, S_hole, "S_hole" },
  95.      { SYM_PCHAR, S_trap_door, "S_trap_door" },
  96.      { SYM_PCHAR, S_teleportation_trap, "S_teleportation_trap" },
  97.      { SYM_PCHAR, S_level_teleporter, "S_level_teleporter" },
  98.      { SYM_PCHAR, S_magic_portal, "S_magic_portal" },
  99.      { SYM_PCHAR, S_web, "S_web" },
  100.      { SYM_PCHAR, S_statue_trap, "S_statue_trap" },
  101.      { SYM_PCHAR, S_magic_trap, "S_magic_trap" },
  102.      { SYM_PCHAR, S_anti_magic_trap, "S_anti_magic_trap" },
  103.      { SYM_PCHAR, S_polymorph_trap, "S_polymorph_trap" },
  104.      { SYM_PCHAR, S_vbeam, "S_vbeam" },
  105.      { SYM_PCHAR, S_hbeam, "S_hbeam" },
  106.      { SYM_PCHAR, S_lslant, "S_lslant" },
  107.      { SYM_PCHAR, S_rslant, "S_rslant" },
  108.      { SYM_PCHAR, S_digbeam, "S_digbeam" },
  109.      { SYM_PCHAR, S_flashbeam, "S_flashbeam" },
  110.      { SYM_PCHAR, S_boomleft, "S_boomleft" },
  111.      { SYM_PCHAR, S_boomright, "S_boomright" },
  112.      { SYM_PCHAR, S_goodpos, "S_goodpos" },
  113.      { SYM_PCHAR, S_ss1, "S_ss1" },
  114.      { SYM_PCHAR, S_ss2, "S_ss2" },
  115.      { SYM_PCHAR, S_ss3, "S_ss3" },
  116.      { SYM_PCHAR, S_ss4, "S_ss4" },
  117.      { SYM_PCHAR, S_sw_tl, "S_sw_tl" },
  118.      { SYM_PCHAR, S_sw_tc, "S_sw_tc" },
  119.      { SYM_PCHAR, S_sw_tr, "S_sw_tr" },
  120.      { SYM_PCHAR, S_sw_ml, "S_sw_ml" },
  121.      { SYM_PCHAR, S_sw_mr, "S_sw_mr" },
  122.      { SYM_PCHAR, S_sw_bl, "S_sw_bl" },
  123.      { SYM_PCHAR, S_sw_bc, "S_sw_bc" },
  124.      { SYM_PCHAR, S_sw_br, "S_sw_br" },
  125.      { SYM_PCHAR, S_explode1, "S_explode1" },
  126.      { SYM_PCHAR, S_explode2, "S_explode2" },
  127.      { SYM_PCHAR, S_explode3, "S_explode3" },
  128.      { SYM_PCHAR, S_explode4, "S_explode4" },
  129.      { SYM_PCHAR, S_explode5, "S_explode5" },
  130.      { SYM_PCHAR, S_explode6, "S_explode6" },
  131.      { SYM_PCHAR, S_explode7, "S_explode7" },
  132.      { SYM_PCHAR, S_explode8, "S_explode8" },
  133.      { SYM_PCHAR, S_explode9, "S_explode9" },
  134.      { SYM_OC, WEAPON_CLASS + SYM_OFF_O, "S_weapon" },
  135.      { SYM_OC, ARMOR_CLASS + SYM_OFF_O, "S_armor" },
  136.      { SYM_OC, ARMOR_CLASS + SYM_OFF_O, "S_armour" },
  137.      { SYM_OC, RING_CLASS + SYM_OFF_O, "S_ring" },
  138.      { SYM_OC, AMULET_CLASS + SYM_OFF_O, "S_amulet" },
  139.      { SYM_OC, TOOL_CLASS + SYM_OFF_O, "S_tool" },
  140.      { SYM_OC, FOOD_CLASS + SYM_OFF_O, "S_food" },
  141.      { SYM_OC, POTION_CLASS + SYM_OFF_O, "S_potion" },
  142.      { SYM_OC, SCROLL_CLASS + SYM_OFF_O, "S_scroll" },
  143.      { SYM_OC, SPBOOK_CLASS + SYM_OFF_O, "S_book" },
  144.      { SYM_OC, WAND_CLASS + SYM_OFF_O, "S_wand" },
  145.      { SYM_OC, COIN_CLASS + SYM_OFF_O, "S_coin" },
  146.      { SYM_OC, GEM_CLASS + SYM_OFF_O, "S_gem" },
  147.      { SYM_OC, ROCK_CLASS + SYM_OFF_O, "S_rock" },
  148.      { SYM_OC, BALL_CLASS + SYM_OFF_O, "S_ball" },
  149.      { SYM_OC, CHAIN_CLASS + SYM_OFF_O, "S_chain" },
  150.      { SYM_OC, VENOM_CLASS + SYM_OFF_O, "S_venom" },
  151.      { SYM_MON, S_ANT + SYM_OFF_M, "S_ant" },
  152.      { SYM_MON, S_BLOB + SYM_OFF_M, "S_blob" },
  153.      { SYM_MON, S_COCKATRICE + SYM_OFF_M, "S_cockatrice" },
  154.      { SYM_MON, S_DOG + SYM_OFF_M, "S_dog" },
  155.      { SYM_MON, S_EYE + SYM_OFF_M, "S_eye" },
  156.      { SYM_MON, S_FELINE + SYM_OFF_M, "S_feline" },
  157.      { SYM_MON, S_GREMLIN + SYM_OFF_M, "S_gremlin" },
  158.      { SYM_MON, S_HUMANOID + SYM_OFF_M, "S_humanoid" },
  159.      { SYM_MON, S_IMP + SYM_OFF_M, "S_imp" },
  160.      { SYM_MON, S_JELLY + SYM_OFF_M, "S_jelly" },
  161.      { SYM_MON, S_KOBOLD + SYM_OFF_M, "S_kobold" },
  162.      { SYM_MON, S_LEPRECHAUN + SYM_OFF_M, "S_leprechaun" },
  163.      { SYM_MON, S_MIMIC + SYM_OFF_M, "S_mimic" },
  164.      { SYM_MON, S_NYMPH + SYM_OFF_M, "S_nymph" },
  165.      { SYM_MON, S_ORC + SYM_OFF_M, "S_orc" },
  166.      { SYM_MON, S_PIERCER + SYM_OFF_M, "S_piercer" },
  167.      { SYM_MON, S_QUADRUPED + SYM_OFF_M, "S_quadruped" },
  168.      { SYM_MON, S_RODENT + SYM_OFF_M, "S_rodent" },
  169.      { SYM_MON, S_SPIDER + SYM_OFF_M, "S_spider" },
  170.      { SYM_MON, S_TRAPPER + SYM_OFF_M, "S_trapper" },
  171.      { SYM_MON, S_UNICORN + SYM_OFF_M, "S_unicorn" },
  172.      { SYM_MON, S_VORTEX + SYM_OFF_M, "S_vortex" },
  173.      { SYM_MON, S_WORM + SYM_OFF_M, "S_worm" },
  174.      { SYM_MON, S_XAN + SYM_OFF_M, "S_xan" },
  175.      { SYM_MON, S_LIGHT + SYM_OFF_M, "S_light" },
  176.      { SYM_MON, S_ZRUTY + SYM_OFF_M, "S_zruty" },
  177.      { SYM_MON, S_ANGEL + SYM_OFF_M, "S_angel" },
  178.      { SYM_MON, S_BAT + SYM_OFF_M, "S_bat" },
  179.      { SYM_MON, S_CENTAUR + SYM_OFF_M, "S_centaur" },
  180.      { SYM_MON, S_DRAGON + SYM_OFF_M, "S_dragon" },
  181.      { SYM_MON, S_ELEMENTAL + SYM_OFF_M, "S_elemental" },
  182.      { SYM_MON, S_FUNGUS + SYM_OFF_M, "S_fungus" },
  183.      { SYM_MON, S_GNOME + SYM_OFF_M, "S_gnome" },
  184.      { SYM_MON, S_GIANT + SYM_OFF_M, "S_giant" },
  185.      { SYM_MON, S_JABBERWOCK + SYM_OFF_M, "S_jabberwock" },
  186.      { SYM_MON, S_KOP + SYM_OFF_M, "S_kop" },
  187.      { SYM_MON, S_LICH + SYM_OFF_M, "S_lich" },
  188.      { SYM_MON, S_MUMMY + SYM_OFF_M, "S_mummy" },
  189.      { SYM_MON, S_NAGA + SYM_OFF_M, "S_naga" },
  190.      { SYM_MON, S_OGRE + SYM_OFF_M, "S_ogre" },
  191.      { SYM_MON, S_PUDDING + SYM_OFF_M, "S_pudding" },
  192.      { SYM_MON, S_QUANTMECH + SYM_OFF_M, "S_quantmech" },
  193.      { SYM_MON, S_RUSTMONST + SYM_OFF_M, "S_rustmonst" },
  194.      { SYM_MON, S_SNAKE + SYM_OFF_M, "S_snake" },
  195.      { SYM_MON, S_TROLL + SYM_OFF_M, "S_troll" },
  196.      { SYM_MON, S_UMBER + SYM_OFF_M, "S_umber" },
  197.      { SYM_MON, S_VAMPIRE + SYM_OFF_M, "S_vampire" },
  198.      { SYM_MON, S_WRAITH + SYM_OFF_M, "S_wraith" },
  199.      { SYM_MON, S_XORN + SYM_OFF_M, "S_xorn" },
  200.      { SYM_MON, S_YETI + SYM_OFF_M, "S_yeti" },
  201.      { SYM_MON, S_ZOMBIE + SYM_OFF_M, "S_zombie" },
  202.      { SYM_MON, S_HUMAN + SYM_OFF_M, "S_human" },
  203.      { SYM_MON, S_GHOST + SYM_OFF_M, "S_ghost" },
  204.      { SYM_MON, S_GOLEM + SYM_OFF_M, "S_golem" },
  205.      { SYM_MON, S_DEMON + SYM_OFF_M, "S_demon" },
  206.      { SYM_MON, S_EEL + SYM_OFF_M, "S_eel" },
  207.      { SYM_MON, S_LIZARD + SYM_OFF_M, "S_lizard" },
  208.      { SYM_MON, S_WORM_TAIL + SYM_OFF_M, "S_worm_tail" },
  209.      { SYM_MON, S_MIMIC_DEF + SYM_OFF_M, "S_mimic_def" },
  210.      { SYM_OTH, SYM_BOULDER + SYM_OFF_X, "S_boulder" },
  211.      { SYM_OTH, SYM_INVISIBLE + SYM_OFF_X, "S_invisible" },
  212.      { 0, 0, (const char *) 0 } /* fence post */
  213.  };
  214.  
  215.  /*drawing.c*/