Logo Search packages:      
Sourcecode: jnethack version File versions  Download package

drawing.c

/*    SCCS Id: @(#)drawing.c  3.2   94/09/16    */
/* Copyright (c) NetHack Development Team 1992.               */
/* NetHack may be freely redistributed.  See license for details. */

#include "hack.h"
#include "termcap.h"

/* Relevent header information in rm.h and objclass.h. */

#ifdef C
#undef C
#endif

#ifdef TEXTCOLOR
#define C(n) n
#else
#define C(n)
#endif

#define g_FILLER(symbol) 0

uchar oc_syms[MAXOCLASSES] = DUMMY; /* the current object  display symbols */
uchar showsyms[MAXPCHARS]  = DUMMY; /* the current feature display symbols */
uchar monsyms[MAXMCLASSES] = DUMMY; /* the current monster display symbols */

/* Default object class symbols.  See objclass.h. */
const char def_oc_syms[MAXOCLASSES] = {
/* 0*/      '\0',       /* placeholder for the "random class" */
      ILLOBJ_SYM,
      WEAPON_SYM,
      ARMOR_SYM,
      RING_SYM,
/* 5*/      AMULET_SYM,
      TOOL_SYM,
      FOOD_SYM,
      POTION_SYM,
      SCROLL_SYM,
/*10*/      SPBOOK_SYM,
      WAND_SYM,
      GOLD_SYM,
      GEM_SYM,
      ROCK_SYM,
/*15*/      BALL_SYM,
      CHAIN_SYM,
      VENOM_SYM
};

/* Object descriptions.  Used in do_look(). */
const char *objexplain[] = {  /* these match def_oc_syms, above */
/* 0*/      0,
      "strange object",
      "weapon",
      "suit or piece of armor",
      "ring",
/* 5*/      "amulet",
      "useful item (pick-axe, key, lamp...)",
      "piece of food",
      "potion",
      "scroll",
/*10*/      "spell book",
      "wand",
      "pile of coins",
      "gem or rock",
      "boulder or statue",
/*15*/      "iron ball",
      "iron chain",
      "splash of venom"
};

/* Object class names.  Used in object_detect(). */
const char *oclass_names[] = {
/* 0*/      0,
      "illegal objects",
      "weapons",
      "armor",
      "rings",
/* 5*/      "amulets",
      "tools",
      "food",
      "potions",
      "scrolls",
/*10*/      "spell books",
      "wands",
      "coins",
      "rocks",
      "large stones",
/*15*/      "iron balls",
      "chains",
      "venoms"
};

/* Default monster class symbols.  See monsym.h. */
const char def_monsyms[MAXMCLASSES] = {
      '\0',       /* holder */
      DEF_ANT,
      DEF_BLOB,
      DEF_COCKATRICE,
      DEF_DOG,
      DEF_EYE,
      DEF_FELINE,
      DEF_GREMLIN,
      DEF_HUMANOID,
      DEF_IMP,
      DEF_JELLY,        /* 10 */
      DEF_KOBOLD,
      DEF_LEPRECHAUN,
      DEF_MIMIC,
      DEF_NYMPH,
      DEF_ORC,
      DEF_PIERCER,
      DEF_QUADRUPED,
      DEF_RODENT,
      DEF_SPIDER,
      DEF_TRAPPER,            /* 20 */
      DEF_UNICORN,
      DEF_VORTEX,
      DEF_WORM,
      DEF_XAN,
      DEF_LIGHT,
      DEF_ZRUTY,
      DEF_ANGEL,
      DEF_BAT,
      DEF_CENTAUR,
      DEF_DRAGON,       /* 30 */
      DEF_ELEMENTAL,
      DEF_FUNGUS,
      DEF_GNOME,
      DEF_GIANT,
      DEF_STALKER,
      DEF_JABBERWOCK,
      DEF_KOP,
      DEF_LICH,
      DEF_MUMMY,
      DEF_NAGA,         /* 40 */
      DEF_OGRE,
      DEF_PUDDING,
      DEF_QUANTMECH,
      DEF_RUSTMONST,
      DEF_SNAKE,
      DEF_TROLL,
      DEF_UMBER,
      DEF_VAMPIRE,
      DEF_WRAITH,
      DEF_XORN,         /* 50 */
      DEF_YETI,
      DEF_ZOMBIE,
      DEF_HUMAN,
      DEF_GHOST,
      DEF_GOLEM,
      DEF_DEMON,
      DEF_EEL,
      DEF_LIZARD,
      DEF_WORM_TAIL,
      DEF_MIMIC_DEF,          /* 60 */
};

/* The explanations below are also used when the user gives a string
 * for blessed genocide, so no text should wholly contain any later
 * text.  They should also always contain obvious names (eg. cat/feline).
 */
const char *monexplain[MAXMCLASSES] = {
    0,
    "ant or other insect",    "blob",                 "cockatrice",
    "dog or other canine",    "eye or sphere",  "cat or other feline",
    "gremlin",                "humanoid",       "imp or minor demon",
    "jelly",                  "kobold",         "leprechaun",
    "mimic",                  "nymph",          "orc",
    "piercer",                "quadruped",            "rodent",
    "spider",                 "trapper or lurker above", "unicorn",
    "vortex",           "worm", "xan or other mythical/fantastic insect",
    "light",                  "zruty",

    "angelic being",          "bat",                  "centaur",
    "dragon",                 "elemental",            "fungus or mold",
    "gnome",                  "giant humanoid", "invisible stalker",
    "jabberwock",       "Keystone Kop",         "lich",
    "mummy",                  "naga",                 "ogre",
    "pudding or ooze",        "quantum mechanic",     "rust monster",
    "snake",                  "troll",          "umber hulk",
    "vampire",                "wraith",         "xorn",
    "yeti, ape or other large beast", "zombie",

    "human or elf",           "ghost",          "golem",
    "major demon",            "sea monster",          "lizard",
    "long worm tail",         "mimic"
};

/*
 *  Default screen symbols with explanations and colors.
 *  Note:  {ibm|dec|mac}_graphics[] arrays also depend on this symbol order.
 */
const struct symdef defsyms[MAXPCHARS] = {
/* 0*/      {' ', "dark part of a room",C(NO_COLOR)}, /* stone */
      {'|', "wall",           C(CLR_GRAY)},     /* vwall */
      {'-', "wall",           C(CLR_GRAY)},     /* hwall */
      {'-', "wall",           C(CLR_GRAY)},     /* tlcorn */
      {'-', "wall",           C(CLR_GRAY)},     /* trcorn */
      {'-', "wall",           C(CLR_GRAY)},     /* blcorn */
      {'-', "wall",           C(CLR_GRAY)},     /* brcorn */
      {'-', "wall",           C(CLR_GRAY)},     /* crwall */
      {'-', "wall",           C(CLR_GRAY)},     /* tuwall */
      {'-', "wall",           C(CLR_GRAY)},     /* tdwall */
/*10*/      {'|', "wall",           C(CLR_GRAY)},     /* tlwall */
      {'|', "wall",           C(CLR_GRAY)},     /* trwall */
      {'.', "doorway",  C(CLR_GRAY)},     /* ndoor */
      {'-', "open door",      C(CLR_BROWN)},    /* vodoor */
      {'|', "open door",      C(CLR_BROWN)},    /* hodoor */
      {'+', "closed door",    C(CLR_BROWN)},    /* vcdoor */
      {'+', "closed door",    C(CLR_BROWN)},    /* hcdoor */
      {'.', "floor of a room",C(CLR_GRAY)},     /* room */
      {'#', "corridor", C(CLR_GRAY)},     /* dark corr */
      {'#', "lit corridor",   C(CLR_GRAY)},     /* lit corr */
/*20*/      {'<', "staircase up",   C(CLR_GRAY)},     /* upstair */
      {'>', "staircase down", C(CLR_GRAY)},     /* dnstair */
      {'<', "ladder up",      C(CLR_BROWN)},    /* upladder */
      {'>', "ladder down",    C(CLR_BROWN)},    /* dnladder */
      {'_', "altar",          C(CLR_GRAY)},     /* altar */
      {'\\', "opulent throne",C(HI_GOLD)},      /* throne */
#ifdef SINKS
      {'#', "sink",           C(CLR_GRAY)},     /* sink */
#else
      {'#', "",         C(CLR_GRAY)},     /* sink */
#endif
      {'{', "fountain", C(CLR_BLUE)},     /* fountain */
      {'}', "water",          C(CLR_BLUE)},     /* pool */
      {'.', "ice",            C(CLR_CYAN)},     /* ice */
/*30*/      {'}', "molten lava",    C(CLR_RED)},      /* lava */
      {'.', "lowered drawbridge",C(CLR_BROWN)}, /* vodbridge */
      {'.', "lowered drawbridge",C(CLR_BROWN)}, /* hodbridge */
      {'#', "raised drawbridge",C(CLR_BROWN)},/* vcdbridge */
      {'#', "raised drawbridge",C(CLR_BROWN)},/* hcdbridge */
      {' ', "air",            C(CLR_CYAN)},     /* open air */
      {'#', "cloud",          C(CLR_GRAY)},     /* [part of] a cloud */
      {'}', "water",          C(CLR_BLUE)},     /* under water */
      {'^', "arrow trap",     C(HI_METAL)},     /* trap */
      {'^', "dart trap",      C(HI_METAL)},     /* trap */
/*40*/      {'^', "falling rock trap",C(CLR_GRAY)},   /* trap */
      {'^', "squeaky board",  C(CLR_BROWN)},    /* trap */
      {'^', "bear trap",      C(HI_METAL)},     /* trap */
      {'^', "land mine",      C(CLR_RED)},      /* trap */
      {'^', "rolling boulder trap", C(CLR_GRAY)},     /* trap */
      {'^', "sleeping gas trap",C(HI_ZAP)},     /* trap */
      {'^', "rust trap",      C(CLR_BLUE)},     /* trap */
      {'^', "fire trap",      C(CLR_ORANGE)},   /* trap */
      {'^', "pit",            C(CLR_BLACK)},    /* trap */
      {'^', "spiked pit",     C(CLR_BLACK)},    /* trap */
/*50*/      {'^', "hole",     C(CLR_BROWN)},    /* trap */
      {'^', "trap door",      C(CLR_BROWN)},    /* trap */
      {'^', "teleportation trap", C(CLR_MAGENTA)},    /* trap */
      {'^', "level teleporter", C(CLR_MAGENTA)},      /* trap */
      {'^', "magic portal",   C(CLR_BRIGHT_MAGENTA)}, /* trap */
      {'"', "web",            C(CLR_GRAY)},     /* web */
      {'^', "statue trap",    C(CLR_GRAY)},     /* trap */
      {'^', "magic trap",     C(HI_ZAP)}, /* trap */
      {'^', "anti-magic trap field", C(HI_ZAP)},      /* trap */
      {'^', "polymorph trap", C(CLR_BRIGHT_GREEN)},   /* trap */
/*60*/      {'|', "wall",           C(CLR_GRAY)},     /* vbeam */
      {'-', "wall",           C(CLR_GRAY)},     /* hbeam */
      {'\\',"wall",           C(CLR_GRAY)},     /* lslant */
      {'/', "wall",           C(CLR_GRAY)},     /* rslant */
      {'*', "",         C(CLR_WHITE)},    /* dig beam */
      {'!', "",         C(CLR_WHITE)},    /* camera flash beam */
      {')', "",         C(HI_WOOD)},      /* boomerang open left */
      {'(', "",         C(HI_WOOD)},      /* boomerang open right */
      {'0', "",         C(HI_ZAP)}, /* 4 magic shield symbols */
      {'#', "",         C(HI_ZAP)},
/*70*/      {'@', "",         C(HI_ZAP)},
      {'*', "",         C(HI_ZAP)},
      {'/', "",         C(CLR_GREEN)},    /* swallow top left     */
      {'-', "",         C(CLR_GREEN)},    /* swallow top center   */
      {'\\', "",        C(CLR_GREEN)},    /* swallow top right    */
      {'|', "",         C(CLR_GREEN)},    /* swallow middle left  */
      {'|', "",         C(CLR_GREEN)},    /* swallow middle right */
      {'\\', "",        C(CLR_GREEN)},    /* swallow bottom left  */
      {'-', "",         C(CLR_GREEN)},    /* swallow bottom center*/
      {'/', "",         C(CLR_GREEN)},    /* swallow bottom right */
/*80*/      {'/', "",         C(CLR_ORANGE)},   /* explosion top left     */
      {'-', "",         C(CLR_ORANGE)},   /* explosion top center   */
      {'\\', "",        C(CLR_ORANGE)},   /* explosion top right    */
      {'|', "",         C(CLR_ORANGE)},   /* explosion middle left  */
      {' ', "",         C(CLR_ORANGE)},   /* explosion middle center*/
      {'|', "",         C(CLR_ORANGE)},   /* explosion middle right */
      {'\\', "",        C(CLR_ORANGE)},   /* explosion bottom left  */
      {'-', "",         C(CLR_ORANGE)},   /* explosion bottom center*/
      {'/', "",         C(CLR_ORANGE)},   /* explosion bottom right */
/*
 *  Note: Additions to this array should be reflected in the
 *      {ibm,dec,mac}_graphics[] arrays below.
 */
};

#undef C

#ifdef ASCIIGRAPH

#ifdef PC9800
void NDECL((*ibmgraphics_mode_callback)) = 0;   /* set in tty_start_screen() */
#endif /* PC9800 */

#if 0/*JP*/
static uchar ibm_graphics[MAXPCHARS] = {
/* 0*/      g_FILLER(S_stone),
      0xb3, /* S_vwall: meta-3, vertical rule */
      0xc4, /* S_hwall: meta-D, horizontal rule */
      0xda, /* S_tlcorn:      meta-Z, top left corner */
      0xbf, /* S_trcorn:      meta-?, top right corner */
      0xc0, /* S_blcorn:      meta-@, bottom left */
      0xd9, /* S_brcorn:      meta-Y, bottom right */
      0xc5, /* S_crwall:      meta-E, cross */
      0xc1, /* S_tuwall:      meta-A, T up */
      0xc2, /* S_tdwall:      meta-B, T down */
/*10*/      0xb4, /* S_tlwall:      meta-4, T left */
      0xc3, /* S_trwall:      meta-C, T right */
      0xfa, /* S_ndoor: meta-z, centered dot */
      0xfe, /* S_vodoor:      meta-~, small centered square */
      0xfe, /* S_hodoor:      meta-~, small centered square */
      g_FILLER(S_vcdoor),
      g_FILLER(S_hcdoor),
      0xfa, /* S_room:  meta-z, centered dot */
      0xb0, /* S_corr:  meta-0, light shading */
      0xb1, /* S_litcorr:     meta-1, medium shading */
/*20*/      g_FILLER(S_upstair),
      g_FILLER(S_dnstair),
      g_FILLER(S_upladder),
      g_FILLER(S_dnladder),
      g_FILLER(S_altar),
      g_FILLER(S_throne),
      g_FILLER(S_sink),
      0xf4, /* S_fountain:    meta-t, integral top half */
      0xf7, /* S_pool:  meta-w, approx. equals */
      0xfa, /* S_ice:   meta-z, centered dot */
/*30*/      0xf7, /* S_lava:  meta-w, approx. equals */
      0xfa, /* S_vodbridge:   meta-z, centered dot */
      0xfa, /* S_hodbridge:   meta-z, centered dot */
      g_FILLER(S_vcdbridge),
      g_FILLER(S_hcdbridge),
      g_FILLER(S_air),
      g_FILLER(S_cloud),
      0xf7, /* S_water: meta-w, approx. equals */
      g_FILLER(S_arrow_trap),
      g_FILLER(S_dart_trap),
/*40*/      g_FILLER(S_falling_rock_trap),
      g_FILLER(S_squeaky_board),
      g_FILLER(S_bear_trap),
      g_FILLER(S_land_mine),
      g_FILLER(S_rolling_boulder_trap),
      g_FILLER(S_sleeping_gas_trap),
      g_FILLER(S_rust_trap),
      g_FILLER(S_fire_trap),
      g_FILLER(S_pit),
      g_FILLER(S_spiked_pit),
/*50*/  g_FILLER(S_hole),
      g_FILLER(S_trap_door),
      g_FILLER(S_teleportation_trap),
      g_FILLER(S_level_teleporter),
      g_FILLER(S_magic_portal),
      g_FILLER(S_web),
      g_FILLER(S_statue_trap),
      g_FILLER(S_magic_trap),
      g_FILLER(S_anti_magic_trap),
      g_FILLER(S_polymorph_trap),
/*60*/      0xb3, /* S_vbeam: meta-3, vertical rule */
      0xc4, /* S_hbeam: meta-D, horizontal rule */
      g_FILLER(S_lslant),
      g_FILLER(S_rslant),
      g_FILLER(S_digbeam),
      g_FILLER(S_flashbeam),
      g_FILLER(S_boomleft),
      g_FILLER(S_boomright),
      g_FILLER(S_ss1),
      g_FILLER(S_ss2),
/*70*/      g_FILLER(S_ss3),
      g_FILLER(S_ss4),
      g_FILLER(S_sw_tl),
      g_FILLER(S_sw_tc),
      g_FILLER(S_sw_tr),
      0xb3, /* S_sw_ml: meta-3, vertical rule */
      0xb3, /* S_sw_mr: meta-3, vertical rule */
      g_FILLER(S_sw_bl),
      g_FILLER(S_sw_bc),
      g_FILLER(S_sw_br),
/*80*/      g_FILLER(S_explode1),
      g_FILLER(S_explode2),
      g_FILLER(S_explode3),
      0xb3, /* S_explode4:    meta-3, vertical rule */
      g_FILLER(S_explode5),
      0xb3, /* S_explode6:    meta-3, vertical rule */
      g_FILLER(S_explode7),
      g_FILLER(S_explode8),
      g_FILLER(S_explode9)
};
#endif
#endif  /* ASCIIGRAPH */

#ifdef TERMLIB
void NDECL((*decgraphics_mode_callback)) = 0;  /* set in tty_start_screen() */

static uchar dec_graphics[MAXPCHARS] = {
/* 0*/      g_FILLER(S_stone),
      0xf8, /* S_vwall: meta-x, vertical rule */
      0xf1, /* S_hwall: meta-q, horizontal rule */
      0xec, /* S_tlcorn:      meta-l, top left corner */
      0xeb, /* S_trcorn:      meta-k, top right corner */
      0xed, /* S_blcorn:      meta-m, bottom left */
      0xea, /* S_brcorn:      meta-j, bottom right */
      0xee, /* S_crwall:      meta-n, cross */
      0xf6, /* S_tuwall:      meta-v, T up */
      0xf7, /* S_tdwall:      meta-w, T down */
/*10*/      0xf5, /* S_tlwall:      meta-u, T left */
      0xf4, /* S_trwall:      meta-t, T right */
      0xfe, /* S_ndoor: meta-~, centered dot */
      0xe1, /* S_vodoor:      meta-a, solid block */
      0xe1, /* S_hodoor:      meta-a, solid block */
      g_FILLER(S_vcdoor),
      g_FILLER(S_hcdoor),
      0xfe, /* S_room:  meta-~, centered dot */
      g_FILLER(S_corr),
      g_FILLER(S_litcorr),
/*20*/      g_FILLER(S_upstair),
      g_FILLER(S_dnstair),
      g_FILLER(S_upladder),
      g_FILLER(S_dnladder),
      g_FILLER(S_altar),      /* 0xc3, \E)3: meta-C, dagger */
      g_FILLER(S_throne),
      g_FILLER(S_sink),
      g_FILLER(S_fountain),   /* 0xdb, \E)3: meta-[, integral top half */
      0xe0, /* S_pool:  meta-\, diamond */
      0xfe, /* S_ice:   meta-~, centered dot */
/*30*/      0xe0, /* S_lava:  meta-\, diamond */
      0xfe, /* S_vodbridge:   meta-~, centered dot */
      0xfe, /* S_hodbridge:   meta-~, centered dot */
      g_FILLER(S_vcdbridge),
      g_FILLER(S_hcdbridge),
      g_FILLER(S_air),
      g_FILLER(S_cloud),
      0xe0, /* S_water: meta-\, diamond */
      g_FILLER(S_arrow_trap),
      g_FILLER(S_dart_trap),
/*40*/      g_FILLER(S_falling_rock_trap),
      g_FILLER(S_squeaky_board),
      g_FILLER(S_bear_trap),
      g_FILLER(S_land_mine),
      g_FILLER(S_rolling_boulder_trap),
      g_FILLER(S_sleeping_gas_trap),
      g_FILLER(S_rust_trap),
      g_FILLER(S_fire_trap),
      g_FILLER(S_pit),
      g_FILLER(S_spiked_pit),
/*50*/      g_FILLER(S_hole),
      g_FILLER(S_trap_door),
      g_FILLER(S_teleportation_trap),
      g_FILLER(S_level_teleporter),
      g_FILLER(S_magic_portal),
      g_FILLER(S_web),  /* 0xbd, \E)3: meta-=, int'l currency */
      g_FILLER(S_statue_trap),
      g_FILLER(S_magic_trap),
      g_FILLER(S_anti_magic_trap),
      g_FILLER(S_polymorph_trap),
/*60*/      0xf8, /* S_vbeam: meta-x, vertical rule */
      0xf1, /* S_hbeam: meta-q, horizontal rule */
      g_FILLER(S_lslant),
      g_FILLER(S_rslant),
      g_FILLER(S_digbeam),
      g_FILLER(S_flashbeam),
      g_FILLER(S_boomleft),
      g_FILLER(S_boomright),
      g_FILLER(S_ss1),
      g_FILLER(S_ss2),
/*70*/      g_FILLER(S_ss3),
      g_FILLER(S_ss4),
      g_FILLER(S_sw_tl),
      0xef, /* S_sw_tc: meta-o, high horizontal line */
      g_FILLER(S_sw_tr),
      0xf8, /* S_sw_ml: meta-x, vertical rule */
      0xf8, /* S_sw_mr: meta-x, vertical rule */
      g_FILLER(S_sw_bl),
      0xf3, /* S_sw_bc: meta-s, low horizontal line */
      g_FILLER(S_sw_br),
/*80*/      g_FILLER(S_explode1),
      0xef, /* S_explode2:    meta-o, high horizontal line */
      g_FILLER(S_explode3),
      0xf8, /* S_explode4:    meta-x, vertical rule */
      g_FILLER(S_explode5),
      0xf8, /* S_explode6:    meta-x, vertical rule */
      g_FILLER(S_explode7),
      0xf3, /* S_explode8:    meta-s, low horizontal line */
      g_FILLER(S_explode9)
};
#endif  /* TERMLIB */

#ifdef MAC_GRAPHICS_ENV
static uchar mac_graphics[MAXPCHARS] = {
/* 0*/      g_FILLER(S_stone),
      0xba, /* S_vwall */
      0xcd, /* S_hwall */
      0xc9, /* S_tlcorn */
      0xbb, /* S_trcorn */
      0xc8, /* S_blcorn */
      0xbc, /* S_brcorn */
      0xce, /* S_crwall */
      0xca, /* S_tuwall */
      0xcb, /* S_tdwall */
/*10*/      0xb9, /* S_tlwall */
      0xcc, /* S_trwall */
      0xb0, /* S_ndoor */
      0xee, /* S_vodoor */
      0xee, /* S_hodoor */
      0xef, /* S_vcdoor */
      0xef, /* S_hcdoor */
      g_FILLER(S_Room),
      0xB0, /* S_corr */
      g_FILLER(S_litcorr),
/*20*/      g_FILLER(S_upstair),
      g_FILLER(S_dnstair),
      g_FILLER(S_upladder),
      g_FILLER(S_dnladder),
      g_FILLER(S_altar),
      g_FILLER(S_throne),
      g_FILLER(S_sink),
      g_FILLER(S_fountain),
      0xe0, /* S_pool */
      g_FILLER(S_ice),
/*30*/      g_FILLER(S_lava),
      g_FILLER(S_vodbridge),
      g_FILLER(S_hodbridge),
      g_FILLER(S_vcdbridge),
      g_FILLER(S_hcdbridge),
      g_FILLER(S_air),
      g_FILLER(S_cloud),
      g_FILLER(S_water),
      g_FILLER(S_arrow_trap),
      g_FILLER(S_dart_trap),
/*40*/      g_FILLER(S_falling_rock_trap),
      g_FILLER(S_squeaky_board),
      g_FILLER(S_bear_trap),
      g_FILLER(S_land_mine),
      g_FILLER(S_rolling_boulder_trap),
      g_FILLER(S_sleeping_gas_trap),
      g_FILLER(S_rust_trap),
      g_FILLER(S_fire_trap),
      g_FILLER(S_pit),
      g_FILLER(S_spiked_pit),
/*50*/      g_FILLER(S_hole),
      g_FILLER(S_trap_door),
      g_FILLER(S_teleportation_trap),
      g_FILLER(S_level_teleporter),
      g_FILLER(S_magic_portal),
      g_FILLER(S_web),
      g_FILLER(S_statue_trap),
      g_FILLER(S_magic_trap),
      g_FILLER(S_anti_magic_trap),
      g_FILLER(S_polymorph_trap),
/*60*/      g_FILLER(S_vbeam),
      g_FILLER(S_hbeam),
      g_FILLER(S_lslant),
      g_FILLER(S_rslant),
      g_FILLER(S_digbeam),
      g_FILLER(S_flashbeam),
      g_FILLER(S_boomleft),
      g_FILLER(S_boomright),
      g_FILLER(S_ss1),
      g_FILLER(S_ss2),
/*70*/      g_FILLER(S_ss3),
      g_FILLER(S_ss4),
      g_FILLER(S_sw_tl),
      g_FILLER(S_sw_tc),
      g_FILLER(S_sw_tr),
      g_FILLER(S_sw_ml),
      g_FILLER(S_sw_mr),
      g_FILLER(S_sw_bl),
      g_FILLER(S_sw_bc),
      g_FILLER(S_sw_br),
/*80*/      g_FILLER(S_explode1),
      g_FILLER(S_explode2),
      g_FILLER(S_explode3),
      g_FILLER(S_explode4),
      g_FILLER(S_explode5),
      g_FILLER(S_explode6),
      g_FILLER(S_explode7),
      g_FILLER(S_explode8),
      g_FILLER(S_explode9)
};
#endif      /* MAC_GRAPHICS_ENV */

#ifdef PC9800
void NDECL((*ascgraphics_mode_callback)) = 0;   /* set in tty_start_screen() */
#endif

/*
 * Convert the given character to an object class.  If the character is not
 * recognized, then MAXOCLASSES is returned.  Used in invent.c, options.c,
 * pickup.c, sp_lev.c, and lev_main.c.
 */
int
def_char_to_objclass(ch)
    char ch;
{
    int i;
    for (i = 1; i < MAXOCLASSES; i++)
      if (ch == def_oc_syms[i]) break;
    return i;
}

/*
 * Convert a character into a monster class.  This returns the _first_
 * match made.  If there are are no matches, return MAXMCLASSES.
 */
int
def_char_to_monclass(ch)
    char ch;
{
    int i;
    for (i = 1; i < MAXMCLASSES; i++)
      if (def_monsyms[i] == ch) break;
    return i;
}

void
assign_graphics(graph_chars, glth, maxlen, offset)
register uchar *graph_chars;
int glth, maxlen, offset;
{
    register int i;

    for (i = 0; i < maxlen; i++)
      showsyms[i+offset] = (((i < glth) && graph_chars[i]) ?
                   graph_chars[i] : defsyms[i+offset].sym);
}

void
switch_graphics(gr_set_flag)
int gr_set_flag;
{
    switch (gr_set_flag) {
      default:
      case ASCII_GRAPHICS:
          assign_graphics((uchar *)0, 0, MAXPCHARS, 0);
#ifdef PC9800
          if (ascgraphics_mode_callback) (*ascgraphics_mode_callback)();
#endif
          break;
/* #ifdef ASCIIGRAPH */
# if 0
      case IBM_GRAPHICS:
/*
 * Use the nice IBM Extended ASCII line-drawing characters (codepage 437).
 *
 * OS/2 defaults to a multilingual character set (codepage 850, corresponding
 * to the ISO 8859 character set.  We should probably do a VioSetCp() call to
 * set the codepage to 437.
 */
          iflags.IBMgraphics = TRUE;
          iflags.DECgraphics = FALSE;
          assign_graphics(ibm_graphics, SIZE(ibm_graphics), MAXPCHARS, 0);
#ifdef PC9800
          if (ibmgraphics_mode_callback) (*ibmgraphics_mode_callback)();
#endif
          break;
#endif /* ASCIIGRAPH */
#ifdef TERMLIB
      case DEC_GRAPHICS:
/*
 * Use the VT100 line drawing character set.
 */
          iflags.DECgraphics = TRUE;
          iflags.IBMgraphics = FALSE;
          assign_graphics(dec_graphics, SIZE(dec_graphics), MAXPCHARS, 0);
          if (decgraphics_mode_callback) (*decgraphics_mode_callback)();
          break;
#endif /* TERMLIB */
#ifdef MAC_GRAPHICS_ENV
      case MAC_GRAPHICS:
          assign_graphics(mac_graphics, SIZE(mac_graphics), MAXPCHARS, 0);
          break;
#endif
      }
    return;
}


#ifdef REINCARNATION

/*
 * saved display symbols for objects & features.
 */
static uchar save_oc_syms[MAXOCLASSES] = DUMMY;
static uchar save_showsyms[MAXPCHARS]  = DUMMY;
static uchar save_monsyms[MAXPCHARS]   = DUMMY;

static const uchar r_oc_syms[MAXOCLASSES] = {
/* 0*/      '\0',
      ILLOBJ_SYM,
      WEAPON_SYM,
      ']',              /* armor */
      RING_SYM,
/* 5*/      ',',              /* amulet */
      TOOL_SYM,
      ':',              /* food */
      POTION_SYM,
      SCROLL_SYM,
/*10*/      SPBOOK_SYM,
      WAND_SYM,
      GEM_SYM,          /* gold -- yes it's the same as gems */
      GEM_SYM,
      ROCK_SYM,
/*15*/      BALL_SYM,
      CHAIN_SYM,
      VENOM_SYM
};

#if 0 /*JP*/
# ifdef ASCIIGRAPH
static const uchar IBM_r_oc_syms[MAXOCLASSES] = {     /* a la EPYX Rogue */
/* 0*/      '\0',
      ILLOBJ_SYM,
      0x18,             /* weapon: up arrow */
/*    0x0a, */ ARMOR_SYM,     /* armor:  Vert rect with o */
/*    0x09, */ RING_SYM,      /* ring:   circle with arrow */
/* 5*/      0x0c,             /* amulet: "female" symbol */
      TOOL_SYM,
      0x05,             /* food:   club (as in cards) */
      0xad,             /* potion: upside down '!' */
      0x0e,             /* scroll: musical note */
/*10*/      SPBOOK_SYM,
      0xe7,             /* wand:   greek tau */
      0x0f,             /* gold:   yes it's the same as gems */
      0x0f,             /* gems:   fancy '*' */
      ROCK_SYM,
/*15*/      BALL_SYM,
      CHAIN_SYM,
      VENOM_SYM
};
# endif /* ASCIIGRAPH */
#endif /*JP*/

void
assign_rogue_graphics(is_rlevel)
boolean is_rlevel;
{
    /* Adjust graphics display characters on Rogue levels */

    if (is_rlevel) {
      register int i;

      (void) memcpy((genericptr_t)save_showsyms,
                  (genericptr_t)showsyms, sizeof showsyms);
      (void) memcpy((genericptr_t)save_oc_syms,
                  (genericptr_t)oc_syms, sizeof oc_syms);
      (void) memcpy((genericptr_t)save_monsyms,
                  (genericptr_t)monsyms, sizeof monsyms);

      /* Use a loop: char != uchar on some machines. */
      for (i = 0; i < MAXMCLASSES; i++)
          monsyms[i] = def_monsyms[i];
      for (i = 0; i < MAXPCHARS; i++)
          showsyms[i] = defsyms[i].sym;

/*
 * Some day if these rogue showsyms get much more extensive than this,
 * we may want to create r_showsyms, and IBM_r_showsyms arrays to hold
 * all of this info and to simply initialize it via a for() loop like r_oc_syms.
 */

#if 0 /*JP*/
# ifdef ASCIIGRAPH
      if (!iflags.IBMgraphics
#  if defined(USE_TILES) && defined(MSDOS)
            || iflags.grmode
#  endif
                        ) {
# endif
#endif /*JP*/
          showsyms[S_vodoor]  = showsyms[S_hodoor]  = showsyms[S_ndoor] = '+';
          showsyms[S_upstair] = showsyms[S_dnstair] = '%';
#if 0 /*JP*/
# ifdef ASCIIGRAPH
      } else {
          /* a la EPYX Rogue */
          showsyms[S_vwall]   = 0xba; /* all walls now use  */
          showsyms[S_hwall]   = 0xcd; /* double line graphics     */
          showsyms[S_tlcorn]  = 0xc9;
          showsyms[S_trcorn]  = 0xbb;
          showsyms[S_blcorn]  = 0xc8;
          showsyms[S_brcorn]  = 0xbc;
          showsyms[S_crwall]  = 0xce;
          showsyms[S_tuwall]  = 0xca;
          showsyms[S_tdwall]  = 0xcb;
          showsyms[S_tlwall]  = 0xb9;
          showsyms[S_trwall]  = 0xcc;
          showsyms[S_ndoor]   = 0xce;
          showsyms[S_vodoor]  = 0xce;
          showsyms[S_hodoor]  = 0xce;
          showsyms[S_corr]    = 0xb1;
          showsyms[S_litcorr] = 0xb2;
          showsyms[S_upstair] = 0xf0; /* Greek Xi */
          showsyms[S_dnstair] = 0xf0;
          showsyms[S_arrow_trap] = 0x04; /* diamond (cards) */
          showsyms[S_dart_trap] = 0x04;
          showsyms[S_falling_rock_trap] = 0x04;
          showsyms[S_squeaky_board] = 0x04;
          showsyms[S_bear_trap] = 0x04;
          showsyms[S_land_mine] = 0x04;
          showsyms[S_rolling_boulder_trap] = 0x04;
          showsyms[S_sleeping_gas_trap] = 0x04;
          showsyms[S_rust_trap] = 0x04;
          showsyms[S_fire_trap] = 0x04;
          showsyms[S_pit] = 0x04;
          showsyms[S_spiked_pit] = 0x04;
          showsyms[S_hole] = 0x04;
          showsyms[S_trap_door] = 0x04;
          showsyms[S_teleportation_trap] = 0x04;
          showsyms[S_level_teleporter] = 0x04;
          showsyms[S_magic_portal] = 0x04;
          showsyms[S_web] = 0x04;
          showsyms[S_statue_trap] = 0x04;
          showsyms[S_magic_trap] = 0x04;
          showsyms[S_anti_magic_trap] = 0x04;
          showsyms[S_polymorph_trap] = 0x04;
      }
#endif /* ASCIIGRAPH */
#endif /* JP */

      for (i = 0; i < MAXOCLASSES; i++) {
#if 0 /* JP */
#ifdef ASCIIGRAPH
          if (iflags.IBMgraphics
# if defined(USE_TILES) && defined(MSDOS)
            && !iflags.grmode
# endif
            )
            oc_syms[i] = IBM_r_oc_syms[i];
          else
#endif /* ASCIIGRAPH */
#endif /* JP */
            oc_syms[i] = r_oc_syms[i];
      }
#if defined(USE_TILES) && defined(MSDOS)
      if (iflags.grmode) tileview(FALSE);
#endif
    } else {
      (void) memcpy((genericptr_t)showsyms,
                  (genericptr_t)save_showsyms, sizeof showsyms);
      (void) memcpy((genericptr_t)oc_syms,
                  (genericptr_t)save_oc_syms, sizeof oc_syms);
      (void) memcpy((genericptr_t)monsyms,
                  (genericptr_t)save_monsyms, sizeof monsyms);
#if defined(USE_TILES) && defined(MSDOS)
      if (iflags.grmode) tileview(TRUE);
#endif
    }
}
#endif /* REINCARNATION */

/*drawing.c*/

Generated by  Doxygen 1.6.0   Back to index