1 #include "term/gameterm.h"
2 #include "system/system-variables.h"
3 #include "term/term-color-types.h"
4 #include "util/quarks.h"
5 #include "util/string-processor.h"
8 * Convert an "attr"/"char" pair into a "pict" (P)
10 #define PICT(A, C) ((((u16b)(A)) << 8) | ((byte)(C)))
13 * Standard window names
15 const char angband_term_name[8][16] =
28 * Global table of color definitions
30 byte angband_color_table[256][4] =
32 {0x00, 0x00, 0x00, 0x00}, /* TERM_DARK */
33 {0x00, 0xFF, 0xFF, 0xFF}, /* TERM_WHITE */
34 {0x00, 0x80, 0x80, 0x80}, /* TERM_SLATE */
35 {0x00, 0xFF, 0x80, 0x00}, /* TERM_ORANGE */
36 {0x00, 0xC0, 0x00, 0x00}, /* TERM_RED */
37 {0x00, 0x00, 0x80, 0x40}, /* TERM_GREEN */
38 {0x00, 0x00, 0x00, 0xFF}, /* TERM_BLUE */
39 {0x00, 0x80, 0x40, 0x00}, /* TERM_UMBER */
40 {0x00, 0x40, 0x40, 0x40}, /* TERM_L_DARK */
41 {0x00, 0xC0, 0xC0, 0xC0}, /* TERM_L_WHITE */
42 {0x00, 0xFF, 0x00, 0xFF}, /* TERM_VIOLET */
43 {0x00, 0xFF, 0xFF, 0x00}, /* TERM_YELLOW */
44 {0x00, 0xFF, 0x00, 0x00}, /* TERM_L_RED */
45 {0x00, 0x00, 0xFF, 0x00}, /* TERM_L_GREEN */
46 {0x00, 0x00, 0xFF, 0xFF}, /* TERM_L_BLUE */
47 {0x00, 0xC0, 0x80, 0x40} /* TERM_L_UMBER */
51 * @brief 色名称テーブル / Hack -- the "basic" color names (see "TERM_xxx")
53 const concptr color_names[16] =
95 * @brief サブウィンドウ名称テーブル
98 * Certain "screens" always use the main screen, including News, Birth,
99 * Dungeon, Tomb-stone, High-scores, Macros, Colors, Visuals, Options.
101 * Later, special flags may allow sub-windows to "steal" stuff from the
102 * main window, including File dump (help), File dump (artifacts, uniques),
103 * Character screen, Small scale map, Previous Messages, Store screen, etc.
105 * The "ctrl-i" (tab) command flips the "Display inven/equip" and "Display
106 * equip/inven" flags for all windows.
108 * The "ctrl-g" command (or pseudo-command) should perhaps grab a snapshot
109 * of the main screen into any interested windows.
112 const concptr window_flag_desc[32] =
114 _("持ち物/装備一覧", "Display inven/equip"),
115 _("装備/持ち物一覧", "Display equip/inven"),
116 _("呪文一覧", "Display spell list"),
117 _("キャラクタ情報", "Display character"),
118 _("視界内のモンスター表示", "Display monsters in sight"),
120 _("メッセージ", "Display messages"),
121 _("ダンジョン全体図", "Display overhead view"),
122 _("モンスターの思い出", "Display monster recall"),
123 _("アイテムの詳細", "Display object recall"),
124 _("自分の周囲を表示", "Display dungeon view"),
125 _("記念撮影", "Display snap-shot"),
150 * @brief シンボル解説テーブル /
151 * The table of "symbol info" -- each entry is a string of the form "X:desc" where "X" is the trigger, and "desc" is the "info".
153 const concptr ident_info[] =
166 "*:財宝を含んだ鉱脈または球形の怪物",
171 "/:竿状武器(アックス/パイク/等)",
249 "}:飛び道具(弓/クロスボウ/スリング)",
253 "!:A potion (or oil)",
254 "\":An amulet (or necklace)",
255 "#:A wall (or secret door) / a plant / a gas",
256 "$:Treasure (gold or gems)",
257 "%:A vein (magma or quartz)",
262 "*:A vein with treasure or a ball monster",
264 ",:Food (or mushroom patch)",
267 "/:A polearm (Axe/Pike/etc)",
268 "0:Entrance to Museum",
269 "1:Entrance to General Store",
270 "2:Entrance to Armory",
271 "3:Entrance to Weaponsmith",
272 "4:Entrance to Temple",
273 "5:Entrance to Alchemy shop",
274 "6:Entrance to Magic store",
275 "7:Entrance to Black Market",
276 "8:Entrance to your home",
277 "9:Entrance to the bookstore",
279 ";:A glyph of warding / an explosive rune",
282 ">:A down staircase",
288 "D:Ancient Dragon/Wyrm",
297 "M:Multi-Headed Reptile",
301 "Q:Quylthulg (Pulsing Flesh Mound)",
302 "R:Reptile/Amphibian",
303 "S:Spider/Scorpion/Tick",
307 "W:Wight/Wraith/etc",
312 "\\:A hafted weapon (mace/whip/etc)",
316 "`:A figurine or statue",
324 "h:Hobbit/Elf/Dwarf",
343 "{:A missile (arrow/bolt/shot)",
344 "|:An edged weapon (sword/dagger/etc)",
345 "}:A launcher (bow/crossbow/sling)",
346 "~:Fluid terrain (or miscellaneous item)",
353 * The array of window pointers
355 term_type *angband_term[8];
359 * Encode the screen colors
361 static const concptr color_char = "dwsorgbuDWvyRGBU";
364 * Specify attr/char pairs for visual special effects
365 * Be sure to use "index & 0x7F" to avoid illegal access
367 TERM_COLOR misc_to_attr[256];
368 SYMBOL_CODE misc_to_char[256];
371 * Specify attr/char pairs for inventory items (by tval)
372 * Be sure to use "index & 0x7F" to avoid illegal access
374 TERM_COLOR tval_to_attr[128];
377 * Default spell color table (quark index)
379 TERM_COLOR gf_color[MAX_GF];
382 * @brief 万色表現用にランダムな色を選択する関数 /
383 * Get a legal "multi-hued" color for drawing "spells"
387 static TERM_COLOR mh_attr(int max)
389 switch (randint1(max))
391 case 1: return (TERM_RED);
392 case 2: return (TERM_GREEN);
393 case 3: return (TERM_BLUE);
394 case 4: return (TERM_YELLOW);
395 case 5: return (TERM_ORANGE);
396 case 6: return (TERM_VIOLET);
397 case 7: return (TERM_L_RED);
398 case 8: return (TERM_L_GREEN);
399 case 9: return (TERM_L_BLUE);
400 case 10: return (TERM_UMBER);
401 case 11: return (TERM_L_UMBER);
402 case 12: return (TERM_SLATE);
403 case 13: return (TERM_WHITE);
404 case 14: return (TERM_L_WHITE);
405 case 15: return (TERM_L_DARK);
413 * @brief 魔法属性に応じたエフェクトの色を返す /
414 * Return a color to use for the bolt/ball spells
418 static TERM_COLOR spell_color(EFFECT_ID type)
420 /* Check if A.B.'s new graphics should be used (rr9) */
421 if (streq(ANGBAND_GRAF, "new") || streq(ANGBAND_GRAF, "ne2"))
426 case GF_PSY_SPEAR: return (0x06);
427 case GF_MISSILE: return (0x0F);
428 case GF_ACID: return (0x04);
429 case GF_ELEC: return (0x02);
430 case GF_FIRE: return (0x00);
431 case GF_COLD: return (0x01);
432 case GF_POIS: return (0x03);
433 case GF_HOLY_FIRE: return (0x00);
434 case GF_HELL_FIRE: return (0x00);
435 case GF_MANA: return (0x0E);
437 case GF_SEEKER: return (0x0E);
438 case GF_SUPER_RAY: return (0x0E);
440 case GF_ARROW: return (0x0F);
441 case GF_WATER: return (0x04);
442 case GF_NETHER: return (0x07);
443 case GF_CHAOS: return (mh_attr(15));
444 case GF_DISENCHANT: return (0x05);
445 case GF_NEXUS: return (0x0C);
446 case GF_CONFUSION: return (mh_attr(4));
447 case GF_SOUND: return (0x09);
448 case GF_SHARDS: return (0x08);
449 case GF_FORCE: return (0x09);
450 case GF_INERTIAL: return (0x09);
451 case GF_GRAVITY: return (0x09);
452 case GF_TIME: return (0x09);
453 case GF_LITE_WEAK: return (0x06);
454 case GF_LITE: return (0x06);
455 case GF_DARK_WEAK: return (0x07);
456 case GF_DARK: return (0x07);
457 case GF_PLASMA: return (0x0B);
458 case GF_METEOR: return (0x00);
459 case GF_ICE: return (0x01);
460 case GF_ROCKET: return (0x0F);
461 case GF_DEATH_RAY: return (0x07);
462 case GF_NUKE: return (mh_attr(2));
463 case GF_DISINTEGRATE: return (0x05);
475 case GF_CAUSE_4: return (0x0E);
476 case GF_HAND_DOOM: return (0x07);
477 case GF_CAPTURE: return (0x0E);
478 case GF_IDENTIFY: return (0x01);
479 case GF_ATTACK: return (0x0F);
480 case GF_PHOTO: return (0x06);
483 /* Normal tiles or ASCII */
489 /* Lookup the default colors for this type */
490 concptr s = quark_str(gf_color[type]);
492 if (!s) return (TERM_WHITE);
494 /* Pick a random color */
495 c = s[randint0(strlen(s))];
497 /* Lookup this color */
498 a = angband_strchr(color_char, c) - color_char;
500 /* Invalid color (note check for < 0 removed, gave a silly
501 * warning because bytes are always >= 0 -- RG) */
502 if (a > 15) return (TERM_WHITE);
508 /* Standard "color" */
514 * @brief 始点から終点にかけた方向毎にボルトのキャラクタを返す /
515 * Find the attr/char pair to use for a spell effect
524 * It is moving (or has moved) from (x,y) to (nx,ny).
525 * If the distance is not "one", we (may) return "*".
528 u16b bolt_pict(POSITION y, POSITION x, POSITION ny, POSITION nx, EFFECT_ID typ)
538 if ((ny == y) && (nx == x)) base = 0x30;
541 else if (nx == x) base = 0x40;
544 else if (ny == y) base = 0x50;
547 else if ((ny - y) == (x - nx)) base = 0x60;
550 else if ((ny - y) == (nx - x)) base = 0x70;
555 /* Basic spell color */
556 k = spell_color(typ);
558 /* Obtain attr/char */
559 a = misc_to_attr[base + k];
560 c = misc_to_char[base + k];
570 * @brief シンボル1文字をカラーIDに変更する /
571 * Convert a "color letter" into an "actual" color
572 * The colors are: dwsorgbuDWvyRGBU, as shown below
576 TERM_COLOR color_char_to_attr(SYMBOL_CODE c)
580 case 'd': return (TERM_DARK);
581 case 'w': return (TERM_WHITE);
582 case 's': return (TERM_SLATE);
583 case 'o': return (TERM_ORANGE);
584 case 'r': return (TERM_RED);
585 case 'g': return (TERM_GREEN);
586 case 'b': return (TERM_BLUE);
587 case 'u': return (TERM_UMBER);
589 case 'D': return (TERM_L_DARK);
590 case 'W': return (TERM_L_WHITE);
591 case 'v': return (TERM_VIOLET);
592 case 'y': return (TERM_YELLOW);
593 case 'R': return (TERM_L_RED);
594 case 'G': return (TERM_L_GREEN);
595 case 'B': return (TERM_L_BLUE);
596 case 'U': return (TERM_L_UMBER);