[BACK]Return to Rogue.h CVS log [TXT][DIR] Up to [contributed] / brogue-ce / src / brogue

Annotation of brogue-ce/src/brogue/Rogue.h, Revision 1.1

1.1     ! rubenllo    1: //
        !             2: //  RogueMain.h
        !             3: //  Brogue
        !             4: //
        !             5: //  Created by Brian Walker on 12/26/08.
        !             6: //  Copyright 2012. All rights reserved.
        !             7: //
        !             8: //  This file is part of Brogue.
        !             9: //
        !            10: //  This program is free software: you can redistribute it and/or modify
        !            11: //  it under the terms of the GNU Affero General Public License as
        !            12: //  published by the Free Software Foundation, either version 3 of the
        !            13: //  License, or (at your option) any later version.
        !            14: //
        !            15: //  This program is distributed in the hope that it will be useful,
        !            16: //  but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            17: //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            18: //  GNU Affero General Public License for more details.
        !            19: //
        !            20: //  You should have received a copy of the GNU Affero General Public License
        !            21: //  along with this program.  If not, see <http://www.gnu.org/licenses/>.
        !            22: //
        !            23:
        !            24: #include <stdio.h>
        !            25: #include <stdlib.h>
        !            26: #include <string.h>
        !            27: #include <stdint.h>
        !            28: #include <time.h>
        !            29: #include "PlatformDefines.h"
        !            30:
        !            31: // unicode: comment this line to revert to ASCII
        !            32:
        !            33: #define USE_UNICODE
        !            34:
        !            35: // Brogue version: what the user sees in the menu and title
        !            36: #define BROGUE_VERSION_STRING "CE 1.9.3" BROGUE_EXTRA_VERSION
        !            37:
        !            38: // Recording version. Saved into recordings and save files made by this version.
        !            39: // Cannot be longer than 16 chars
        !            40: #define BROGUE_RECORDING_VERSION_STRING "CE 1.9.3"
        !            41:
        !            42: /* Patch pattern. A scanf format string which matches an unsigned short. If this
        !            43: matches against a recording version string, it defines a "patch version." During
        !            44: normal play, rogue.patchVersion is set to the match of the game's recording
        !            45: version above, or 0 if it doesn't match.
        !            46:
        !            47: The game will only load a recording/save if either a) it has a patch version
        !            48: which is equal or less than the patch version of the current game
        !            49: (rogue.patchLevel is set to the recording's); or b) it doesn't match the version
        !            50: strings, but they are equal (rogue.patchLevel is set to 0).
        !            51: */
        !            52: #define BROGUE_PATCH_VERSION_PATTERN "CE 1.9.%hu"
        !            53:
        !            54: // Dungeon version. Used in seed catalog output.
        !            55: #define BROGUE_DUNGEON_VERSION_STRING "CE 1.9"
        !            56:
        !            57: #define DEBUG                           if (rogue.wizard)
        !            58: #define MONSTERS_ENABLED                (!rogue.wizard || 1) // Quest room monsters can be generated regardless.
        !            59: #define ITEMS_ENABLED                   (!rogue.wizard || 1)
        !            60:
        !            61: #define D_BULLET_TIME                   (rogue.wizard && 0)
        !            62: #define D_WORMHOLING                    (rogue.wizard && 1)
        !            63: #define D_IMMORTAL                      (rogue.wizard && 1)
        !            64:
        !            65: #define D_SAFETY_VISION                 (rogue.wizard && 0)
        !            66: #define D_SCENT_VISION                  (rogue.wizard && 0)
        !            67: #define D_DISABLE_BACKGROUND_COLORS     (rogue.wizard && 0)
        !            68:
        !            69: #define D_INSPECT_LEVELGEN              (rogue.wizard && 0)
        !            70: #define D_INSPECT_MACHINES              (rogue.wizard && 0)
        !            71:
        !            72: #define D_MESSAGE_ITEM_GENERATION       (rogue.wizard && 0)
        !            73: #define D_MESSAGE_MACHINE_GENERATION    (rogue.wizard && 0)
        !            74:
        !            75: // set to false to allow multiple loads from the same saved file:
        !            76: #define DELETE_SAVE_FILE_AFTER_LOADING  true
        !            77:
        !            78: // set to false to disable references to keystrokes (e.g. for a tablet port)
        !            79: #define KEYBOARD_LABELS true
        !            80:
        !            81: //#define BROGUE_ASSERTS        // introduces several assert()s -- useful to find certain array overruns and other bugs
        !            82: //#define AUDIT_RNG             // VERY slow, but sometimes necessary to debug out-of-sync recording errors
        !            83: //#define GENERATE_FONT_FILES   // Displays font in grid upon startup, which can be screen-captured into font files for PC.
        !            84:
        !            85: #ifdef BROGUE_ASSERTS
        !            86: #include <assert.h>
        !            87: #define brogueAssert(x)         assert(x)
        !            88: #else
        !            89: #define brogueAssert(x)
        !            90: #endif
        !            91:
        !            92: #define boolean                 char
        !            93:
        !            94: #define false                   0
        !            95: #define true                    1
        !            96:
        !            97: #define Fl(N)                   ((unsigned long) 1 << (N))
        !            98:
        !            99: typedef long long fixpt;
        !           100: #define FP_BASE 16 // Don't change this without recalculating all of the power tables throughout the code!
        !           101: #define FP_FACTOR (1LL << FP_BASE)
        !           102: #define FP_MUL(x, y)  ((x) * (y) / FP_FACTOR)
        !           103: #define FP_DIV(x, y)  ((x) * FP_FACTOR / (y))
        !           104:
        !           105: // recording and save filenames
        !           106: #define LAST_GAME_PATH          "LastGame.broguesave"
        !           107: #define LAST_GAME_NAME          "LastGame"
        !           108: #define LAST_RECORDING_NAME     "LastRecording"
        !           109: #define RECORDING_SUFFIX        ".broguerec"
        !           110: #define GAME_SUFFIX             ".broguesave"
        !           111: #define ANNOTATION_SUFFIX       ".txt"
        !           112: #define RNG_LOG                 "RNGLog.txt"
        !           113: #define SCREENSHOT_SUFFIX       ".png"
        !           114:
        !           115: #define BROGUE_FILENAME_MAX     (min(1024*4, FILENAME_MAX))
        !           116:
        !           117: // Date format used when listing recordings and high scores
        !           118: #define DATE_FORMAT             "%Y-%m-%d" // see strftime() documentation
        !           119:
        !           120: #define MESSAGE_LINES           3
        !           121: #define MESSAGE_ARCHIVE_LINES   ROWS
        !           122:
        !           123: // Size of the entire terminal window. These need to be hard-coded here and in Viewport.h
        !           124: #define COLS                    100
        !           125: #define ROWS                    (31 + MESSAGE_LINES)
        !           126:
        !           127: // Size of the portion of the terminal window devoted to displaying the dungeon:
        !           128: #define DCOLS                   (COLS - STAT_BAR_WIDTH - 1) // n columns on the left for the sidebar;
        !           129:                                                             // one column to separate the sidebar from the map.
        !           130: #define DROWS                   (ROWS - MESSAGE_LINES - 2)  // n lines at the top for messages;
        !           131:                                                             // one line at the bottom for flavor text;
        !           132:                                                             // another line at the bottom for the menu bar.
        !           133:
        !           134: #define STAT_BAR_WIDTH          20          // number of characters in the stats bar to the left of the map
        !           135:
        !           136: #define LOS_SLOPE_GRANULARITY   32768       // how finely we divide up the squares when calculating slope;
        !           137:                                             // higher numbers mean fewer artifacts but more memory and processing
        !           138: #define INTERFACE_OPACITY       95
        !           139:
        !           140: #define LIGHT_SMOOTHING_THRESHOLD 150       // light components higher than this magnitude will be toned down a little
        !           141:
        !           142: #define MAX_BOLT_LENGTH         DCOLS*10
        !           143:
        !           144: #define VISIBILITY_THRESHOLD    50          // how bright cumulative light has to be before the cell is marked visible
        !           145:
        !           146: #define AMULET_LEVEL            26          // how deep before the amulet appears
        !           147: #define DEEPEST_LEVEL           40          // how deep the universe goes
        !           148:
        !           149: #define MACHINES_FACTOR         FP_FACTOR   // use this to adjust machine frequency
        !           150:
        !           151: #define MACHINES_BUFFER_LENGTH  200
        !           152:
        !           153: #define WEAPON_KILLS_TO_AUTO_ID 20
        !           154: #define ARMOR_DELAY_TO_AUTO_ID  1000
        !           155: #define RING_DELAY_TO_AUTO_ID   1500
        !           156:
        !           157: #define FALL_DAMAGE_MIN         8
        !           158: #define FALL_DAMAGE_MAX         10
        !           159:
        !           160: #define INPUT_RECORD_BUFFER     1000        // how many bytes of input data to keep in memory before saving it to disk
        !           161: #define DEFAULT_PLAYBACK_DELAY  50
        !           162:
        !           163: #define HIGH_SCORES_COUNT       30
        !           164:
        !           165: // color escapes
        !           166: #define COLOR_ESCAPE            25
        !           167: #define COLOR_VALUE_INTERCEPT   25
        !           168:
        !           169: // display characters:
        !           170:
        !           171: enum displayGlyph {
        !           172:     G_UP_ARROW = 128,
        !           173:     G_DOWN_ARROW,
        !           174:     G_POTION,
        !           175:     G_GRASS,
        !           176:     G_WALL,
        !           177:     G_DEMON,
        !           178:     G_OPEN_DOOR,
        !           179:     G_GOLD,
        !           180:     G_CLOSED_DOOR,
        !           181:     G_RUBBLE,
        !           182:     G_KEY,
        !           183:     G_BOG,
        !           184:     G_CHAIN_TOP_LEFT,
        !           185:     G_CHAIN_BOTTOM_RIGHT,
        !           186:     G_CHAIN_TOP_RIGHT,
        !           187:     G_CHAIN_BOTTOM_LEFT,
        !           188:     G_CHAIN_TOP,
        !           189:     G_CHAIN_BOTTOM,
        !           190:     G_CHAIN_LEFT,
        !           191:     G_CHAIN_RIGHT,
        !           192:     G_FOOD,
        !           193:     G_UP_STAIRS,
        !           194:     G_VENT,
        !           195:     G_DOWN_STAIRS,
        !           196:     G_PLAYER,
        !           197:     G_BOG_MONSTER,
        !           198:     G_CENTAUR,
        !           199:     G_DRAGON,
        !           200:     G_FLAMEDANCER,
        !           201:     G_GOLEM,
        !           202:     G_TENTACLE_HORROR,
        !           203:     G_IFRIT,
        !           204:     G_JELLY,
        !           205:     G_KRAKEN,
        !           206:     G_LICH,
        !           207:     G_NAGA,
        !           208:     G_OGRE,
        !           209:     G_PHANTOM,
        !           210:     G_REVENANT,
        !           211:     G_SALAMANDER,
        !           212:     G_TROLL,
        !           213:     G_UNDERWORM,
        !           214:     G_VAMPIRE,
        !           215:     G_WRAITH,
        !           216:     G_ZOMBIE,
        !           217:     G_ARMOR,
        !           218:     G_STAFF,
        !           219:     G_WEB,
        !           220:     G_MOUND,
        !           221:     G_BLOAT,
        !           222:     G_CENTIPEDE,
        !           223:     G_DAR_BLADEMASTER,
        !           224:     G_EEL,
        !           225:     G_FURY,
        !           226:     G_GOBLIN,
        !           227:     G_IMP,
        !           228:     G_JACKAL,
        !           229:     G_KOBOLD,
        !           230:     G_MONKEY,
        !           231:     G_PIXIE,
        !           232:     G_RAT,
        !           233:     G_SPIDER,
        !           234:     G_TOAD,
        !           235:     G_BAT,
        !           236:     G_WISP,
        !           237:     G_PHOENIX,
        !           238:     G_ALTAR,
        !           239:     G_LIQUID,
        !           240:     G_FLOOR,
        !           241:     G_CHASM,
        !           242:     G_TRAP,
        !           243:     G_FIRE,
        !           244:     G_FOLIAGE,
        !           245:     G_AMULET,
        !           246:     G_SCROLL,
        !           247:     G_RING,
        !           248:     G_WEAPON,
        !           249:     G_TURRET,
        !           250:     G_TOTEM,
        !           251:     G_GOOD_MAGIC,
        !           252:     G_BAD_MAGIC,
        !           253:     G_DOORWAY,
        !           254:     G_CHARM,
        !           255:     G_WALL_TOP,
        !           256:     G_DAR_PRIESTESS,
        !           257:     G_DAR_BATTLEMAGE,
        !           258:     G_GOBLIN_MAGIC,
        !           259:     G_GOBLIN_CHIEFTAN,
        !           260:     G_OGRE_MAGIC,
        !           261:     G_GUARDIAN,
        !           262:     G_WINGED_GUARDIAN,
        !           263:     G_EGG,
        !           264:     G_WARDEN,
        !           265:     G_DEWAR,
        !           266:     G_ANCIENT_SPIRIT,
        !           267:     G_LEVER,
        !           268:     G_LEVER_PULLED,
        !           269:     G_BLOODWORT_STALK,
        !           270:     G_FLOOR_ALT,
        !           271:     G_UNICORN,
        !           272:     G_GEM,
        !           273:     G_WAND,
        !           274:     G_GRANITE,
        !           275:     G_CARPET,
        !           276:     G_CLOSED_IRON_DOOR,
        !           277:     G_OPEN_IRON_DOOR,
        !           278:     G_TORCH,
        !           279:     G_CRYSTAL,
        !           280:     G_PORTCULLIS,
        !           281:     G_BARRICADE,
        !           282:     G_STATUE,
        !           283:     G_CRACKED_STATUE,
        !           284:     G_CLOSED_CAGE,
        !           285:     G_OPEN_CAGE,
        !           286:     G_PEDESTAL,
        !           287:     G_CLOSED_COFFIN,
        !           288:     G_OPEN_COFFIN,
        !           289:     G_MAGIC_GLYPH,
        !           290:     G_BRIDGE,
        !           291:     G_BONES,
        !           292:     G_ELECTRIC_CRYSTAL,
        !           293:     G_ASHES,
        !           294:     G_BEDROLL,
        !           295:     G_BLOODWORT_POD,
        !           296:     G_VINE,
        !           297:     G_NET,
        !           298:     G_LICHEN,
        !           299:     G_PIPES,
        !           300:     G_SAC_ALTAR,
        !           301:     G_ORB_ALTAR
        !           302: };
        !           303:
        !           304: enum eventTypes {
        !           305:     KEYSTROKE,
        !           306:     MOUSE_UP,
        !           307:     MOUSE_DOWN,
        !           308:     RIGHT_MOUSE_DOWN,
        !           309:     RIGHT_MOUSE_UP,
        !           310:     MOUSE_ENTERED_CELL,
        !           311:     RNG_CHECK,
        !           312:     SAVED_GAME_LOADED,
        !           313:     END_OF_RECORDING,
        !           314:     EVENT_ERROR,
        !           315:     NUMBER_OF_EVENT_TYPES, // unused
        !           316: };
        !           317:
        !           318: enum notificationEventTypes {
        !           319:        GAMEOVER_QUIT,
        !           320:        GAMEOVER_DEATH,
        !           321:        GAMEOVER_VICTORY,
        !           322:        GAMEOVER_SUPERVICTORY,
        !           323:        GAMEOVER_RECORDING
        !           324: };
        !           325:
        !           326: typedef struct rogueEvent {
        !           327:     enum eventTypes eventType;
        !           328:     signed long param1;
        !           329:     signed long param2;
        !           330:     boolean controlKey;
        !           331:     boolean shiftKey;
        !           332: } rogueEvent;
        !           333:
        !           334: typedef struct rogueHighScoresEntry {
        !           335:     signed long score;
        !           336:     char date[100];
        !           337:     char description[DCOLS];
        !           338: } rogueHighScoresEntry;
        !           339:
        !           340: typedef struct fileEntry {
        !           341:     char *path;
        !           342:     struct tm date;
        !           343: } fileEntry;
        !           344:
        !           345: enum RNGs {
        !           346:     RNG_SUBSTANTIVE,
        !           347:     RNG_COSMETIC,
        !           348:     NUMBER_OF_RNGS,
        !           349: };
        !           350:
        !           351: enum displayDetailValues {
        !           352:     DV_UNLIT = 0,
        !           353:     DV_LIT,
        !           354:     DV_DARK,
        !           355: };
        !           356:
        !           357: enum directions {
        !           358:     NO_DIRECTION    = -1,
        !           359:     // Cardinal directions; must be 0-3:
        !           360:     UP              = 0,
        !           361:     DOWN            = 1,
        !           362:     LEFT            = 2,
        !           363:     RIGHT           = 3,
        !           364:     // Secondary directions; must be 4-7:
        !           365:     UPLEFT          = 4,
        !           366:     DOWNLEFT        = 5,
        !           367:     UPRIGHT         = 6,
        !           368:     DOWNRIGHT       = 7,
        !           369:
        !           370:     DIRECTION_COUNT = 8,
        !           371: };
        !           372:
        !           373: enum textEntryTypes {
        !           374:     TEXT_INPUT_NORMAL = 0,
        !           375:     TEXT_INPUT_FILENAME,
        !           376:     TEXT_INPUT_NUMBERS,
        !           377:     TEXT_INPUT_TYPES,
        !           378: };
        !           379:
        !           380: #define NUMBER_DYNAMIC_COLORS   6
        !           381:
        !           382: enum tileType {
        !           383:     NOTHING = 0,
        !           384:     GRANITE,
        !           385:     FLOOR,
        !           386:     FLOOR_FLOODABLE,
        !           387:     CARPET,
        !           388:     MARBLE_FLOOR,
        !           389:     WALL,
        !           390:     DOOR,
        !           391:     OPEN_DOOR,
        !           392:     SECRET_DOOR,
        !           393:     LOCKED_DOOR,
        !           394:     OPEN_IRON_DOOR_INERT,
        !           395:     DOWN_STAIRS,
        !           396:     UP_STAIRS,
        !           397:     DUNGEON_EXIT,
        !           398:     DUNGEON_PORTAL,
        !           399:     TORCH_WALL, // wall lit with a torch
        !           400:     CRYSTAL_WALL,
        !           401:     PORTCULLIS_CLOSED,
        !           402:     PORTCULLIS_DORMANT,
        !           403:     WOODEN_BARRICADE,
        !           404:     PILOT_LIGHT_DORMANT,
        !           405:     PILOT_LIGHT,
        !           406:     HAUNTED_TORCH_DORMANT,
        !           407:     HAUNTED_TORCH_TRANSITIONING,
        !           408:     HAUNTED_TORCH,
        !           409:     WALL_LEVER_HIDDEN,
        !           410:     WALL_LEVER,
        !           411:     WALL_LEVER_PULLED,
        !           412:     WALL_LEVER_HIDDEN_DORMANT,
        !           413:     STATUE_INERT,
        !           414:     STATUE_DORMANT,
        !           415:     STATUE_CRACKING,
        !           416:     STATUE_INSTACRACK,
        !           417:     PORTAL,
        !           418:     TURRET_DORMANT,
        !           419:     WALL_MONSTER_DORMANT,
        !           420:     DARK_FLOOR_DORMANT,
        !           421:     DARK_FLOOR_DARKENING,
        !           422:     DARK_FLOOR,
        !           423:     MACHINE_TRIGGER_FLOOR,
        !           424:     ALTAR_INERT,
        !           425:     ALTAR_KEYHOLE,
        !           426:     ALTAR_CAGE_OPEN,
        !           427:     ALTAR_CAGE_CLOSED,
        !           428:     ALTAR_SWITCH,
        !           429:     ALTAR_SWITCH_RETRACTING,
        !           430:     ALTAR_CAGE_RETRACTABLE,
        !           431:     PEDESTAL,
        !           432:     MONSTER_CAGE_OPEN,
        !           433:     MONSTER_CAGE_CLOSED,
        !           434:     COFFIN_CLOSED,
        !           435:     COFFIN_OPEN,
        !           436:
        !           437:     GAS_TRAP_POISON_HIDDEN,
        !           438:     GAS_TRAP_POISON,
        !           439:     TRAP_DOOR_HIDDEN,
        !           440:     TRAP_DOOR,
        !           441:     GAS_TRAP_PARALYSIS_HIDDEN,
        !           442:     GAS_TRAP_PARALYSIS,
        !           443:     MACHINE_PARALYSIS_VENT_HIDDEN,
        !           444:     MACHINE_PARALYSIS_VENT,
        !           445:     GAS_TRAP_CONFUSION_HIDDEN,
        !           446:     GAS_TRAP_CONFUSION,
        !           447:     FLAMETHROWER_HIDDEN,
        !           448:     FLAMETHROWER,
        !           449:     FLOOD_TRAP_HIDDEN,
        !           450:     FLOOD_TRAP,
        !           451:     NET_TRAP_HIDDEN,
        !           452:     NET_TRAP,
        !           453:     ALARM_TRAP_HIDDEN,
        !           454:     ALARM_TRAP,
        !           455:     MACHINE_POISON_GAS_VENT_HIDDEN,
        !           456:     MACHINE_POISON_GAS_VENT_DORMANT,
        !           457:     MACHINE_POISON_GAS_VENT,
        !           458:     MACHINE_METHANE_VENT_HIDDEN,
        !           459:     MACHINE_METHANE_VENT_DORMANT,
        !           460:     MACHINE_METHANE_VENT,
        !           461:     STEAM_VENT,
        !           462:     MACHINE_PRESSURE_PLATE,
        !           463:     MACHINE_PRESSURE_PLATE_USED,
        !           464:     MACHINE_GLYPH,
        !           465:     MACHINE_GLYPH_INACTIVE,
        !           466:     DEWAR_CAUSTIC_GAS,
        !           467:     DEWAR_CONFUSION_GAS,
        !           468:     DEWAR_PARALYSIS_GAS,
        !           469:     DEWAR_METHANE_GAS,
        !           470:
        !           471:     DEEP_WATER,
        !           472:     SHALLOW_WATER,
        !           473:     MUD,
        !           474:     CHASM,
        !           475:     CHASM_EDGE,
        !           476:     MACHINE_COLLAPSE_EDGE_DORMANT,
        !           477:     MACHINE_COLLAPSE_EDGE_SPREADING,
        !           478:     LAVA,
        !           479:     LAVA_RETRACTABLE,
        !           480:     LAVA_RETRACTING,
        !           481:     SUNLIGHT_POOL,
        !           482:     DARKNESS_PATCH,
        !           483:     ACTIVE_BRIMSTONE,
        !           484:     INERT_BRIMSTONE,
        !           485:     OBSIDIAN,
        !           486:     BRIDGE,
        !           487:     BRIDGE_FALLING,
        !           488:     BRIDGE_EDGE,
        !           489:     STONE_BRIDGE,
        !           490:     MACHINE_FLOOD_WATER_DORMANT,
        !           491:     MACHINE_FLOOD_WATER_SPREADING,
        !           492:     MACHINE_MUD_DORMANT,
        !           493:     ICE_DEEP,
        !           494:     ICE_DEEP_MELT,
        !           495:     ICE_SHALLOW,
        !           496:     ICE_SHALLOW_MELT,
        !           497:
        !           498:     HOLE,
        !           499:     HOLE_GLOW,
        !           500:     HOLE_EDGE,
        !           501:     FLOOD_WATER_DEEP,
        !           502:     FLOOD_WATER_SHALLOW,
        !           503:     GRASS,
        !           504:     DEAD_GRASS,
        !           505:     GRAY_FUNGUS,
        !           506:     LUMINESCENT_FUNGUS,
        !           507:     LICHEN,
        !           508:     HAY,
        !           509:     RED_BLOOD,
        !           510:     GREEN_BLOOD,
        !           511:     PURPLE_BLOOD,
        !           512:     ACID_SPLATTER,
        !           513:     VOMIT,
        !           514:     URINE,
        !           515:     UNICORN_POOP,
        !           516:     WORM_BLOOD,
        !           517:     ASH,
        !           518:     BURNED_CARPET,
        !           519:     PUDDLE,
        !           520:     BONES,
        !           521:     RUBBLE,
        !           522:     JUNK,
        !           523:     BROKEN_GLASS,
        !           524:     ECTOPLASM,
        !           525:     EMBERS,
        !           526:     SPIDERWEB,
        !           527:     NETTING,
        !           528:     FOLIAGE,
        !           529:     DEAD_FOLIAGE,
        !           530:     TRAMPLED_FOLIAGE,
        !           531:     FUNGUS_FOREST,
        !           532:     TRAMPLED_FUNGUS_FOREST,
        !           533:     FORCEFIELD,
        !           534:     FORCEFIELD_MELT,
        !           535:     SACRED_GLYPH,
        !           536:     MANACLE_TL,
        !           537:     MANACLE_BR,
        !           538:     MANACLE_TR,
        !           539:     MANACLE_BL,
        !           540:     MANACLE_T,
        !           541:     MANACLE_B,
        !           542:     MANACLE_L,
        !           543:     MANACLE_R,
        !           544:     PORTAL_LIGHT,
        !           545:     GUARDIAN_GLOW,
        !           546:
        !           547:     PLAIN_FIRE,
        !           548:     BRIMSTONE_FIRE,
        !           549:     FLAMEDANCER_FIRE,
        !           550:     GAS_FIRE,
        !           551:     GAS_EXPLOSION,
        !           552:     DART_EXPLOSION,
        !           553:     ITEM_FIRE,
        !           554:     CREATURE_FIRE,
        !           555:
        !           556:     POISON_GAS,
        !           557:     CONFUSION_GAS,
        !           558:     ROT_GAS,
        !           559:     STENCH_SMOKE_GAS,
        !           560:     PARALYSIS_GAS,
        !           561:     METHANE_GAS,
        !           562:     STEAM,
        !           563:     DARKNESS_CLOUD,
        !           564:     HEALING_CLOUD,
        !           565:
        !           566:     BLOODFLOWER_STALK,
        !           567:     BLOODFLOWER_POD,
        !           568:
        !           569:     HAVEN_BEDROLL,
        !           570:
        !           571:     DEEP_WATER_ALGAE_WELL,
        !           572:     DEEP_WATER_ALGAE_1,
        !           573:     DEEP_WATER_ALGAE_2,
        !           574:
        !           575:     ANCIENT_SPIRIT_VINES,
        !           576:     ANCIENT_SPIRIT_GRASS,
        !           577:
        !           578:     AMULET_SWITCH,
        !           579:
        !           580:     COMMUTATION_ALTAR,
        !           581:     COMMUTATION_ALTAR_INERT,
        !           582:     PIPE_GLOWING,
        !           583:     PIPE_INERT,
        !           584:
        !           585:     RESURRECTION_ALTAR,
        !           586:     RESURRECTION_ALTAR_INERT,
        !           587:     MACHINE_TRIGGER_FLOOR_REPEATING,
        !           588:
        !           589:     SACRIFICE_ALTAR_DORMANT,
        !           590:     SACRIFICE_ALTAR,
        !           591:     SACRIFICE_LAVA,
        !           592:     SACRIFICE_CAGE_DORMANT,
        !           593:     DEMONIC_STATUE,
        !           594:
        !           595:     STATUE_INERT_DOORWAY,
        !           596:     STATUE_DORMANT_DOORWAY,
        !           597:
        !           598:     CHASM_WITH_HIDDEN_BRIDGE,
        !           599:     CHASM_WITH_HIDDEN_BRIDGE_ACTIVE,
        !           600:     MACHINE_CHASM_EDGE,
        !           601:
        !           602:     RAT_TRAP_WALL_DORMANT,
        !           603:     RAT_TRAP_WALL_CRACKING,
        !           604:
        !           605:     ELECTRIC_CRYSTAL_OFF,
        !           606:     ELECTRIC_CRYSTAL_ON,
        !           607:     TURRET_LEVER,
        !           608:
        !           609:     WORM_TUNNEL_MARKER_DORMANT,
        !           610:     WORM_TUNNEL_MARKER_ACTIVE,
        !           611:     WORM_TUNNEL_OUTER_WALL,
        !           612:
        !           613:     BRAZIER,
        !           614:
        !           615:     MUD_FLOOR,
        !           616:     MUD_WALL,
        !           617:     MUD_DOORWAY,
        !           618:
        !           619:     NUMBER_TILETYPES,
        !           620: };
        !           621:
        !           622: enum lightType {
        !           623:     NO_LIGHT,
        !           624:     MINERS_LIGHT,
        !           625:     BURNING_CREATURE_LIGHT,
        !           626:     WISP_LIGHT,
        !           627:     SALAMANDER_LIGHT,
        !           628:     IMP_LIGHT,
        !           629:     PIXIE_LIGHT,
        !           630:     LICH_LIGHT,
        !           631:     FLAMEDANCER_LIGHT,
        !           632:     SENTINEL_LIGHT,
        !           633:     UNICORN_LIGHT,
        !           634:     IFRIT_LIGHT,
        !           635:     PHOENIX_LIGHT,
        !           636:     PHOENIX_EGG_LIGHT,
        !           637:     YENDOR_LIGHT,
        !           638:     SPECTRAL_BLADE_LIGHT,
        !           639:     SPECTRAL_IMAGE_LIGHT,
        !           640:     SPARK_TURRET_LIGHT,
        !           641:     EXPLOSIVE_BLOAT_LIGHT,
        !           642:     BOLT_LIGHT_SOURCE,
        !           643:     TELEPATHY_LIGHT,
        !           644:     SACRIFICE_MARK_LIGHT,
        !           645:
        !           646:     SCROLL_PROTECTION_LIGHT,
        !           647:     SCROLL_ENCHANTMENT_LIGHT,
        !           648:     POTION_STRENGTH_LIGHT,
        !           649:     EMPOWERMENT_LIGHT,
        !           650:     GENERIC_FLASH_LIGHT,
        !           651:     FALLEN_TORCH_FLASH_LIGHT,
        !           652:     SUMMONING_FLASH_LIGHT,
        !           653:     EXPLOSION_FLARE_LIGHT,
        !           654:     QUIETUS_FLARE_LIGHT,
        !           655:     SLAYING_FLARE_LIGHT,
        !           656:     CHARGE_FLASH_LIGHT,
        !           657:
        !           658:     TORCH_LIGHT,
        !           659:     LAVA_LIGHT,
        !           660:     SUN_LIGHT,
        !           661:     DARKNESS_PATCH_LIGHT,
        !           662:     FUNGUS_LIGHT,
        !           663:     FUNGUS_FOREST_LIGHT,
        !           664:     LUMINESCENT_ALGAE_BLUE_LIGHT,
        !           665:     LUMINESCENT_ALGAE_GREEN_LIGHT,
        !           666:     ECTOPLASM_LIGHT,
        !           667:     UNICORN_POOP_LIGHT,
        !           668:     EMBER_LIGHT,
        !           669:     FIRE_LIGHT,
        !           670:     BRIMSTONE_FIRE_LIGHT,
        !           671:     EXPLOSION_LIGHT,
        !           672:     INCENDIARY_DART_LIGHT,
        !           673:     PORTAL_ACTIVATE_LIGHT,
        !           674:     CONFUSION_GAS_LIGHT,
        !           675:     DARKNESS_CLOUD_LIGHT,
        !           676:     FORCEFIELD_LIGHT,
        !           677:     CRYSTAL_WALL_LIGHT,
        !           678:     CANDLE_LIGHT,
        !           679:     HAUNTED_TORCH_LIGHT,
        !           680:     GLYPH_LIGHT_DIM,
        !           681:     GLYPH_LIGHT_BRIGHT,
        !           682:     SACRED_GLYPH_LIGHT,
        !           683:     DESCENT_LIGHT,
        !           684:     DEMONIC_STATUE_LIGHT,
        !           685:     NUMBER_LIGHT_KINDS
        !           686: };
        !           687:
        !           688: #define NUMBER_ITEM_CATEGORIES  13
        !           689:
        !           690: // Item categories
        !           691: enum itemCategory {
        !           692:     FOOD                = Fl(0),
        !           693:     WEAPON              = Fl(1),
        !           694:     ARMOR               = Fl(2),
        !           695:     POTION              = Fl(3),
        !           696:     SCROLL              = Fl(4),
        !           697:     STAFF               = Fl(5),
        !           698:     WAND                = Fl(6),
        !           699:     RING                = Fl(7),
        !           700:     CHARM               = Fl(8),
        !           701:     GOLD                = Fl(9),
        !           702:     AMULET              = Fl(10),
        !           703:     GEM                 = Fl(11),
        !           704:     KEY                 = Fl(12),
        !           705:
        !           706:     CAN_BE_DETECTED     = (WEAPON | ARMOR | POTION | SCROLL | RING | CHARM | WAND | STAFF | AMULET),
        !           707:     PRENAMED_CATEGORY   = (FOOD | GOLD | AMULET | GEM | KEY),
        !           708:     NEVER_IDENTIFIABLE  = (FOOD | CHARM | GOLD | AMULET | GEM | KEY),
        !           709:     CAN_BE_SWAPPED      = (WEAPON | ARMOR | STAFF | CHARM | RING),
        !           710:     ALL_ITEMS           = (FOOD|POTION|WEAPON|ARMOR|STAFF|WAND|SCROLL|RING|CHARM|GOLD|AMULET|GEM|KEY),
        !           711: };
        !           712:
        !           713: enum keyKind {
        !           714:     KEY_DOOR,
        !           715:     KEY_CAGE,
        !           716:     KEY_PORTAL,
        !           717:     NUMBER_KEY_TYPES
        !           718: };
        !           719:
        !           720: enum foodKind {
        !           721:     RATION,
        !           722:     FRUIT,
        !           723:     NUMBER_FOOD_KINDS
        !           724: };
        !           725:
        !           726: enum potionKind {
        !           727:     POTION_LIFE,
        !           728:     POTION_STRENGTH,
        !           729:     POTION_TELEPATHY,
        !           730:     POTION_LEVITATION,
        !           731:     POTION_DETECT_MAGIC,
        !           732:     POTION_HASTE_SELF,
        !           733:     POTION_FIRE_IMMUNITY,
        !           734:     POTION_INVISIBILITY,
        !           735:     POTION_POISON,
        !           736:     POTION_PARALYSIS,
        !           737:     POTION_HALLUCINATION,
        !           738:     POTION_CONFUSION,
        !           739:     POTION_INCINERATION,
        !           740:     POTION_DARKNESS,
        !           741:     POTION_DESCENT,
        !           742:     POTION_LICHEN,
        !           743:     NUMBER_POTION_KINDS
        !           744: };
        !           745:
        !           746: enum weaponKind {
        !           747:     DAGGER,
        !           748:     SWORD,
        !           749:     BROADSWORD,
        !           750:
        !           751:     WHIP,
        !           752:     RAPIER,
        !           753:     FLAIL,
        !           754:
        !           755:     MACE,
        !           756:     HAMMER,
        !           757:
        !           758:     SPEAR,
        !           759:     PIKE,
        !           760:
        !           761:     AXE,
        !           762:     WAR_AXE,
        !           763:
        !           764:     DART,
        !           765:     INCENDIARY_DART,
        !           766:     JAVELIN,
        !           767:     NUMBER_WEAPON_KINDS
        !           768: };
        !           769:
        !           770: enum weaponEnchants {
        !           771:     W_SPEED,
        !           772:     W_QUIETUS,
        !           773:     W_PARALYSIS,
        !           774:     W_MULTIPLICITY,
        !           775:     W_SLOWING,
        !           776:     W_CONFUSION,
        !           777:     W_FORCE,
        !           778:     W_SLAYING,
        !           779:     W_MERCY,
        !           780:     NUMBER_GOOD_WEAPON_ENCHANT_KINDS = W_MERCY,
        !           781:     W_PLENTY,
        !           782:     NUMBER_WEAPON_RUNIC_KINDS
        !           783: };
        !           784:
        !           785: enum armorKind {
        !           786:     LEATHER_ARMOR,
        !           787:     SCALE_MAIL,
        !           788:     CHAIN_MAIL,
        !           789:     BANDED_MAIL,
        !           790:     SPLINT_MAIL,
        !           791:     PLATE_MAIL,
        !           792:     NUMBER_ARMOR_KINDS
        !           793: };
        !           794:
        !           795: enum armorEnchants {
        !           796:     A_MULTIPLICITY,
        !           797:     A_MUTUALITY,
        !           798:     A_ABSORPTION,
        !           799:     A_REPRISAL,
        !           800:     A_IMMUNITY,
        !           801:     A_REFLECTION,
        !           802:     A_RESPIRATION,
        !           803:     A_DAMPENING,
        !           804:     A_BURDEN,
        !           805:     NUMBER_GOOD_ARMOR_ENCHANT_KINDS = A_BURDEN,
        !           806:     A_VULNERABILITY,
        !           807:     A_IMMOLATION,
        !           808:     NUMBER_ARMOR_ENCHANT_KINDS,
        !           809: };
        !           810:
        !           811: enum wandKind {
        !           812:     WAND_TELEPORT,
        !           813:     WAND_SLOW,
        !           814:     WAND_POLYMORPH,
        !           815:     WAND_NEGATION,
        !           816:     WAND_DOMINATION,
        !           817:     WAND_BECKONING,
        !           818:     WAND_PLENTY,
        !           819:     WAND_INVISIBILITY,
        !           820:     WAND_EMPOWERMENT,
        !           821:     NUMBER_WAND_KINDS
        !           822: };
        !           823:
        !           824: enum staffKind {
        !           825:     STAFF_LIGHTNING,
        !           826:     STAFF_FIRE,
        !           827:     STAFF_POISON,
        !           828:     STAFF_TUNNELING,
        !           829:     STAFF_BLINKING,
        !           830:     STAFF_ENTRANCEMENT,
        !           831:     STAFF_OBSTRUCTION,
        !           832:     STAFF_DISCORD,
        !           833:     STAFF_CONJURATION,
        !           834:     STAFF_HEALING,
        !           835:     STAFF_HASTE,
        !           836:     STAFF_PROTECTION,
        !           837:     NUMBER_STAFF_KINDS
        !           838: };
        !           839:
        !           840: // these must be wand bolts, in order, and then staff bolts, in order:
        !           841: enum boltType {
        !           842:     BOLT_NONE = 0,
        !           843:     BOLT_TELEPORT,
        !           844:     BOLT_SLOW,
        !           845:     BOLT_POLYMORPH,
        !           846:     BOLT_NEGATION,
        !           847:     BOLT_DOMINATION,
        !           848:     BOLT_BECKONING,
        !           849:     BOLT_PLENTY,
        !           850:     BOLT_INVISIBILITY,
        !           851:     BOLT_EMPOWERMENT,
        !           852:     BOLT_LIGHTNING,
        !           853:     BOLT_FIRE,
        !           854:     BOLT_POISON,
        !           855:     BOLT_TUNNELING,
        !           856:     BOLT_BLINKING,
        !           857:     BOLT_ENTRANCEMENT,
        !           858:     BOLT_OBSTRUCTION,
        !           859:     BOLT_DISCORD,
        !           860:     BOLT_CONJURATION,
        !           861:     BOLT_HEALING,
        !           862:     BOLT_HASTE,
        !           863:     BOLT_SLOW_2,
        !           864:     BOLT_SHIELDING,
        !           865:     BOLT_SPIDERWEB,
        !           866:     BOLT_SPARK,
        !           867:     BOLT_DRAGONFIRE,
        !           868:     BOLT_DISTANCE_ATTACK,
        !           869:     BOLT_POISON_DART,
        !           870:     BOLT_ANCIENT_SPIRIT_VINES,
        !           871:     BOLT_WHIP,
        !           872:     NUMBER_BOLT_KINDS
        !           873: };
        !           874:
        !           875: enum ringKind {
        !           876:     RING_CLAIRVOYANCE,
        !           877:     RING_STEALTH,
        !           878:     RING_REGENERATION,
        !           879:     RING_TRANSFERENCE,
        !           880:     RING_LIGHT,
        !           881:     RING_AWARENESS,
        !           882:     RING_WISDOM,
        !           883:     RING_REAPING,
        !           884:     NUMBER_RING_KINDS
        !           885: };
        !           886:
        !           887: enum charmKind {
        !           888:     CHARM_HEALTH,
        !           889:     CHARM_PROTECTION,
        !           890:     CHARM_HASTE,
        !           891:     CHARM_FIRE_IMMUNITY,
        !           892:     CHARM_INVISIBILITY,
        !           893:     CHARM_TELEPATHY,
        !           894:     CHARM_LEVITATION,
        !           895:     CHARM_SHATTERING,
        !           896:     CHARM_GUARDIAN,
        !           897:     CHARM_TELEPORTATION,
        !           898:     CHARM_RECHARGING,
        !           899:     CHARM_NEGATION,
        !           900:     NUMBER_CHARM_KINDS
        !           901: };
        !           902:
        !           903: enum scrollKind {
        !           904:     SCROLL_ENCHANTING,
        !           905:     SCROLL_IDENTIFY,
        !           906:     SCROLL_TELEPORT,
        !           907:     SCROLL_REMOVE_CURSE,
        !           908:     SCROLL_RECHARGING,
        !           909:     SCROLL_PROTECT_ARMOR,
        !           910:     SCROLL_PROTECT_WEAPON,
        !           911:     SCROLL_SANCTUARY,
        !           912:     SCROLL_MAGIC_MAPPING,
        !           913:     SCROLL_NEGATION,
        !           914:     SCROLL_SHATTERING,
        !           915:     SCROLL_DISCORD,
        !           916:     SCROLL_AGGRAVATE_MONSTER,
        !           917:     SCROLL_SUMMON_MONSTER,
        !           918:     NUMBER_SCROLL_KINDS
        !           919: };
        !           920:
        !           921: #define MAX_PACK_ITEMS              26
        !           922:
        !           923: enum monsterTypes {
        !           924:     MK_YOU,
        !           925:     MK_RAT,
        !           926:     MK_KOBOLD,
        !           927:     MK_JACKAL,
        !           928:     MK_EEL,
        !           929:     MK_MONKEY,
        !           930:     MK_BLOAT,
        !           931:     MK_PIT_BLOAT,
        !           932:     MK_GOBLIN,
        !           933:     MK_GOBLIN_CONJURER,
        !           934:     MK_GOBLIN_MYSTIC,
        !           935:     MK_GOBLIN_TOTEM,
        !           936:     MK_PINK_JELLY,
        !           937:     MK_TOAD,
        !           938:     MK_VAMPIRE_BAT,
        !           939:     MK_ARROW_TURRET,
        !           940:     MK_ACID_MOUND,
        !           941:     MK_CENTIPEDE,
        !           942:     MK_OGRE,
        !           943:     MK_BOG_MONSTER,
        !           944:     MK_OGRE_TOTEM,
        !           945:     MK_SPIDER,
        !           946:     MK_SPARK_TURRET,
        !           947:     MK_WILL_O_THE_WISP,
        !           948:     MK_WRAITH,
        !           949:     MK_ZOMBIE,
        !           950:     MK_TROLL,
        !           951:     MK_OGRE_SHAMAN,
        !           952:     MK_NAGA,
        !           953:     MK_SALAMANDER,
        !           954:     MK_EXPLOSIVE_BLOAT,
        !           955:     MK_DAR_BLADEMASTER,
        !           956:     MK_DAR_PRIESTESS,
        !           957:     MK_DAR_BATTLEMAGE,
        !           958:     MK_ACID_JELLY,
        !           959:     MK_CENTAUR,
        !           960:     MK_UNDERWORM,
        !           961:     MK_SENTINEL,
        !           962:     MK_DART_TURRET,
        !           963:     MK_KRAKEN,
        !           964:     MK_LICH,
        !           965:     MK_PHYLACTERY,
        !           966:     MK_PIXIE,
        !           967:     MK_PHANTOM,
        !           968:     MK_FLAME_TURRET,
        !           969:     MK_IMP,
        !           970:     MK_FURY,
        !           971:     MK_REVENANT,
        !           972:     MK_TENTACLE_HORROR,
        !           973:     MK_GOLEM,
        !           974:     MK_DRAGON,
        !           975:
        !           976:     MK_GOBLIN_CHIEFTAN,
        !           977:     MK_BLACK_JELLY,
        !           978:     MK_VAMPIRE,
        !           979:     MK_FLAMEDANCER,
        !           980:
        !           981:     MK_SPECTRAL_BLADE,
        !           982:     MK_SPECTRAL_IMAGE,
        !           983:     MK_GUARDIAN,
        !           984:     MK_WINGED_GUARDIAN,
        !           985:     MK_CHARM_GUARDIAN,
        !           986:     MK_WARDEN_OF_YENDOR,
        !           987:     MK_ELDRITCH_TOTEM,
        !           988:     MK_MIRRORED_TOTEM,
        !           989:
        !           990:     MK_UNICORN,
        !           991:     MK_IFRIT,
        !           992:     MK_PHOENIX,
        !           993:     MK_PHOENIX_EGG,
        !           994:     MK_ANCIENT_SPIRIT,
        !           995:
        !           996:     NUMBER_MONSTER_KINDS
        !           997: };
        !           998:
        !           999: #define NUMBER_MUTATORS             8
        !          1000:
        !          1001: #define NUMBER_HORDES               177
        !          1002:
        !          1003: #define MONSTER_CLASS_COUNT         15
        !          1004:
        !          1005: // flavors
        !          1006:
        !          1007: #define NUMBER_ITEM_COLORS          21
        !          1008: #define NUMBER_TITLE_PHONEMES       21
        !          1009: #define NUMBER_ITEM_WOODS           21
        !          1010: #define NUMBER_POTION_DESCRIPTIONS  18
        !          1011: #define NUMBER_ITEM_METALS          12
        !          1012: #define NUMBER_ITEM_GEMS            18
        !          1013:
        !          1014: // Dungeon flags
        !          1015: enum tileFlags {
        !          1016:     DISCOVERED                  = Fl(0),
        !          1017:     VISIBLE                     = Fl(1),    // cell has sufficient light and is in field of view, ready to draw.
        !          1018:     HAS_PLAYER                  = Fl(2),
        !          1019:     HAS_MONSTER                 = Fl(3),
        !          1020:     HAS_DORMANT_MONSTER         = Fl(4),    // hidden monster on the square
        !          1021:     HAS_ITEM                    = Fl(5),
        !          1022:     IN_FIELD_OF_VIEW            = Fl(6),    // player has unobstructed line of sight whether or not there is enough light
        !          1023:     WAS_VISIBLE                 = Fl(7),
        !          1024:     HAS_STAIRS                  = Fl(8),
        !          1025:     SEARCHED_FROM_HERE          = Fl(9),    // player already auto-searched here; can't auto-search here again
        !          1026:     IS_IN_SHADOW                = Fl(10),   // so that a player gains an automatic stealth bonus
        !          1027:     MAGIC_MAPPED                = Fl(11),
        !          1028:     ITEM_DETECTED               = Fl(12),
        !          1029:     CLAIRVOYANT_VISIBLE         = Fl(13),
        !          1030:     WAS_CLAIRVOYANT_VISIBLE     = Fl(14),
        !          1031:     CLAIRVOYANT_DARKENED        = Fl(15),   // magical blindness from a cursed ring of clairvoyance
        !          1032:     CAUGHT_FIRE_THIS_TURN       = Fl(16),   // so that fire does not spread asymmetrically
        !          1033:     PRESSURE_PLATE_DEPRESSED    = Fl(17),   // so that traps do not trigger repeatedly while you stand on them
        !          1034:     STABLE_MEMORY               = Fl(18),   // redraws will be pulled from the memory array, not recalculated
        !          1035:     KNOWN_TO_BE_TRAP_FREE       = Fl(19),   // keep track of where the player has stepped or watched monsters step as he knows no traps are there
        !          1036:     IS_IN_PATH                  = Fl(20),   // the yellow trail leading to the cursor
        !          1037:     IN_LOOP                     = Fl(21),   // this cell is part of a terrain loop
        !          1038:     IS_CHOKEPOINT               = Fl(22),   // if this cell is blocked, part of the map will be rendered inaccessible
        !          1039:     IS_GATE_SITE                = Fl(23),   // consider placing a locked door here
        !          1040:     IS_IN_ROOM_MACHINE          = Fl(24),
        !          1041:     IS_IN_AREA_MACHINE          = Fl(25),
        !          1042:     IS_POWERED                  = Fl(26),   // has been activated by machine power this turn (flag can probably be eliminated if needed)
        !          1043:     IMPREGNABLE                 = Fl(27),   // no tunneling allowed!
        !          1044:     TERRAIN_COLORS_DANCING      = Fl(28),   // colors here will sparkle when the game is idle
        !          1045:     TELEPATHIC_VISIBLE          = Fl(29),   // potions of telepathy let you see through other creatures' eyes
        !          1046:     WAS_TELEPATHIC_VISIBLE      = Fl(30),   // potions of telepathy let you see through other creatures' eyes
        !          1047:
        !          1048:     IS_IN_MACHINE               = (IS_IN_ROOM_MACHINE | IS_IN_AREA_MACHINE),    // sacred ground; don't generate items here, or teleport randomly to it
        !          1049:
        !          1050:     PERMANENT_TILE_FLAGS = (DISCOVERED | MAGIC_MAPPED | ITEM_DETECTED | HAS_ITEM | HAS_DORMANT_MONSTER
        !          1051:                             | HAS_MONSTER | HAS_STAIRS | SEARCHED_FROM_HERE | PRESSURE_PLATE_DEPRESSED
        !          1052:                             | STABLE_MEMORY | KNOWN_TO_BE_TRAP_FREE | IN_LOOP
        !          1053:                             | IS_CHOKEPOINT | IS_GATE_SITE | IS_IN_MACHINE | IMPREGNABLE),
        !          1054:
        !          1055:     ANY_KIND_OF_VISIBLE         = (VISIBLE | CLAIRVOYANT_VISIBLE | TELEPATHIC_VISIBLE),
        !          1056: };
        !          1057:
        !          1058: #define TURNS_FOR_FULL_REGEN                300
        !          1059: #define STOMACH_SIZE                        2150
        !          1060: #define HUNGER_THRESHOLD                    (STOMACH_SIZE - 1800)
        !          1061: #define WEAK_THRESHOLD                      150
        !          1062: #define FAINT_THRESHOLD                     50
        !          1063: #define MAX_EXP_LEVEL                       20
        !          1064: #define MAX_EXP                             100000000L
        !          1065:
        !          1066: #define XPXP_NEEDED_FOR_TELEPATHIC_BOND     1400 // XPXP required to enable telepathic awareness with the ally
        !          1067:
        !          1068: #define ROOM_MIN_WIDTH                      4
        !          1069: #define ROOM_MAX_WIDTH                      20
        !          1070: #define ROOM_MIN_HEIGHT                     3
        !          1071: #define ROOM_MAX_HEIGHT                     7
        !          1072: #define HORIZONTAL_CORRIDOR_MIN_LENGTH      5
        !          1073: #define HORIZONTAL_CORRIDOR_MAX_LENGTH      15
        !          1074: #define VERTICAL_CORRIDOR_MIN_LENGTH        2
        !          1075: #define VERTICAL_CORRIDOR_MAX_LENGTH        9
        !          1076: #define CROSS_ROOM_MIN_WIDTH                3
        !          1077: #define CROSS_ROOM_MAX_WIDTH                12
        !          1078: #define CROSS_ROOM_MIN_HEIGHT               2
        !          1079: #define CROSS_ROOM_MAX_HEIGHT               5
        !          1080: #define MIN_SCALED_ROOM_DIMENSION           2
        !          1081:
        !          1082: #define ROOM_TYPE_COUNT                     8
        !          1083:
        !          1084: #define CORRIDOR_WIDTH                      1
        !          1085:
        !          1086: #define WAYPOINT_SIGHT_RADIUS               10
        !          1087: #define MAX_WAYPOINT_COUNT                  40
        !          1088:
        !          1089: #define MAX_ITEMS_IN_MONSTER_ITEMS_HOPPER   100
        !          1090:
        !          1091: // Making these larger means cave generation will take more trials; set them too high and the program will hang.
        !          1092: #define CAVE_MIN_WIDTH                      50
        !          1093: #define CAVE_MIN_HEIGHT                     20
        !          1094:
        !          1095: // Keyboard commands:
        !          1096: #define UP_KEY              'k'
        !          1097: #define DOWN_KEY            'j'
        !          1098: #define LEFT_KEY            'h'
        !          1099: #define RIGHT_KEY           'l'
        !          1100: #define UP_ARROW            63232
        !          1101: #define LEFT_ARROW          63234
        !          1102: #define DOWN_ARROW          63233
        !          1103: #define RIGHT_ARROW         63235
        !          1104: #define UPLEFT_KEY          'y'
        !          1105: #define UPRIGHT_KEY         'u'
        !          1106: #define DOWNLEFT_KEY        'b'
        !          1107: #define DOWNRIGHT_KEY       'n'
        !          1108: #define DESCEND_KEY         '>'
        !          1109: #define ASCEND_KEY          '<'
        !          1110: #define REST_KEY            'z'
        !          1111: #define AUTO_REST_KEY       'Z'
        !          1112: #define SEARCH_KEY          's'
        !          1113: #define INVENTORY_KEY       'i'
        !          1114: #define ACKNOWLEDGE_KEY     ' '
        !          1115: #define EQUIP_KEY           'e'
        !          1116: #define UNEQUIP_KEY         'r'
        !          1117: #define APPLY_KEY           'a'
        !          1118: #define THROW_KEY           't'
        !          1119: #define RETHROW_KEY         'T'
        !          1120: #define RELABEL_KEY         'R'
        !          1121: #define TRUE_COLORS_KEY     '\\'
        !          1122: #define AGGRO_DISPLAY_KEY   ']'
        !          1123: #define DROP_KEY            'd'
        !          1124: #define CALL_KEY            'c'
        !          1125: #define QUIT_KEY            'Q'
        !          1126: #define MESSAGE_ARCHIVE_KEY 'M'
        !          1127: #define BROGUE_HELP_KEY     '?'
        !          1128: #define DISCOVERIES_KEY     'D'
        !          1129: #define EXPLORE_KEY         'x'
        !          1130: #define AUTOPLAY_KEY        'A'
        !          1131: #define SEED_KEY            '~'
        !          1132: #define EASY_MODE_KEY       '&'
        !          1133: #define ESCAPE_KEY          '\033'
        !          1134: #define RETURN_KEY          '\012'
        !          1135: #define DELETE_KEY          '\177'
        !          1136: #define TAB_KEY             '\t'
        !          1137: #define SHIFT_TAB_KEY       25 // Cocoa reports shift-tab this way for some reason.
        !          1138: #define PERIOD_KEY          '.'
        !          1139: #define VIEW_RECORDING_KEY  'V'
        !          1140: #define LOAD_SAVED_GAME_KEY 'O'
        !          1141: #define SAVE_GAME_KEY       'S'
        !          1142: #define NEW_GAME_KEY        'N'
        !          1143: #define GRAPHICS_KEY        'G'
        !          1144: #define SWITCH_TO_PLAYING_KEY 'P'
        !          1145: #define NUMPAD_0            48
        !          1146: #define NUMPAD_1            49
        !          1147: #define NUMPAD_2            50
        !          1148: #define NUMPAD_3            51
        !          1149: #define NUMPAD_4            52
        !          1150: #define NUMPAD_5            53
        !          1151: #define NUMPAD_6            54
        !          1152: #define NUMPAD_7            55
        !          1153: #define NUMPAD_8            56
        !          1154: #define NUMPAD_9            57
        !          1155: #define PAGE_UP_KEY         63276
        !          1156: #define PAGE_DOWN_KEY       63277
        !          1157: #define PRINTSCREEN_KEY     '\054'
        !          1158:
        !          1159: #define UNKNOWN_KEY         (128+19)
        !          1160:
        !          1161: #define min(x, y)       (((x) < (y)) ? (x) : (y))
        !          1162: #define max(x, y)       (((x) > (y)) ? (x) : (y))
        !          1163: #define clamp(x, low, hi)   (min(hi, max(x, low))) // pins x to the [y, z] interval
        !          1164:
        !          1165: #define terrainFlags(x, y)                  (tileCatalog[pmap[x][y].layers[DUNGEON]].flags \
        !          1166:                                             | tileCatalog[pmap[x][y].layers[LIQUID]].flags \
        !          1167:                                             | tileCatalog[pmap[x][y].layers[SURFACE]].flags \
        !          1168:                                             | tileCatalog[pmap[x][y].layers[GAS]].flags)
        !          1169:
        !          1170: #define terrainMechFlags(x, y)              (tileCatalog[pmap[x][y].layers[DUNGEON]].mechFlags \
        !          1171:                                             | tileCatalog[pmap[x][y].layers[LIQUID]].mechFlags \
        !          1172:                                             | tileCatalog[pmap[x][y].layers[SURFACE]].mechFlags \
        !          1173:                                             | tileCatalog[pmap[x][y].layers[GAS]].mechFlags)
        !          1174:
        !          1175: #ifdef BROGUE_ASSERTS
        !          1176: boolean cellHasTerrainFlag(short x, short y, unsigned long flagMask);
        !          1177: #else
        !          1178: #define cellHasTerrainFlag(x, y, flagMask)  ((flagMask) & terrainFlags((x), (y)) ? true : false)
        !          1179: #endif
        !          1180: #define cellHasTMFlag(x, y, flagMask)       ((flagMask) & terrainMechFlags((x), (y)) ? true : false)
        !          1181:
        !          1182: #define cellHasTerrainType(x, y, terrain)   ((pmap[x][y].layers[DUNGEON] == (terrain) \
        !          1183:                                             || pmap[x][y].layers[LIQUID] == (terrain) \
        !          1184:                                             || pmap[x][y].layers[SURFACE] == (terrain) \
        !          1185:                                             || pmap[x][y].layers[GAS] == (terrain)) ? true : false)
        !          1186:
        !          1187: #define cellHasKnownTerrainFlag(x, y, flagMask) ((flagMask) & pmap[(x)][(y)].rememberedTerrainFlags ? true : false)
        !          1188:
        !          1189: #define cellIsPassableOrDoor(x, y)          (!cellHasTerrainFlag((x), (y), T_PATHING_BLOCKER) \
        !          1190:                                             || (cellHasTMFlag((x), (y), (TM_IS_SECRET | TM_PROMOTES_WITH_KEY | TM_CONNECTS_LEVEL)) \
        !          1191:                                                 && cellHasTerrainFlag((x), (y), T_OBSTRUCTS_PASSABILITY)))
        !          1192:
        !          1193: #define coordinatesAreInMap(x, y)           ((x) >= 0 && (x) < DCOLS    && (y) >= 0 && (y) < DROWS)
        !          1194: #define coordinatesAreInWindow(x, y)        ((x) >= 0 && (x) < COLS     && (y) >= 0 && (y) < ROWS)
        !          1195: #define mapToWindowX(x)                     ((x) + STAT_BAR_WIDTH + 1)
        !          1196: #define mapToWindowY(y)                     ((y) + MESSAGE_LINES)
        !          1197: #define windowToMapX(x)                     ((x) - STAT_BAR_WIDTH - 1)
        !          1198: #define windowToMapY(y)                     ((y) - MESSAGE_LINES)
        !          1199:
        !          1200: #define playerCanDirectlySee(x, y)          (pmap[x][y].flags & VISIBLE)
        !          1201: #define playerCanSee(x, y)                  (pmap[x][y].flags & ANY_KIND_OF_VISIBLE)
        !          1202: #define playerCanSeeOrSense(x, y)           ((pmap[x][y].flags & ANY_KIND_OF_VISIBLE) \
        !          1203:                                             || (rogue.playbackOmniscience \
        !          1204:                                                 && (pmap[x][y].layers[DUNGEON] != GRANITE || (pmap[x][y].flags & DISCOVERED))))
        !          1205:
        !          1206: #define CYCLE_MONSTERS_AND_PLAYERS(x)       for ((x) = &player; (x) != NULL; (x) = ((x) == &player ? monsters->nextCreature : (x)->nextCreature))
        !          1207:
        !          1208: #define assureCosmeticRNG                   short oldRNG = rogue.RNG; rogue.RNG = RNG_COSMETIC;
        !          1209: #define restoreRNG                          rogue.RNG = oldRNG;
        !          1210:
        !          1211: #define MIN_COLOR_DIFF          600
        !          1212: // weighted sum of the squares of the component differences. Weights are according to color perception.
        !          1213: #define COLOR_DIFF(f, b)         (((f).red - (b).red) * ((f).red - (b).red) * 0.2126 \
        !          1214: + ((f).green - (b).green) * ((f).green - (b).green) * 0.7152 \
        !          1215: + ((f).blue - (b).blue) * ((f).blue - (b).blue) * 0.0722)
        !          1216:
        !          1217: // structs
        !          1218:
        !          1219: enum dungeonLayers {
        !          1220:     NO_LAYER = -1,
        !          1221:     DUNGEON = 0,        // dungeon-level tile   (e.g. walls)
        !          1222:     LIQUID,             // liquid-level tile    (e.g. lava)
        !          1223:     GAS,                // gas-level tile       (e.g. fire, smoke, swamp gas)
        !          1224:     SURFACE,            // surface-level tile   (e.g. grass)
        !          1225:     NUMBER_TERRAIN_LAYERS
        !          1226: };
        !          1227:
        !          1228: // keeps track of graphics so we only redraw if the cell has changed:
        !          1229: typedef struct cellDisplayBuffer {
        !          1230:     enum displayGlyph character;
        !          1231:     char foreColorComponents[3];
        !          1232:     char backColorComponents[3];
        !          1233:     char opacity;
        !          1234:     boolean needsUpdate;
        !          1235: } cellDisplayBuffer;
        !          1236:
        !          1237: typedef struct pcell {                              // permanent cell; have to remember this stuff to save levels
        !          1238:     enum tileType layers[NUMBER_TERRAIN_LAYERS];    // terrain
        !          1239:     unsigned long flags;                            // non-terrain cell flags
        !          1240:     unsigned short volume;                          // quantity of gas in cell
        !          1241:     unsigned char machineNumber;
        !          1242:     cellDisplayBuffer rememberedAppearance;         // how the player remembers the cell to look
        !          1243:     enum itemCategory rememberedItemCategory;       // what category of item the player remembers lying there
        !          1244:     short rememberedItemKind;                       // what kind of item the player remembers lying there
        !          1245:     short rememberedItemQuantity;                   // how many of the item the player remembers lying there
        !          1246:     short rememberedItemOriginDepth;                // the origin depth of the item the player remembers lying there
        !          1247:     enum tileType rememberedTerrain;                // what the player remembers as the terrain (i.e. highest priority terrain upon last seeing)
        !          1248:     unsigned long rememberedCellFlags;              // map cell flags the player remembers from that spot
        !          1249:     unsigned long rememberedTerrainFlags;           // terrain flags the player remembers from that spot
        !          1250:     unsigned long rememberedTMFlags;                // TM flags the player remembers from that spot
        !          1251: } pcell;
        !          1252:
        !          1253: typedef struct tcell {          // transient cell; stuff we don't need to remember between levels
        !          1254:     short light[3];             // RGB components of lighting
        !          1255:     short oldLight[3];          // compare with subsequent lighting to determine whether to refresh cell
        !          1256: } tcell;
        !          1257:
        !          1258: typedef struct randomRange {
        !          1259:     short lowerBound;
        !          1260:     short upperBound;
        !          1261:     short clumpFactor;
        !          1262: } randomRange;
        !          1263:
        !          1264: typedef struct color {
        !          1265:     // base RGB components:
        !          1266:     short red;
        !          1267:     short green;
        !          1268:     short blue;
        !          1269:
        !          1270:     // random RGB components to add to base components:
        !          1271:     short redRand;
        !          1272:     short greenRand;
        !          1273:     short blueRand;
        !          1274:
        !          1275:     // random scalar to add to all components:
        !          1276:     short rand;
        !          1277:
        !          1278:     // Flag: this color "dances" with every refresh:
        !          1279:     boolean colorDances;
        !          1280: } color;
        !          1281:
        !          1282: enum itemFlags {
        !          1283:     ITEM_IDENTIFIED         = Fl(0),
        !          1284:     ITEM_EQUIPPED           = Fl(1),
        !          1285:     ITEM_CURSED             = Fl(2),
        !          1286:     ITEM_PROTECTED          = Fl(3),
        !          1287:     // unused               = Fl(4),
        !          1288:     ITEM_RUNIC              = Fl(5),
        !          1289:     ITEM_RUNIC_HINTED       = Fl(6),
        !          1290:     ITEM_RUNIC_IDENTIFIED   = Fl(7),
        !          1291:     ITEM_CAN_BE_IDENTIFIED  = Fl(8),
        !          1292:     ITEM_PREPLACED          = Fl(9),
        !          1293:     ITEM_FLAMMABLE          = Fl(10),
        !          1294:     ITEM_MAGIC_DETECTED     = Fl(11),
        !          1295:     ITEM_MAX_CHARGES_KNOWN  = Fl(12),
        !          1296:     ITEM_IS_KEY             = Fl(13),
        !          1297:
        !          1298:     ITEM_ATTACKS_STAGGER    = Fl(14),   // mace, hammer
        !          1299:     ITEM_ATTACKS_EXTEND     = Fl(15),   // whip
        !          1300:     ITEM_ATTACKS_QUICKLY    = Fl(16),   // rapier
        !          1301:     ITEM_ATTACKS_PENETRATE  = Fl(17),   // spear, pike
        !          1302:     ITEM_ATTACKS_ALL_ADJACENT=Fl(18),   // axe, war axe
        !          1303:     ITEM_LUNGE_ATTACKS      = Fl(19),   // rapier
        !          1304:     ITEM_SNEAK_ATTACK_BONUS = Fl(20),   // dagger
        !          1305:     ITEM_PASS_ATTACKS       = Fl(21),   // flail
        !          1306:
        !          1307:     ITEM_KIND_AUTO_ID       = Fl(22),   // the item type will become known when the item is picked up.
        !          1308:     ITEM_PLAYER_AVOIDS      = Fl(23),   // explore and travel will try to avoid picking the item up
        !          1309: };
        !          1310:
        !          1311: #define KEY_ID_MAXIMUM  20
        !          1312:
        !          1313: typedef struct keyLocationProfile {
        !          1314:     short x;
        !          1315:     short y;
        !          1316:     short machine;
        !          1317:     boolean disposableHere;
        !          1318: } keyLocationProfile;
        !          1319:
        !          1320: typedef struct item {
        !          1321:     unsigned short category;
        !          1322:     short kind;
        !          1323:     unsigned long flags;
        !          1324:     randomRange damage;
        !          1325:     short armor;
        !          1326:     short charges;
        !          1327:     short enchant1;
        !          1328:     short enchant2;
        !          1329:     short timesEnchanted;
        !          1330:     enum monsterTypes vorpalEnemy;
        !          1331:     short strengthRequired;
        !          1332:     unsigned short quiverNumber;
        !          1333:     enum displayGlyph displayChar;
        !          1334:     color *foreColor;
        !          1335:     color *inventoryColor;
        !          1336:     short quantity;
        !          1337:     char inventoryLetter;
        !          1338:     char inscription[DCOLS];
        !          1339:     short xLoc;
        !          1340:     short yLoc;
        !          1341:     keyLocationProfile keyLoc[KEY_ID_MAXIMUM];
        !          1342:     short originDepth;
        !          1343:     struct item *nextItem;
        !          1344: } item;
        !          1345:
        !          1346: typedef struct itemTable {
        !          1347:     char *name;
        !          1348:     char *flavor;
        !          1349:     char callTitle[30];
        !          1350:     short frequency;
        !          1351:     short marketValue;
        !          1352:     short strengthRequired;
        !          1353:     randomRange range;
        !          1354:     boolean identified;
        !          1355:     boolean called;
        !          1356:     char description[1500];
        !          1357: } itemTable;
        !          1358:
        !          1359: enum dungeonFeatureTypes {
        !          1360:     DF_GRANITE_COLUMN = 1,
        !          1361:     DF_CRYSTAL_WALL,
        !          1362:     DF_LUMINESCENT_FUNGUS,
        !          1363:     DF_GRASS,
        !          1364:     DF_DEAD_GRASS,
        !          1365:     DF_BONES,
        !          1366:     DF_RUBBLE,
        !          1367:     DF_FOLIAGE,
        !          1368:     DF_FUNGUS_FOREST,
        !          1369:     DF_DEAD_FOLIAGE,
        !          1370:
        !          1371:     DF_SUNLIGHT,
        !          1372:     DF_DARKNESS,
        !          1373:
        !          1374:     DF_SHOW_DOOR,
        !          1375:     DF_SHOW_POISON_GAS_TRAP,
        !          1376:     DF_SHOW_PARALYSIS_GAS_TRAP,
        !          1377:     DF_SHOW_TRAPDOOR_HALO,
        !          1378:     DF_SHOW_TRAPDOOR,
        !          1379:     DF_SHOW_CONFUSION_GAS_TRAP,
        !          1380:     DF_SHOW_FLAMETHROWER_TRAP,
        !          1381:     DF_SHOW_FLOOD_TRAP,
        !          1382:     DF_SHOW_NET_TRAP,
        !          1383:     DF_SHOW_ALARM_TRAP,
        !          1384:
        !          1385:     DF_RED_BLOOD,
        !          1386:     DF_GREEN_BLOOD,
        !          1387:     DF_PURPLE_BLOOD,
        !          1388:     DF_WORM_BLOOD,
        !          1389:     DF_ACID_BLOOD,
        !          1390:     DF_ASH_BLOOD,
        !          1391:     DF_EMBER_BLOOD,
        !          1392:     DF_ECTOPLASM_BLOOD,
        !          1393:     DF_RUBBLE_BLOOD,
        !          1394:     DF_ROT_GAS_BLOOD,
        !          1395:
        !          1396:     DF_VOMIT,
        !          1397:     DF_BLOAT_DEATH,
        !          1398:     DF_BLOAT_EXPLOSION,
        !          1399:     DF_BLOOD_EXPLOSION,
        !          1400:     DF_FLAMEDANCER_CORONA,
        !          1401:
        !          1402:     DF_MUTATION_EXPLOSION,
        !          1403:     DF_MUTATION_LICHEN,
        !          1404:
        !          1405:     DF_REPEL_CREATURES,
        !          1406:     DF_ROT_GAS_PUFF,
        !          1407:     DF_STEAM_PUFF,
        !          1408:     DF_STEAM_ACCUMULATION,
        !          1409:     DF_METHANE_GAS_PUFF,
        !          1410:     DF_SALAMANDER_FLAME,
        !          1411:     DF_URINE,
        !          1412:     DF_UNICORN_POOP,
        !          1413:     DF_PUDDLE,
        !          1414:     DF_ASH,
        !          1415:     DF_ECTOPLASM_DROPLET,
        !          1416:     DF_FORCEFIELD,
        !          1417:     DF_FORCEFIELD_MELT,
        !          1418:     DF_SACRED_GLYPHS,
        !          1419:     DF_LICHEN_GROW,
        !          1420:     DF_TUNNELIZE,
        !          1421:     DF_SHATTERING_SPELL,
        !          1422:
        !          1423:     // spiderwebs
        !          1424:     DF_WEB_SMALL,
        !          1425:     DF_WEB_LARGE,
        !          1426:
        !          1427:     // ancient spirit
        !          1428:     DF_ANCIENT_SPIRIT_VINES,
        !          1429:     DF_ANCIENT_SPIRIT_GRASS,
        !          1430:
        !          1431:     // foliage
        !          1432:     DF_TRAMPLED_FOLIAGE,
        !          1433:     DF_SMALL_DEAD_GRASS,
        !          1434:     DF_FOLIAGE_REGROW,
        !          1435:     DF_TRAMPLED_FUNGUS_FOREST,
        !          1436:     DF_FUNGUS_FOREST_REGROW,
        !          1437:
        !          1438:     // brimstone
        !          1439:     DF_ACTIVE_BRIMSTONE,
        !          1440:     DF_INERT_BRIMSTONE,
        !          1441:
        !          1442:     // bloodwort
        !          1443:     DF_BLOODFLOWER_PODS_GROW_INITIAL,
        !          1444:     DF_BLOODFLOWER_PODS_GROW,
        !          1445:     DF_BLOODFLOWER_POD_BURST,
        !          1446:
        !          1447:     // dewars
        !          1448:     DF_DEWAR_CAUSTIC,
        !          1449:     DF_DEWAR_CONFUSION,
        !          1450:     DF_DEWAR_PARALYSIS,
        !          1451:     DF_DEWAR_METHANE,
        !          1452:     DF_DEWAR_GLASS,
        !          1453:     DF_CARPET_AREA,
        !          1454:
        !          1455:     // algae
        !          1456:     DF_BUILD_ALGAE_WELL,
        !          1457:     DF_ALGAE_1,
        !          1458:     DF_ALGAE_2,
        !          1459:     DF_ALGAE_REVERT,
        !          1460:
        !          1461:     DF_OPEN_DOOR,
        !          1462:     DF_CLOSED_DOOR,
        !          1463:     DF_OPEN_IRON_DOOR_INERT,
        !          1464:     DF_ITEM_CAGE_OPEN,
        !          1465:     DF_ITEM_CAGE_CLOSE,
        !          1466:     DF_ALTAR_INERT,
        !          1467:     DF_ALTAR_RETRACT,
        !          1468:     DF_PORTAL_ACTIVATE,
        !          1469:     DF_INACTIVE_GLYPH,
        !          1470:     DF_ACTIVE_GLYPH,
        !          1471:     DF_SILENT_GLYPH_GLOW,
        !          1472:     DF_GUARDIAN_STEP,
        !          1473:     DF_MIRROR_TOTEM_STEP,
        !          1474:     DF_GLYPH_CIRCLE,
        !          1475:     DF_REVEAL_LEVER,
        !          1476:     DF_PULL_LEVER,
        !          1477:     DF_CREATE_LEVER,
        !          1478:
        !          1479:     DF_BRIDGE_FALL_PREP,
        !          1480:     DF_BRIDGE_FALL,
        !          1481:
        !          1482:     DF_PLAIN_FIRE,
        !          1483:     DF_GAS_FIRE,
        !          1484:     DF_EXPLOSION_FIRE,
        !          1485:     DF_DART_EXPLOSION,
        !          1486:     DF_BRIMSTONE_FIRE,
        !          1487:     DF_BRIDGE_FIRE,
        !          1488:     DF_FLAMETHROWER,
        !          1489:     DF_EMBERS,
        !          1490:     DF_EMBERS_PATCH,
        !          1491:     DF_OBSIDIAN,
        !          1492:     DF_ITEM_FIRE,
        !          1493:     DF_CREATURE_FIRE,
        !          1494:
        !          1495:     DF_FLOOD,
        !          1496:     DF_FLOOD_2,
        !          1497:     DF_FLOOD_DRAIN,
        !          1498:     DF_HOLE_2,
        !          1499:     DF_HOLE_DRAIN,
        !          1500:
        !          1501:     DF_DEEP_WATER_FREEZE,
        !          1502:     DF_ALGAE_1_FREEZE,
        !          1503:     DF_ALGAE_2_FREEZE,
        !          1504:     DF_DEEP_WATER_MELTING,
        !          1505:     DF_DEEP_WATER_THAW,
        !          1506:     DF_SHALLOW_WATER_FREEZE,
        !          1507:     DF_SHALLOW_WATER_MELTING,
        !          1508:     DF_SHALLOW_WATER_THAW,
        !          1509:
        !          1510:     DF_POISON_GAS_CLOUD,
        !          1511:     DF_CONFUSION_GAS_TRAP_CLOUD,
        !          1512:     DF_NET,
        !          1513:     DF_AGGRAVATE_TRAP,
        !          1514:     DF_METHANE_GAS_ARMAGEDDON,
        !          1515:
        !          1516:     // potions
        !          1517:     DF_POISON_GAS_CLOUD_POTION,
        !          1518:     DF_PARALYSIS_GAS_CLOUD_POTION,
        !          1519:     DF_CONFUSION_GAS_CLOUD_POTION,
        !          1520:     DF_INCINERATION_POTION,
        !          1521:     DF_DARKNESS_POTION,
        !          1522:     DF_HOLE_POTION,
        !          1523:     DF_LICHEN_PLANTED,
        !          1524:
        !          1525:     // other items
        !          1526:     DF_ARMOR_IMMOLATION,
        !          1527:     DF_STAFF_HOLE,
        !          1528:     DF_STAFF_HOLE_EDGE,
        !          1529:
        !          1530:     // commutation altar
        !          1531:     DF_ALTAR_COMMUTE,
        !          1532:     DF_MAGIC_PIPING,
        !          1533:     DF_INERT_PIPE,
        !          1534:
        !          1535:     // resurrection altar
        !          1536:     DF_ALTAR_RESURRECT,
        !          1537:     DF_MACHINE_FLOOR_TRIGGER_REPEATING,
        !          1538:
        !          1539:     // sacrifice altar
        !          1540:     DF_SACRIFICE_ALTAR,
        !          1541:     DF_SACRIFICE_COMPLETE,
        !          1542:     DF_SACRIFICE_CAGE_ACTIVE,
        !          1543:
        !          1544:     // vampire in coffin
        !          1545:     DF_COFFIN_BURSTS,
        !          1546:     DF_COFFIN_BURNS,
        !          1547:     DF_TRIGGER_AREA,
        !          1548:
        !          1549:     // throwing tutorial -- button in chasm
        !          1550:     DF_CAGE_DISAPPEARS,
        !          1551:     DF_MEDIUM_HOLE,
        !          1552:     DF_MEDIUM_LAVA_POND,
        !          1553:     DF_MACHINE_PRESSURE_PLATE_USED,
        !          1554:
        !          1555:     // rat trap
        !          1556:     DF_WALL_CRACK,
        !          1557:
        !          1558:     // wooden barricade at entrance
        !          1559:     DF_WOODEN_BARRICADE_BURN,
        !          1560:
        !          1561:     // wooden barricade around altar, dead grass all around
        !          1562:     DF_SURROUND_WOODEN_BARRICADE,
        !          1563:
        !          1564:     // pools of water that, when triggered, slowly expand to fill the room
        !          1565:     DF_SPREADABLE_WATER,
        !          1566:     DF_SHALLOW_WATER,
        !          1567:     DF_WATER_SPREADS,
        !          1568:     DF_SPREADABLE_WATER_POOL,
        !          1569:     DF_SPREADABLE_DEEP_WATER_POOL,
        !          1570:
        !          1571:     // when triggered, the ground gradually turns into chasm:
        !          1572:     DF_SPREADABLE_COLLAPSE,
        !          1573:     DF_COLLAPSE,
        !          1574:     DF_COLLAPSE_SPREADS,
        !          1575:     DF_ADD_MACHINE_COLLAPSE_EDGE_DORMANT,
        !          1576:
        !          1577:     // when triggered, a bridge appears:
        !          1578:     DF_BRIDGE_ACTIVATE,
        !          1579:     DF_BRIDGE_ACTIVATE_ANNOUNCE,
        !          1580:     DF_BRIDGE_APPEARS,
        !          1581:     DF_ADD_DORMANT_CHASM_HALO,
        !          1582:
        !          1583:     // when triggered, the lava retracts:
        !          1584:     DF_LAVA_RETRACTABLE,
        !          1585:     DF_RETRACTING_LAVA,
        !          1586:     DF_OBSIDIAN_WITH_STEAM,
        !          1587:
        !          1588:     // when triggered, the door seals and caustic gas fills the room
        !          1589:     DF_SHOW_POISON_GAS_VENT,
        !          1590:     DF_POISON_GAS_VENT_OPEN,
        !          1591:     DF_ACTIVATE_PORTCULLIS,
        !          1592:     DF_OPEN_PORTCULLIS,
        !          1593:     DF_VENT_SPEW_POISON_GAS,
        !          1594:
        !          1595:     // when triggered, pilot light ignites and explosive gas fills the room
        !          1596:     DF_SHOW_METHANE_VENT,
        !          1597:     DF_METHANE_VENT_OPEN,
        !          1598:     DF_VENT_SPEW_METHANE,
        !          1599:     DF_PILOT_LIGHT,
        !          1600:
        !          1601:     // paralysis trap: trigger plate with gas vents nearby
        !          1602:     DF_DISCOVER_PARALYSIS_VENT,
        !          1603:     DF_PARALYSIS_VENT_SPEW,
        !          1604:     DF_REVEAL_PARALYSIS_VENT_SILENTLY,
        !          1605:
        !          1606:     // thematic dungeon
        !          1607:     DF_AMBIENT_BLOOD,
        !          1608:
        !          1609:     // statues crack for a few turns and then shatter, revealing the monster inside
        !          1610:     DF_CRACKING_STATUE,
        !          1611:     DF_STATUE_SHATTER,
        !          1612:
        !          1613:     // a turret appears:
        !          1614:     DF_TURRET_EMERGE,
        !          1615:
        !          1616:     // an elaborate worm catacomb opens up
        !          1617:     DF_WORM_TUNNEL_MARKER_DORMANT,
        !          1618:     DF_WORM_TUNNEL_MARKER_ACTIVE,
        !          1619:     DF_GRANITE_CRUMBLES,
        !          1620:     DF_WALL_OPEN,
        !          1621:
        !          1622:     // the room gradually darkens
        !          1623:     DF_DARKENING_FLOOR,
        !          1624:     DF_DARK_FLOOR,
        !          1625:     DF_HAUNTED_TORCH_TRANSITION,
        !          1626:     DF_HAUNTED_TORCH,
        !          1627:
        !          1628:     // bubbles rise from the mud and bog monsters spawn
        !          1629:     DF_MUD_DORMANT,
        !          1630:     DF_MUD_ACTIVATE,
        !          1631:
        !          1632:     // crystals charge when hit by lightning
        !          1633:     DF_ELECTRIC_CRYSTAL_ON,
        !          1634:     DF_TURRET_LEVER,
        !          1635:
        !          1636:     // idyll:
        !          1637:     DF_SHALLOW_WATER_POOL,
        !          1638:     DF_DEEP_WATER_POOL,
        !          1639:
        !          1640:     // swamp:
        !          1641:     DF_SWAMP_WATER,
        !          1642:     DF_SWAMP,
        !          1643:     DF_SWAMP_MUD,
        !          1644:
        !          1645:     // camp:
        !          1646:     DF_HAY,
        !          1647:     DF_JUNK,
        !          1648:
        !          1649:     // remnants:
        !          1650:     DF_REMNANT,
        !          1651:     DF_REMNANT_ASH,
        !          1652:
        !          1653:     // chasm catwalk:
        !          1654:     DF_CHASM_HOLE,
        !          1655:     DF_CATWALK_BRIDGE,
        !          1656:
        !          1657:     // lake catwalk:
        !          1658:     DF_LAKE_CELL,
        !          1659:     DF_LAKE_HALO,
        !          1660:
        !          1661:     // worm den:
        !          1662:     DF_WALL_SHATTER,
        !          1663:
        !          1664:     // monster cages open:
        !          1665:     DF_MONSTER_CAGE_OPENS,
        !          1666:
        !          1667:     // goblin warren:
        !          1668:     DF_STENCH_BURN,
        !          1669:     DF_STENCH_SMOLDER,
        !          1670:
        !          1671:     NUMBER_DUNGEON_FEATURES,
        !          1672: };
        !          1673:
        !          1674: enum dungeonProfileTypes {
        !          1675:     DP_BASIC,
        !          1676:     DP_BASIC_FIRST_ROOM,
        !          1677:
        !          1678:     DP_GOBLIN_WARREN,
        !          1679:     DP_SENTINEL_SANCTUARY,
        !          1680:
        !          1681:     NUMBER_DUNGEON_PROFILES,
        !          1682: };
        !          1683:
        !          1684: typedef struct lightSource {
        !          1685:     const color *lightColor;
        !          1686:     randomRange lightRadius;
        !          1687:     short radialFadeToPercent;
        !          1688:     boolean passThroughCreatures; // generally no, but miner light does
        !          1689: } lightSource;
        !          1690:
        !          1691: typedef struct flare {
        !          1692:     lightSource *light;                 // Flare light
        !          1693:     short coeffChangeAmount;            // The constant amount by which the coefficient changes per frame, e.g. -25 means it gets 25% dimmer per frame.
        !          1694:     short coeffLimit;                   // Flare ends if the coefficient passes this percentage (whether going up or down).
        !          1695:     short xLoc, yLoc;                   // Current flare location.
        !          1696:     long coeff;                         // Current flare coefficient; always starts at 100.
        !          1697:     unsigned long turnNumber;           // So we can eliminate those that fired one or more turns ago.
        !          1698: } flare;
        !          1699:
        !          1700: enum DFFlags {
        !          1701:     DFF_EVACUATE_CREATURES_FIRST    = Fl(0),    // Creatures in the DF area get moved outside of it
        !          1702:     DFF_SUBSEQ_EVERYWHERE           = Fl(1),    // Subsequent DF spawns in every cell that this DF spawns in, instead of only the origin
        !          1703:     DFF_TREAT_AS_BLOCKING           = Fl(2),    // If filling the footprint of this DF with walls would disrupt level connectivity, then abort.
        !          1704:     DFF_PERMIT_BLOCKING             = Fl(3),    // Generate this DF without regard to level connectivity.
        !          1705:     DFF_ACTIVATE_DORMANT_MONSTER    = Fl(4),    // Dormant monsters on this tile will appear -- e.g. when a statue bursts to reveal a monster.
        !          1706:     DFF_CLEAR_OTHER_TERRAIN         = Fl(5),    // Erase other terrain in the footprint of this DF.
        !          1707:     DFF_BLOCKED_BY_OTHER_LAYERS     = Fl(6),    // Will not propagate into a cell if any layer in that cell has a superior priority.
        !          1708:     DFF_SUPERPRIORITY               = Fl(7),    // Will overwrite terrain of a superior priority.
        !          1709:     DFF_AGGRAVATES_MONSTERS         = Fl(8),    // Will act as though an aggravate monster scroll of effectRadius radius had been read at that point.
        !          1710:     DFF_RESURRECT_ALLY              = Fl(9),    // Will bring back to life your most recently deceased ally.
        !          1711: };
        !          1712:
        !          1713: enum boltEffects {
        !          1714:     BE_NONE,
        !          1715:     BE_ATTACK,
        !          1716:     BE_TELEPORT,
        !          1717:     BE_SLOW,
        !          1718:     BE_POLYMORPH,
        !          1719:     BE_NEGATION,
        !          1720:     BE_DOMINATION,
        !          1721:     BE_BECKONING,
        !          1722:     BE_PLENTY,
        !          1723:     BE_INVISIBILITY,
        !          1724:     BE_EMPOWERMENT,
        !          1725:     BE_DAMAGE,
        !          1726:     BE_POISON,
        !          1727:     BE_TUNNELING,
        !          1728:     BE_BLINKING,
        !          1729:     BE_ENTRANCEMENT,
        !          1730:     BE_OBSTRUCTION,
        !          1731:     BE_DISCORD,
        !          1732:     BE_CONJURATION,
        !          1733:     BE_HEALING,
        !          1734:     BE_HASTE,
        !          1735:     BE_SHIELDING,
        !          1736: };
        !          1737:
        !          1738: enum boltFlags {
        !          1739:     BF_PASSES_THRU_CREATURES        = Fl(0),    // Bolt continues through creatures (e.g. lightning and tunneling)
        !          1740:     BF_HALTS_BEFORE_OBSTRUCTION     = Fl(1),    // Bolt takes effect the space before it terminates (e.g. conjuration, obstruction, blinking)
        !          1741:     BF_TARGET_ALLIES                = Fl(2),    // Staffs/wands/creatures that shoot this bolt will auto-target allies.
        !          1742:     BF_TARGET_ENEMIES               = Fl(3),    // Staffs/wands/creatures that shoot this bolt will auto-target enemies.
        !          1743:     BF_FIERY                        = Fl(4),    // Bolt will light flammable terrain on fire as it passes, and will ignite monsters hit.
        !          1744:     BF_NEVER_REFLECTS               = Fl(6),    // Bolt will never reflect (e.g. spiderweb, arrows).
        !          1745:     BF_NOT_LEARNABLE                = Fl(7),    // This technique cannot be absorbed by empowered allies.
        !          1746:     BF_NOT_NEGATABLE                = Fl(8),    // Won't be erased by negation.
        !          1747:     BF_ELECTRIC                     = Fl(9),    // Activates terrain that has TM_PROMOTES_ON_ELECTRICITY
        !          1748:     BF_DISPLAY_CHAR_ALONG_LENGTH    = Fl(10),   // Display the character along the entire length of the bolt instead of just at the front.
        !          1749: };
        !          1750:
        !          1751: typedef struct bolt {
        !          1752:     char name[DCOLS];
        !          1753:     char description[COLS];
        !          1754:     char abilityDescription[COLS*2];
        !          1755:     enum displayGlyph theChar;
        !          1756:     const color *foreColor;
        !          1757:     const color *backColor;
        !          1758:     short boltEffect;
        !          1759:     short magnitude;
        !          1760:     short pathDF;
        !          1761:     short targetDF;
        !          1762:     unsigned long forbiddenMonsterFlags;
        !          1763:     unsigned long flags;
        !          1764: } bolt;
        !          1765:
        !          1766: // Level profiles, affecting what rooms get chosen and how they're connected:
        !          1767: typedef struct dungeonProfile {
        !          1768:     // Room type weights (in the natural dungeon, these are also adjusted based on depth):
        !          1769:     short roomFrequencies[ROOM_TYPE_COUNT];
        !          1770:
        !          1771:     short corridorChance;
        !          1772: } dungeonProfile;
        !          1773:
        !          1774: // Dungeon features, spawned from Architect.c:
        !          1775: typedef struct dungeonFeature {
        !          1776:     // tile info:
        !          1777:     enum tileType tile;
        !          1778:     enum dungeonLayers layer;
        !          1779:
        !          1780:     // spawning pattern:
        !          1781:     short startProbability;
        !          1782:     short probabilityDecrement;
        !          1783:     unsigned long flags;
        !          1784:     char description[DCOLS];
        !          1785:     enum lightType lightFlare;
        !          1786:     const color *flashColor;
        !          1787:     short effectRadius;
        !          1788:     enum tileType propagationTerrain;
        !          1789:     enum dungeonFeatureTypes subsequentDF;
        !          1790:     boolean messageDisplayed;
        !          1791: } dungeonFeature;
        !          1792:
        !          1793: // Terrain types:
        !          1794: typedef struct floorTileType {
        !          1795:     // appearance:
        !          1796:     enum displayGlyph displayChar;
        !          1797:     const color *foreColor;
        !          1798:     const color *backColor;
        !          1799:     short drawPriority;                     // priority (lower number means higher priority); governs drawing as well as tile replacement comparisons.
        !          1800:     char chanceToIgnite;                    // chance to burn if a flame terrain is on one of the four cardinal neighbors
        !          1801:     enum dungeonFeatureTypes fireType;      // spawn this DF when the terrain ignites (or, if it's T_IS_DF_TRAP, when the pressure plate clicks)
        !          1802:     enum dungeonFeatureTypes discoverType;  // spawn this DF when successfully searched if T_IS_SECRET is set
        !          1803:     enum dungeonFeatureTypes promoteType;   // creates this dungeon spawn type when it promotes for some other reason (random promotion or promotion through machine activation)
        !          1804:     short promoteChance;                    // percent chance per turn to spawn the promotion type; will also vanish upon doing so if T_VANISHES_UPON_PROMOTION is set
        !          1805:     short glowLight;                        // if it glows, this is the ID of the light type
        !          1806:     unsigned long flags;
        !          1807:     unsigned long mechFlags;
        !          1808:     char description[COLS];
        !          1809:     char flavorText[COLS];
        !          1810: } floorTileType;
        !          1811:
        !          1812: enum terrainFlagCatalog {
        !          1813:     T_OBSTRUCTS_PASSABILITY         = Fl(0),        // cannot be walked through
        !          1814:     T_OBSTRUCTS_VISION              = Fl(1),        // blocks line of sight
        !          1815:     T_OBSTRUCTS_ITEMS               = Fl(2),        // items can't be on this tile
        !          1816:     T_OBSTRUCTS_SURFACE_EFFECTS     = Fl(3),        // grass, blood, etc. cannot exist on this tile
        !          1817:     T_OBSTRUCTS_GAS                 = Fl(4),        // blocks the permeation of gas
        !          1818:     T_OBSTRUCTS_DIAGONAL_MOVEMENT   = Fl(5),        // can't step diagonally around this tile
        !          1819:     T_SPONTANEOUSLY_IGNITES         = Fl(6),        // monsters avoid unless chasing player or immune to fire
        !          1820:     T_AUTO_DESCENT                  = Fl(7),        // automatically drops creatures down a depth level and does some damage (2d6)
        !          1821:     T_LAVA_INSTA_DEATH              = Fl(8),        // kills any non-levitating non-fire-immune creature instantly
        !          1822:     T_CAUSES_POISON                 = Fl(9),        // any non-levitating creature gets 10 poison
        !          1823:     T_IS_FLAMMABLE                  = Fl(10),       // terrain can catch fire
        !          1824:     T_IS_FIRE                       = Fl(11),       // terrain is a type of fire; ignites neighboring flammable cells
        !          1825:     T_ENTANGLES                     = Fl(12),       // entangles players and monsters like a spiderweb
        !          1826:     T_IS_DEEP_WATER                 = Fl(13),       // steals items 50% of the time and moves them around randomly
        !          1827:     T_CAUSES_DAMAGE                 = Fl(14),       // anything on the tile takes max(1-2, 10%) damage per turn
        !          1828:     T_CAUSES_NAUSEA                 = Fl(15),       // any creature on the tile becomes nauseous
        !          1829:     T_CAUSES_PARALYSIS              = Fl(16),       // anything caught on this tile is paralyzed
        !          1830:     T_CAUSES_CONFUSION              = Fl(17),       // causes creatures on this tile to become confused
        !          1831:     T_CAUSES_HEALING                = Fl(18),       // heals 20% max HP per turn for any player or non-inanimate monsters
        !          1832:     T_IS_DF_TRAP                    = Fl(19),       // spews gas of type specified in fireType when stepped on
        !          1833:     T_CAUSES_EXPLOSIVE_DAMAGE       = Fl(20),       // is an explosion; deals higher of 15-20 or 50% damage instantly, but not again for five turns
        !          1834:     T_SACRED                        = Fl(21),       // monsters that aren't allies of the player will avoid stepping here
        !          1835:
        !          1836:     T_OBSTRUCTS_SCENT               = (T_OBSTRUCTS_PASSABILITY | T_OBSTRUCTS_VISION | T_AUTO_DESCENT | T_LAVA_INSTA_DEATH | T_IS_DEEP_WATER | T_SPONTANEOUSLY_IGNITES),
        !          1837:     T_PATHING_BLOCKER               = (T_OBSTRUCTS_PASSABILITY | T_AUTO_DESCENT | T_IS_DF_TRAP | T_LAVA_INSTA_DEATH | T_IS_DEEP_WATER | T_IS_FIRE | T_SPONTANEOUSLY_IGNITES),
        !          1838:     T_DIVIDES_LEVEL                 = (T_OBSTRUCTS_PASSABILITY | T_AUTO_DESCENT | T_IS_DF_TRAP | T_LAVA_INSTA_DEATH | T_IS_DEEP_WATER),
        !          1839:     T_LAKE_PATHING_BLOCKER          = (T_AUTO_DESCENT | T_LAVA_INSTA_DEATH | T_IS_DEEP_WATER | T_SPONTANEOUSLY_IGNITES),
        !          1840:     T_WAYPOINT_BLOCKER              = (T_OBSTRUCTS_PASSABILITY | T_AUTO_DESCENT | T_IS_DF_TRAP | T_LAVA_INSTA_DEATH | T_IS_DEEP_WATER | T_SPONTANEOUSLY_IGNITES),
        !          1841:     T_MOVES_ITEMS                   = (T_IS_DEEP_WATER | T_LAVA_INSTA_DEATH),
        !          1842:     T_CAN_BE_BRIDGED                = (T_AUTO_DESCENT),
        !          1843:     T_OBSTRUCTS_EVERYTHING          = (T_OBSTRUCTS_PASSABILITY | T_OBSTRUCTS_VISION | T_OBSTRUCTS_ITEMS | T_OBSTRUCTS_GAS | T_OBSTRUCTS_SURFACE_EFFECTS | T_OBSTRUCTS_DIAGONAL_MOVEMENT),
        !          1844:     T_HARMFUL_TERRAIN               = (T_CAUSES_POISON | T_IS_FIRE | T_CAUSES_DAMAGE | T_CAUSES_PARALYSIS | T_CAUSES_CONFUSION | T_CAUSES_EXPLOSIVE_DAMAGE),
        !          1845:     T_RESPIRATION_IMMUNITIES        = (T_CAUSES_DAMAGE | T_CAUSES_CONFUSION | T_CAUSES_PARALYSIS | T_CAUSES_NAUSEA),
        !          1846: };
        !          1847:
        !          1848: enum terrainMechanicalFlagCatalog {
        !          1849:     TM_IS_SECRET                    = Fl(0),        // successful search or being stepped on while visible transforms it into discoverType
        !          1850:     TM_PROMOTES_WITH_KEY            = Fl(1),        // promotes if the key is present on the tile (in your pack, carried by monster, or lying on the ground)
        !          1851:     TM_PROMOTES_WITHOUT_KEY         = Fl(2),        // promotes if the key is NOT present on the tile (in your pack, carried by monster, or lying on the ground)
        !          1852:     TM_PROMOTES_ON_STEP             = Fl(3),        // promotes when a creature, player or item is on the tile (whether or not levitating)
        !          1853:     TM_PROMOTES_ON_ITEM_PICKUP      = Fl(4),        // promotes when an item is lifted from the tile (primarily for altars)
        !          1854:     TM_PROMOTES_ON_PLAYER_ENTRY     = Fl(5),        // promotes when the player enters the tile (whether or not levitating)
        !          1855:     TM_PROMOTES_ON_SACRIFICE_ENTRY  = Fl(6),        // promotes when the sacrifice target enters the tile (whether or not levitating)
        !          1856:     TM_PROMOTES_ON_ELECTRICITY      = Fl(7),        // promotes when hit by a lightning bolt
        !          1857:     TM_ALLOWS_SUBMERGING            = Fl(8),        // allows submersible monsters to submerge in this terrain
        !          1858:     TM_IS_WIRED                     = Fl(9),        // if wired, promotes when powered, and sends power when promoting
        !          1859:     TM_IS_CIRCUIT_BREAKER           = Fl(10),       // prevents power from circulating in its machine
        !          1860:     TM_GAS_DISSIPATES               = Fl(11),       // does not just hang in the air forever
        !          1861:     TM_GAS_DISSIPATES_QUICKLY       = Fl(12),       // dissipates quickly
        !          1862:     TM_EXTINGUISHES_FIRE            = Fl(13),       // extinguishes burning terrain or creatures
        !          1863:     TM_VANISHES_UPON_PROMOTION      = Fl(14),       // vanishes when creating promotion dungeon feature, even if the replacement terrain priority doesn't require it
        !          1864:     TM_REFLECTS_BOLTS               = Fl(15),       // magic bolts reflect off of its surface randomly (similar to pmap flag IMPREGNABLE)
        !          1865:     TM_STAND_IN_TILE                = Fl(16),       // earthbound creatures will be said to stand "in" the tile, not on it
        !          1866:     TM_LIST_IN_SIDEBAR              = Fl(17),       // terrain will be listed in the sidebar with a description of the terrain type
        !          1867:     TM_VISUALLY_DISTINCT            = Fl(18),       // terrain will be color-adjusted if necessary so the character stands out from the background
        !          1868:     TM_BRIGHT_MEMORY                = Fl(19),       // no blue fade when this tile is out of sight
        !          1869:     TM_EXPLOSIVE_PROMOTE            = Fl(20),       // when burned, will promote to promoteType instead of burningType if surrounded by tiles with T_IS_FIRE or TM_EXPLOSIVE_PROMOTE
        !          1870:     TM_CONNECTS_LEVEL               = Fl(21),       // will be treated as passable for purposes of calculating level connectedness, irrespective of other aspects of this terrain layer
        !          1871:     TM_INTERRUPT_EXPLORATION_WHEN_SEEN = Fl(22),    // will generate a message when discovered during exploration to interrupt exploration
        !          1872:     TM_INVERT_WHEN_HIGHLIGHTED      = Fl(23),       // will flip fore and back colors when highlighted with pathing
        !          1873:     TM_SWAP_ENCHANTS_ACTIVATION     = Fl(24),       // in machine, swap item enchantments when two suitable items are on this terrain, and activate the machine when that happens
        !          1874: };
        !          1875:
        !          1876: enum statusEffects {
        !          1877:     STATUS_SEARCHING = 0,
        !          1878:     STATUS_DONNING,
        !          1879:     STATUS_WEAKENED,
        !          1880:     STATUS_TELEPATHIC,
        !          1881:     STATUS_HALLUCINATING,
        !          1882:     STATUS_LEVITATING,
        !          1883:     STATUS_SLOWED,
        !          1884:     STATUS_HASTED,
        !          1885:     STATUS_CONFUSED,
        !          1886:     STATUS_BURNING,
        !          1887:     STATUS_PARALYZED,
        !          1888:     STATUS_POISONED,
        !          1889:     STATUS_STUCK,
        !          1890:     STATUS_NAUSEOUS,
        !          1891:     STATUS_DISCORDANT,
        !          1892:     STATUS_IMMUNE_TO_FIRE,
        !          1893:     STATUS_EXPLOSION_IMMUNITY,
        !          1894:     STATUS_NUTRITION,
        !          1895:     STATUS_ENTERS_LEVEL_IN,
        !          1896:     STATUS_MAGICAL_FEAR,
        !          1897:     STATUS_ENTRANCED,
        !          1898:     STATUS_DARKNESS,
        !          1899:     STATUS_LIFESPAN_REMAINING,
        !          1900:     STATUS_SHIELDED,
        !          1901:     STATUS_INVISIBLE,
        !          1902:     STATUS_AGGRAVATING,
        !          1903:     NUMBER_OF_STATUS_EFFECTS,
        !          1904: };
        !          1905:
        !          1906: enum hordeFlags {
        !          1907:     HORDE_DIES_ON_LEADER_DEATH      = Fl(0),    // if the leader dies, the horde will die instead of electing new leader
        !          1908:     HORDE_IS_SUMMONED               = Fl(1),    // minions summoned when any creature is the same species as the leader and casts summon
        !          1909:     HORDE_SUMMONED_AT_DISTANCE      = Fl(2),    // summons will appear across the level, and will naturally path back to the leader
        !          1910:     HORDE_LEADER_CAPTIVE            = Fl(3),    // the leader is in chains and the followers are guards
        !          1911:     HORDE_NO_PERIODIC_SPAWN         = Fl(4),    // can spawn only when the level begins -- not afterwards
        !          1912:     HORDE_ALLIED_WITH_PLAYER        = Fl(5),
        !          1913:
        !          1914:     HORDE_MACHINE_BOSS              = Fl(6),    // used in machines for a boss challenge
        !          1915:     HORDE_MACHINE_WATER_MONSTER     = Fl(7),    // used in machines where the room floods with shallow water
        !          1916:     HORDE_MACHINE_CAPTIVE           = Fl(8),    // powerful captive monsters without any captors
        !          1917:     HORDE_MACHINE_STATUE            = Fl(9),    // the kinds of monsters that make sense in a statue
        !          1918:     HORDE_MACHINE_TURRET            = Fl(10),   // turrets, for hiding in walls
        !          1919:     HORDE_MACHINE_MUD               = Fl(11),   // bog monsters, for hiding in mud
        !          1920:     HORDE_MACHINE_KENNEL            = Fl(12),   // monsters that can appear in cages in kennels
        !          1921:     HORDE_VAMPIRE_FODDER            = Fl(13),   // monsters that are prone to capture and farming by vampires
        !          1922:     HORDE_MACHINE_LEGENDARY_ALLY    = Fl(14),   // legendary allies
        !          1923:     HORDE_NEVER_OOD                 = Fl(15),   // Horde cannot be generated out of depth
        !          1924:     HORDE_MACHINE_THIEF             = Fl(16),   // monsters that can be generated in the key thief area machines
        !          1925:     HORDE_MACHINE_GOBLIN_WARREN     = Fl(17),   // can spawn in goblin warrens
        !          1926:     HORDE_SACRIFICE_TARGET          = Fl(18),   // can be the target of an assassination challenge; leader will get scary light.
        !          1927:
        !          1928:     HORDE_MACHINE_ONLY              = (HORDE_MACHINE_BOSS | HORDE_MACHINE_WATER_MONSTER
        !          1929:                                        | HORDE_MACHINE_CAPTIVE | HORDE_MACHINE_STATUE
        !          1930:                                        | HORDE_MACHINE_TURRET | HORDE_MACHINE_MUD
        !          1931:                                        | HORDE_MACHINE_KENNEL | HORDE_VAMPIRE_FODDER
        !          1932:                                        | HORDE_MACHINE_LEGENDARY_ALLY | HORDE_MACHINE_THIEF
        !          1933:                                        | HORDE_MACHINE_GOBLIN_WARREN
        !          1934:                                        | HORDE_SACRIFICE_TARGET),
        !          1935: };
        !          1936:
        !          1937: enum monsterBehaviorFlags {
        !          1938:     MONST_INVISIBLE                 = Fl(0),    // monster is invisible
        !          1939:     MONST_INANIMATE                 = Fl(1),    // monster has abbreviated stat bar display and is immune to many things
        !          1940:     MONST_IMMOBILE                  = Fl(2),    // monster won't move or perform melee attacks
        !          1941:     MONST_CARRY_ITEM_100            = Fl(3),    // monster carries an item 100% of the time
        !          1942:     MONST_CARRY_ITEM_25             = Fl(4),    // monster carries an item 25% of the time
        !          1943:     MONST_ALWAYS_HUNTING            = Fl(5),    // monster is never asleep or in wandering mode
        !          1944:     MONST_FLEES_NEAR_DEATH          = Fl(6),    // monster flees when under 25% health and re-engages when over 75%
        !          1945:     MONST_ATTACKABLE_THRU_WALLS     = Fl(7),    // can be attacked when embedded in a wall
        !          1946:     MONST_DEFEND_DEGRADE_WEAPON     = Fl(8),    // hitting the monster damages the weapon
        !          1947:     MONST_IMMUNE_TO_WEAPONS         = Fl(9),    // weapons ineffective
        !          1948:     MONST_FLIES                     = Fl(10),   // permanent levitation
        !          1949:     MONST_FLITS                     = Fl(11),   // moves randomly a third of the time
        !          1950:     MONST_IMMUNE_TO_FIRE            = Fl(12),   // won't burn, won't die in lava
        !          1951:     MONST_CAST_SPELLS_SLOWLY        = Fl(13),   // takes twice the attack duration to cast a spell
        !          1952:     MONST_IMMUNE_TO_WEBS            = Fl(14),   // monster passes freely through webs
        !          1953:     MONST_REFLECT_4                 = Fl(15),   // monster reflects projectiles as though wearing +4 armor of reflection
        !          1954:     MONST_NEVER_SLEEPS              = Fl(16),   // monster is always awake
        !          1955:     MONST_FIERY                     = Fl(17),   // monster carries an aura of flame (but no automatic fire light)
        !          1956:     MONST_INVULNERABLE              = Fl(18),   // monster is immune to absolutely everything
        !          1957:     MONST_IMMUNE_TO_WATER           = Fl(19),   // monster moves at full speed in deep water and (if player) doesn't drop items
        !          1958:     MONST_RESTRICTED_TO_LIQUID      = Fl(20),   // monster can move only on tiles that allow submersion
        !          1959:     MONST_SUBMERGES                 = Fl(21),   // monster can submerge in appropriate terrain
        !          1960:     MONST_MAINTAINS_DISTANCE        = Fl(22),   // monster tries to keep a distance of 3 tiles between it and player
        !          1961:     MONST_WILL_NOT_USE_STAIRS       = Fl(23),   // monster won't chase the player between levels
        !          1962:     MONST_DIES_IF_NEGATED           = Fl(24),   // monster will die if exposed to negation magic
        !          1963:     MONST_MALE                      = Fl(25),   // monster is male (or 50% likely to be male if also has MONST_FEMALE)
        !          1964:     MONST_FEMALE                    = Fl(26),   // monster is female (or 50% likely to be female if also has MONST_MALE)
        !          1965:     MONST_NOT_LISTED_IN_SIDEBAR     = Fl(27),   // monster doesn't show up in the sidebar
        !          1966:     MONST_GETS_TURN_ON_ACTIVATION   = Fl(28),   // monster never gets a turn, except when its machine is activated
        !          1967:     MONST_ALWAYS_USE_ABILITY        = Fl(29),   // monster will never fail to use special ability if eligible (no random factor)
        !          1968:     MONST_NO_POLYMORPH              = Fl(30),   // monster cannot result from a polymorph spell (liches, phoenixes and Warden of Yendor)
        !          1969:
        !          1970:     NEGATABLE_TRAITS                = (MONST_INVISIBLE | MONST_DEFEND_DEGRADE_WEAPON | MONST_IMMUNE_TO_WEAPONS | MONST_FLIES
        !          1971:                                        | MONST_FLITS | MONST_IMMUNE_TO_FIRE | MONST_REFLECT_4 | MONST_FIERY | MONST_MAINTAINS_DISTANCE),
        !          1972:     MONST_TURRET                    = (MONST_IMMUNE_TO_WEBS | MONST_NEVER_SLEEPS | MONST_IMMOBILE | MONST_INANIMATE |
        !          1973:                                        MONST_ATTACKABLE_THRU_WALLS | MONST_WILL_NOT_USE_STAIRS),
        !          1974:     LEARNABLE_BEHAVIORS             = (MONST_INVISIBLE | MONST_FLIES | MONST_IMMUNE_TO_FIRE | MONST_REFLECT_4),
        !          1975:     MONST_NEVER_VORPAL_ENEMY        = (MONST_INANIMATE | MONST_INVULNERABLE | MONST_IMMOBILE | MONST_RESTRICTED_TO_LIQUID | MONST_GETS_TURN_ON_ACTIVATION | MONST_MAINTAINS_DISTANCE),
        !          1976:     MONST_NEVER_MUTATED             = (MONST_INVISIBLE | MONST_INANIMATE | MONST_IMMOBILE | MONST_INVULNERABLE),
        !          1977: };
        !          1978:
        !          1979: enum monsterAbilityFlags {
        !          1980:     MA_HIT_HALLUCINATE              = Fl(0),    // monster can hit to cause hallucinations
        !          1981:     MA_HIT_STEAL_FLEE               = Fl(1),    // monster can steal an item and then run away
        !          1982:     MA_HIT_BURN                     = Fl(2),    // monster can hit to set you on fire
        !          1983:     MA_ENTER_SUMMONS                = Fl(3),    // monster will "become" its summoned leader, reappearing when that leader is defeated
        !          1984:     MA_HIT_DEGRADE_ARMOR            = Fl(4),    // monster damages armor
        !          1985:     MA_CAST_SUMMON                  = Fl(5),    // requires that there be one or more summon hordes with this monster type as the leader
        !          1986:     MA_SEIZES                       = Fl(6),    // monster seizes enemies before attacking
        !          1987:     MA_POISONS                      = Fl(7),    // monster's damage is dealt in the form of poison
        !          1988:     MA_DF_ON_DEATH                  = Fl(8),    // monster spawns its DF when it dies
        !          1989:     MA_CLONE_SELF_ON_DEFEND         = Fl(9),    // monster splits in two when struck
        !          1990:     MA_KAMIKAZE                     = Fl(10),   // monster dies instead of attacking
        !          1991:     MA_TRANSFERENCE                 = Fl(11),   // monster recovers 40 or 90% of the damage that it inflicts as health
        !          1992:     MA_CAUSES_WEAKNESS              = Fl(12),   // monster attacks cause weakness status in target
        !          1993:     MA_ATTACKS_PENETRATE            = Fl(13),   // monster attacks all adjacent enemies, like an axe
        !          1994:     MA_ATTACKS_ALL_ADJACENT         = Fl(14),   // monster attacks penetrate one layer of enemies, like a spear
        !          1995:     MA_ATTACKS_EXTEND               = Fl(15),   // monster attacks from a distance in a cardinal direction, like a whip
        !          1996:     MA_ATTACKS_STAGGER              = Fl(16),   // monster attacks will push the player backward by one space if there is room
        !          1997:     MA_AVOID_CORRIDORS              = Fl(17),   // monster will avoid corridors when hunting
        !          1998:
        !          1999:     SPECIAL_HIT                     = (MA_HIT_HALLUCINATE | MA_HIT_STEAL_FLEE | MA_HIT_DEGRADE_ARMOR | MA_POISONS
        !          2000:                                        | MA_TRANSFERENCE | MA_CAUSES_WEAKNESS | MA_HIT_BURN | MA_ATTACKS_STAGGER),
        !          2001:     LEARNABLE_ABILITIES             = (MA_TRANSFERENCE | MA_CAUSES_WEAKNESS),
        !          2002:
        !          2003:     MA_NON_NEGATABLE_ABILITIES      = (MA_ATTACKS_PENETRATE | MA_ATTACKS_ALL_ADJACENT | MA_ATTACKS_EXTEND | MA_ATTACKS_STAGGER),
        !          2004:     MA_NEVER_VORPAL_ENEMY           = (MA_KAMIKAZE),
        !          2005:     MA_NEVER_MUTATED                = (MA_KAMIKAZE),
        !          2006: };
        !          2007:
        !          2008: enum monsterBookkeepingFlags {
        !          2009:     MB_WAS_VISIBLE              = Fl(0),    // monster was visible to player last turn
        !          2010:     MB_TELEPATHICALLY_REVEALED  = Fl(1),    // player can magically see monster and adjacent cells
        !          2011:     MB_PREPLACED                = Fl(2),    // monster dropped onto the level and requires post-processing
        !          2012:     MB_APPROACHING_UPSTAIRS     = Fl(3),    // following the player up the stairs
        !          2013:     MB_APPROACHING_DOWNSTAIRS   = Fl(4),    // following the player down the stairs
        !          2014:     MB_APPROACHING_PIT          = Fl(5),    // following the player down a pit
        !          2015:     MB_LEADER                   = Fl(6),    // monster is the leader of a horde
        !          2016:     MB_FOLLOWER                 = Fl(7),    // monster is a member of a horde
        !          2017:     MB_CAPTIVE                  = Fl(8),    // monster is all tied up
        !          2018:     MB_SEIZED                   = Fl(9),    // monster is being held
        !          2019:     MB_SEIZING                  = Fl(10),   // monster is holding another creature immobile
        !          2020:     MB_SUBMERGED                = Fl(11),   // monster is currently submerged and hence invisible until it attacks
        !          2021:     MB_JUST_SUMMONED            = Fl(12),   // used to mark summons so they can be post-processed
        !          2022:     MB_WILL_FLASH               = Fl(13),   // this monster will flash as soon as control is returned to the player
        !          2023:     MB_BOUND_TO_LEADER          = Fl(14),   // monster will die if the leader dies or becomes separated from the leader
        !          2024:     MB_MARKED_FOR_SACRIFICE     = Fl(15),   // scary glow, monster can be sacrificed in the appropriate machine
        !          2025:     MB_ABSORBING                = Fl(16),   // currently learning a skill by absorbing an enemy corpse
        !          2026:     MB_DOES_NOT_TRACK_LEADER    = Fl(17),   // monster will not follow its leader around
        !          2027:     MB_IS_FALLING               = Fl(18),   // monster is plunging downward at the end of the turn
        !          2028:     MB_IS_DYING                 = Fl(19),   // monster has already been killed and is awaiting the end-of-turn graveyard sweep (or in purgatory)
        !          2029:     MB_GIVEN_UP_ON_SCENT        = Fl(20),   // to help the monster remember that the scent map is a dead end
        !          2030:     MB_IS_DORMANT               = Fl(21),   // lurking, waiting to burst out
        !          2031:     MB_HAS_SOUL                 = Fl(22),   // slaying the monster will count toward weapon auto-ID
        !          2032:     MB_ALREADY_SEEN             = Fl(23),   // seeing this monster won't interrupt exploration
        !          2033:     MB_HAS_ENTRANCED_MOVED      = Fl(24)    // has already moved while entranced and should not move again
        !          2034: };
        !          2035:
        !          2036: // Defines all creatures, which include monsters and the player:
        !          2037: typedef struct creatureType {
        !          2038:     enum monsterTypes monsterID; // index number for the monsterCatalog
        !          2039:     char monsterName[COLS];
        !          2040:     enum displayGlyph displayChar;
        !          2041:     const color *foreColor;
        !          2042:     short maxHP;
        !          2043:     short defense;
        !          2044:     short accuracy;
        !          2045:     randomRange damage;
        !          2046:     long turnsBetweenRegen;     // turns to wait before regaining 1 HP
        !          2047:     short movementSpeed;
        !          2048:     short attackSpeed;
        !          2049:     enum dungeonFeatureTypes bloodType;
        !          2050:     enum lightType intrinsicLightType;
        !          2051:     boolean isLarge;    // used for size of psychic emanation
        !          2052:     short DFChance;                     // percent chance to spawn the dungeon feature per awake turn
        !          2053:     enum dungeonFeatureTypes DFType;    // kind of dungeon feature
        !          2054:     enum boltType bolts[20];
        !          2055:     unsigned long flags;
        !          2056:     unsigned long abilityFlags;
        !          2057: } creatureType;
        !          2058:
        !          2059: typedef struct monsterWords {
        !          2060:     char flavorText[COLS*5];
        !          2061:     char absorbing[40];
        !          2062:     char absorbStatus[40];
        !          2063:     char attack[5][30];
        !          2064:     char DFMessage[DCOLS * 2];
        !          2065:     char summonMessage[DCOLS * 2];
        !          2066: } monsterWords;
        !          2067:
        !          2068: enum creatureStates {
        !          2069:     MONSTER_SLEEPING,
        !          2070:     MONSTER_TRACKING_SCENT,
        !          2071:     MONSTER_WANDERING,
        !          2072:     MONSTER_FLEEING,
        !          2073:     MONSTER_ALLY,
        !          2074: };
        !          2075:
        !          2076: enum creatureModes {
        !          2077:     MODE_NORMAL,
        !          2078:     MODE_PERM_FLEEING
        !          2079: };
        !          2080:
        !          2081: typedef struct mutation {
        !          2082:     char title[100];
        !          2083:     const color *textColor;
        !          2084:     short healthFactor;
        !          2085:     short moveSpeedFactor;
        !          2086:     short attackSpeedFactor;
        !          2087:     short defenseFactor;
        !          2088:     short damageFactor;
        !          2089:     short DFChance;
        !          2090:     enum dungeonFeatureTypes DFType;
        !          2091:     enum lightType light;
        !          2092:     unsigned long monsterFlags;
        !          2093:     unsigned long monsterAbilityFlags;
        !          2094:     unsigned long forbiddenFlags;
        !          2095:     unsigned long forbiddenAbilityFlags;
        !          2096:     char description[1000];
        !          2097:     boolean canBeNegated;
        !          2098: } mutation;
        !          2099:
        !          2100: typedef struct hordeType {
        !          2101:     enum monsterTypes leaderType;
        !          2102:
        !          2103:     // membership information
        !          2104:     short numberOfMemberTypes;
        !          2105:     enum monsterTypes memberType[5];
        !          2106:     randomRange memberCount[5];
        !          2107:
        !          2108:     // spawning information
        !          2109:     short minLevel;
        !          2110:     short maxLevel;
        !          2111:     short frequency;
        !          2112:     enum tileType spawnsIn;
        !          2113:     short machine;
        !          2114:
        !          2115:     enum hordeFlags flags;
        !          2116: } hordeType;
        !          2117:
        !          2118: typedef struct monsterClass {
        !          2119:     char name[30];
        !          2120:     short frequency;
        !          2121:     short maxDepth;
        !          2122:     enum monsterTypes memberList[15];
        !          2123: } monsterClass;
        !          2124:
        !          2125: typedef struct creature {
        !          2126:     creatureType info;
        !          2127:     short xLoc;
        !          2128:     short yLoc;
        !          2129:     short depth;
        !          2130:     short currentHP;
        !          2131:     long turnsUntilRegen;
        !          2132:     short regenPerTurn;                 // number of HP to regenerate every single turn
        !          2133:     short weaknessAmount;               // number of points of weakness that are inflicted by the weakness status
        !          2134:     short poisonAmount;                 // number of points of damage per turn from poison
        !          2135:     enum creatureStates creatureState;  // current behavioral state
        !          2136:     enum creatureModes creatureMode;    // current behavioral mode (higher-level than state)
        !          2137:
        !          2138:     short mutationIndex;                // what mutation the monster has (or -1 for none)
        !          2139:
        !          2140:     // Waypoints:
        !          2141:     short targetWaypointIndex;          // the index number of the waypoint we're pathing toward
        !          2142:     boolean waypointAlreadyVisited[MAX_WAYPOINT_COUNT]; // checklist of waypoints
        !          2143:     short lastSeenPlayerAt[2];          // last location at which the monster hunted the player
        !          2144:
        !          2145:     short targetCorpseLoc[2];           // location of the corpse that the monster is approaching to gain its abilities
        !          2146:     char targetCorpseName[30];          // name of the deceased monster that we're approaching to gain its abilities
        !          2147:     unsigned long absorptionFlags;      // ability/behavior flags that the monster will gain when absorption is complete
        !          2148:     boolean absorbBehavior;             // above flag is behavior instead of ability (ignored if absorptionBolt is set)
        !          2149:     short absorptionBolt;               // bolt index that the monster will learn to cast when absorption is complete
        !          2150:     short corpseAbsorptionCounter;      // used to measure both the time until the monster stops being interested in the corpse,
        !          2151:                                         // and, later, the time until the monster finishes absorbing the corpse.
        !          2152:     short **mapToMe;                    // if a pack leader, this is a periodically updated pathing map to get to the leader
        !          2153:     short **safetyMap;                  // fleeing monsters store their own safety map when out of player FOV to avoid omniscience
        !          2154:     short ticksUntilTurn;               // how long before the creature gets its next move
        !          2155:
        !          2156:     // Locally cached statistics that may be temporarily modified:
        !          2157:     short movementSpeed;
        !          2158:     short attackSpeed;
        !          2159:
        !          2160:     short previousHealthPoints;         // remembers what your health proportion was at the start of the turn
        !          2161:     short turnsSpentStationary;         // how many (subjective) turns it's been since the creature moved between tiles
        !          2162:     short flashStrength;                // monster will flash soon; this indicates the percent strength of flash
        !          2163:     color flashColor;                   // the color that the monster will flash
        !          2164:     short status[NUMBER_OF_STATUS_EFFECTS];
        !          2165:     short maxStatus[NUMBER_OF_STATUS_EFFECTS]; // used to set the max point on the status bars
        !          2166:     unsigned long bookkeepingFlags;
        !          2167:     short spawnDepth;                   // keep track of the depth of the machine to which they relate (for activation monsters)
        !          2168:     short machineHome;                  // monsters that spawn in a machine keep track of the machine number here (for activation monsters)
        !          2169:     short xpxp;                         // exploration experience (used to time telepathic bonding for allies)
        !          2170:     short newPowerCount;                // how many more times this monster can absorb a fallen monster
        !          2171:     short totalPowerCount;              // how many times has the monster been empowered? Used to recover abilities when negated.
        !          2172:
        !          2173:     struct creature *leader;            // only if monster is a follower
        !          2174:     struct creature *carriedMonster;    // when vampires turn into bats, one of the bats restores the vampire when it dies
        !          2175:     struct creature *nextCreature;
        !          2176:     struct item *carriedItem;           // only used for monsters
        !          2177: } creature;
        !          2178:
        !          2179: enum NGCommands {
        !          2180:     NG_NOTHING = 0,
        !          2181:     NG_NEW_GAME,
        !          2182:     NG_NEW_GAME_WITH_SEED,
        !          2183:     NG_OPEN_GAME,
        !          2184:     NG_VIEW_RECORDING,
        !          2185:     NG_HIGH_SCORES,
        !          2186:     NG_QUIT,
        !          2187: };
        !          2188:
        !          2189: enum featTypes {
        !          2190:     FEAT_PURE_MAGE = 0,
        !          2191:     FEAT_PURE_WARRIOR,
        !          2192:     FEAT_PACIFIST,
        !          2193:     FEAT_ARCHIVIST,
        !          2194:     FEAT_COMPANION,
        !          2195:     FEAT_SPECIALIST,
        !          2196:     FEAT_JELLYMANCER,
        !          2197:     FEAT_INDOMITABLE,
        !          2198:     FEAT_MYSTIC,
        !          2199:     FEAT_DRAGONSLAYER,
        !          2200:     FEAT_PALADIN,
        !          2201:
        !          2202:     FEAT_COUNT,
        !          2203: };
        !          2204:
        !          2205: // these are basically global variables pertaining to the game state and player's unique variables:
        !          2206: typedef struct playerCharacter {
        !          2207:     boolean wizard;                     // in wizard mode
        !          2208:
        !          2209:     short depthLevel;                   // which dungeon level are we on
        !          2210:     short deepestLevel;
        !          2211:     boolean disturbed;                  // player should stop auto-acting
        !          2212:     boolean gameInProgress;             // the game is in progress (the player has not died, won or quit yet)
        !          2213:     boolean gameHasEnded;               // stop everything and go to death screen
        !          2214:     boolean highScoreSaved;             // so that it saves the high score only once
        !          2215:     boolean blockCombatText;            // busy auto-fighting
        !          2216:     boolean autoPlayingLevel;           // seriously, don't interrupt
        !          2217:     boolean automationActive;           // cut some corners during redraws to speed things up
        !          2218:     boolean justRested;                 // previous turn was a rest -- used in stealth
        !          2219:     boolean justSearched;               // previous turn was a search -- used in manual searches
        !          2220:     boolean cautiousMode;               // used to prevent careless deaths caused by holding down a key
        !          2221:     boolean receivedLevitationWarning;  // only warn you once when you're hovering dangerously over liquid
        !          2222:     boolean updatedSafetyMapThisTurn;   // so it's updated no more than once per turn
        !          2223:     boolean updatedAllySafetyMapThisTurn;   // so it's updated no more than once per turn
        !          2224:     boolean updatedMapToSafeTerrainThisTurn;// so it's updated no more than once per turn
        !          2225:     boolean updatedMapToShoreThisTurn;      // so it's updated no more than once per turn
        !          2226:     boolean easyMode;                   // enables easy mode
        !          2227:     boolean inWater;                    // helps with the blue water filter effect
        !          2228:     boolean heardCombatThisTurn;        // so you get only one "you hear combat in the distance" per turn
        !          2229:     boolean creaturesWillFlashThisTurn; // there are creatures out there that need to flash before the turn ends
        !          2230:     boolean staleLoopMap;               // recalculate the loop map at the end of the turn
        !          2231:     boolean alreadyFell;                // so the player can fall only one depth per turn
        !          2232:     boolean eligibleToUseStairs;        // so the player uses stairs only when he steps onto them
        !          2233:     boolean trueColorMode;              // whether lighting effects are disabled
        !          2234:     boolean displayAggroRangeMode;      // whether your stealth range is displayed
        !          2235:     boolean quit;                       // to skip the typical end-game theatrics when the player quits
        !          2236:     unsigned long seed;                 // the master seed for generating the entire dungeon
        !          2237:     short RNG;                          // which RNG are we currently using?
        !          2238:     unsigned long gold;                 // how much gold we have
        !          2239:     unsigned long goldGenerated;        // how much gold has been generated on the levels, not counting gold held by monsters
        !          2240:     short strength;
        !          2241:     unsigned short monsterSpawnFuse;    // how much longer till a random monster spawns
        !          2242:
        !          2243:     item *weapon;
        !          2244:     item *armor;
        !          2245:     item *ringLeft;
        !          2246:     item *ringRight;
        !          2247:
        !          2248:     flare **flares;
        !          2249:     short flareCount;
        !          2250:     short flareCapacity;
        !          2251:
        !          2252:     creature *yendorWarden;
        !          2253:
        !          2254:     lightSource minersLight;
        !          2255:     fixpt minersLightRadius;
        !          2256:     short ticksTillUpdateEnvironment;   // so that some periodic things happen in objective time
        !          2257:     unsigned short scentTurnNumber;     // helps make scent-casting work
        !          2258:     unsigned long playerTurnNumber;     // number of input turns in recording. Does not increment during paralysis.
        !          2259:     unsigned long absoluteTurnNumber;   // number of turns since the beginning of time. Always increments.
        !          2260:     signed long milliseconds;           // milliseconds since launch, to decide whether to engage cautious mode
        !          2261:     short xpxpThisTurn;                 // how many squares the player explored this turn
        !          2262:     short aggroRange;                   // distance from which monsters will notice you
        !          2263:
        !          2264:     short previousPoisonPercent;        // and your poison proportion, to display percentage alerts for each.
        !          2265:
        !          2266:     short upLoc[2];                     // upstairs location this level
        !          2267:     short downLoc[2];                   // downstairs location this level
        !          2268:
        !          2269:     short cursorLoc[2];                 // used for the return key functionality
        !          2270:     creature *lastTarget;               // to keep track of the last monster the player has thrown at or zapped
        !          2271:     item *lastItemThrown;
        !          2272:     short rewardRoomsGenerated;         // to meter the number of reward machines
        !          2273:     short machineNumber;                // so each machine on a level gets a unique number
        !          2274:     short sidebarLocationList[ROWS*2][2];   // to keep track of which location each line of the sidebar references
        !          2275:
        !          2276:     // maps
        !          2277:     short **mapToShore;                 // how many steps to get back to shore
        !          2278:     short **mapToSafeTerrain;           // so monsters can get to safety
        !          2279:
        !          2280:     // recording info
        !          2281:     boolean recording;                  // whether we are recording the game
        !          2282:     boolean playbackMode;               // whether we're viewing a recording instead of playing
        !          2283:     unsigned short patchVersion;        // what patch version of the game this was recorded on
        !          2284:     char versionString[16];             // the version string saved into the recording file
        !          2285:     unsigned long currentTurnNumber;    // how many turns have elapsed
        !          2286:     unsigned long howManyTurns;         // how many turns are in this recording
        !          2287:     short howManyDepthChanges;          // how many times the player changes depths
        !          2288:     short playbackDelayPerTurn;         // base playback speed; modified per turn by events
        !          2289:     short playbackDelayThisTurn;        // playback speed as modified
        !          2290:     boolean playbackPaused;
        !          2291:     boolean playbackFastForward;        // for loading saved games and such -- disables drawing and prevents pauses
        !          2292:     boolean playbackOOS;                // playback out of sync -- no unpausing allowed
        !          2293:     boolean playbackOmniscience;        // whether to reveal all the map during playback
        !          2294:     boolean playbackBetweenTurns;       // i.e. waiting for a top-level input -- iff, permit playback commands
        !          2295:     unsigned long nextAnnotationTurn;   // the turn number during which to display the next annotation
        !          2296:     char nextAnnotation[5000];          // the next annotation
        !          2297:     unsigned long locationInAnnotationFile; // how far we've read in the annotations file
        !          2298:
        !          2299:     // metered items
        !          2300:     long long foodSpawned;                    // amount of nutrition units spawned so far this game
        !          2301:     short lifePotionFrequency;
        !          2302:     short lifePotionsSpawned;
        !          2303:     short strengthPotionFrequency;
        !          2304:     short enchantScrollFrequency;
        !          2305:
        !          2306:     // ring bonuses:
        !          2307:     short clairvoyance;
        !          2308:     short stealthBonus;
        !          2309:     short regenerationBonus;
        !          2310:     short lightMultiplier;
        !          2311:     short awarenessBonus;
        !          2312:     short transference;
        !          2313:     short wisdomBonus;
        !          2314:     short reaping;
        !          2315:
        !          2316:     // feats:
        !          2317:     boolean featRecord[FEAT_COUNT];
        !          2318:
        !          2319:     // waypoints:
        !          2320:     short **wpDistance[MAX_WAYPOINT_COUNT];
        !          2321:     short wpCount;
        !          2322:     short wpCoordinates[MAX_WAYPOINT_COUNT][2];
        !          2323:     short wpRefreshTicker;
        !          2324:
        !          2325:     // cursor trail:
        !          2326:     short cursorPathIntensity;
        !          2327:     boolean cursorMode;
        !          2328:
        !          2329:     // What do you want to do, player -- play, play with seed, resume, recording, high scores or quit?
        !          2330:     enum NGCommands nextGame;
        !          2331:     char nextGamePath[BROGUE_FILENAME_MAX];
        !          2332:     unsigned long nextGameSeed;
        !          2333: } playerCharacter;
        !          2334:
        !          2335: // Stores the necessary info about a level so it can be regenerated:
        !          2336: typedef struct levelData {
        !          2337:     boolean visited;
        !          2338:     pcell mapStorage[DCOLS][DROWS];
        !          2339:     struct item *items;
        !          2340:     struct creature *monsters;
        !          2341:     struct creature *dormantMonsters;
        !          2342:     short **scentMap;
        !          2343:     unsigned long levelSeed;
        !          2344:     short upStairsLoc[2];
        !          2345:     short downStairsLoc[2];
        !          2346:     short playerExitedVia[2];
        !          2347:     unsigned long awaySince;
        !          2348: } levelData;
        !          2349:
        !          2350: enum machineFeatureFlags {
        !          2351:     MF_GENERATE_ITEM                = Fl(0),    // feature entails generating an item (overridden if the machine is adopting an item)
        !          2352:     MF_OUTSOURCE_ITEM_TO_MACHINE    = Fl(1),    // item must be adopted by another machine
        !          2353:     MF_BUILD_VESTIBULE              = Fl(2),    // call this at the origin of a door room to create a new door guard machine there
        !          2354:     MF_ADOPT_ITEM                   = Fl(3),    // this feature will take the adopted item (be it from another machine or a previous feature)
        !          2355:     MF_NO_THROWING_WEAPONS          = Fl(4),    // the generated item cannot be a throwing weapon
        !          2356:     MF_GENERATE_HORDE               = Fl(5),    // generate a monster horde that has all of the horde flags
        !          2357:     MF_BUILD_AT_ORIGIN              = Fl(6),    // generate this feature at the room entrance
        !          2358:     // unused                       = Fl(7),    //
        !          2359:     MF_PERMIT_BLOCKING              = Fl(8),    // permit the feature to block the map's passability (e.g. to add a locked door)
        !          2360:     MF_TREAT_AS_BLOCKING            = Fl(9),    // treat this terrain as though it blocks, for purposes of deciding whether it can be placed there
        !          2361:     MF_NEAR_ORIGIN                  = Fl(10),   // feature must spawn in the rough quarter of tiles closest to the origin
        !          2362:     MF_FAR_FROM_ORIGIN              = Fl(11),   // feature must spawn in the rough quarter of tiles farthest from the origin
        !          2363:     MF_MONSTER_TAKE_ITEM            = Fl(12),   // the item associated with this feature (including if adopted) will be in possession of the horde leader that's generated
        !          2364:     MF_MONSTER_SLEEPING             = Fl(13),   // the monsters should be asleep when generated
        !          2365:     MF_MONSTER_FLEEING              = Fl(14),   // the monsters should be permanently fleeing when generated
        !          2366:     MF_EVERYWHERE                   = Fl(15),   // generate the feature on every tile of the machine (e.g. carpeting)
        !          2367:     MF_ALTERNATIVE                  = Fl(16),   // build only one feature that has this flag per machine; the rest are skipped
        !          2368:     MF_ALTERNATIVE_2                = Fl(17),   // same as MF_ALTERNATIVE, but provides for a second set of alternatives of which only one will be chosen
        !          2369:     MF_REQUIRE_GOOD_RUNIC           = Fl(18),   // generated item must be uncursed runic
        !          2370:     MF_MONSTERS_DORMANT             = Fl(19),   // monsters are dormant, and appear when a dungeon feature with DFF_ACTIVATE_DORMANT_MONSTER spawns on their tile
        !          2371:     // unused                       = Fl(20),   //
        !          2372:     MF_BUILD_IN_WALLS               = Fl(21),   // build in an impassable tile that is adjacent to the interior
        !          2373:     MF_BUILD_ANYWHERE_ON_LEVEL      = Fl(22),   // build anywhere on the level that is not inside the machine
        !          2374:     MF_REPEAT_UNTIL_NO_PROGRESS     = Fl(23),   // keep trying to build this feature set until no changes are made
        !          2375:     MF_IMPREGNABLE                  = Fl(24),   // this feature's location will be immune to tunneling
        !          2376:     MF_IN_VIEW_OF_ORIGIN            = Fl(25),   // this feature must be in view of the origin
        !          2377:     MF_IN_PASSABLE_VIEW_OF_ORIGIN   = Fl(26),   // this feature must be in view of the origin, where "view" is blocked by pathing blockers
        !          2378:     MF_NOT_IN_HALLWAY               = Fl(27),   // the feature location must have a passableArcCount of <= 1
        !          2379:     MF_NOT_ON_LEVEL_PERIMETER       = Fl(28),   // don't build it in the outermost walls of the level
        !          2380:     MF_SKELETON_KEY                 = Fl(29),   // if a key is generated or adopted by this feature, it will open all locks in this machine.
        !          2381:     MF_KEY_DISPOSABLE               = Fl(30),   // if a key is generated or adopted, it will self-destruct after being used at this current location.
        !          2382: };
        !          2383:
        !          2384: typedef struct machineFeature {
        !          2385:     // terrain
        !          2386:     enum dungeonFeatureTypes featureDF; // generate this DF at the feature location (0 for none)
        !          2387:     enum tileType terrain;              // generate this terrain tile at the feature location (0 for none)
        !          2388:     enum dungeonLayers layer;           // generate the terrain tile in this layer
        !          2389:
        !          2390:     short instanceCountRange[2];        // generate this range of instances of this feature
        !          2391:     short minimumInstanceCount;         // abort if fewer than this
        !          2392:
        !          2393:     // items: these will be ignored if the feature is adopting an item
        !          2394:     short itemCategory;                 // generate this category of item (or -1 for random)
        !          2395:     short itemKind;                     // generate this kind of item (or -1 for random)
        !          2396:
        !          2397:     short monsterID;                    // generate a monster of this kind if MF_GENERATE_MONSTER is set
        !          2398:
        !          2399:     short personalSpace;                // subsequent features must be generated more than this many tiles away from this feature
        !          2400:     unsigned long hordeFlags;           // choose a monster horde based on this
        !          2401:     unsigned long itemFlags;            // assign these flags to the item
        !          2402:     unsigned long flags;                // feature flags
        !          2403: } machineFeature;
        !          2404:
        !          2405: enum blueprintFlags {
        !          2406:     BP_ADOPT_ITEM                   = Fl(0),    // the machine must adopt an item (e.g. a door key)
        !          2407:     BP_VESTIBULE                    = Fl(1),    // spawns in a doorway (location must be given) and expands outward, to guard the room
        !          2408:     BP_PURGE_PATHING_BLOCKERS       = Fl(2),    // clean out traps and other T_PATHING_BLOCKERs
        !          2409:     BP_PURGE_INTERIOR               = Fl(3),    // clean out all of the terrain in the interior before generating the machine
        !          2410:     BP_PURGE_LIQUIDS                = Fl(4),    // clean out all of the liquids in the interior before generating the machine
        !          2411:     BP_SURROUND_WITH_WALLS          = Fl(5),    // fill in any impassable gaps in the perimeter (e.g. water, lava, brimstone, traps) with wall
        !          2412:     BP_IMPREGNABLE                  = Fl(6),    // impassable perimeter and interior tiles are locked; tunneling bolts will bounce off harmlessly
        !          2413:     BP_REWARD                       = Fl(7),    // metered reward machines
        !          2414:     BP_OPEN_INTERIOR                = Fl(8),    // clear out walls in the interior, widen the interior until convex or bumps into surrounding areas
        !          2415:     BP_MAXIMIZE_INTERIOR            = Fl(9),    // same as BP_OPEN_INTERIOR but expands the room as far as it can go, potentially surrounding the whole level.
        !          2416:     BP_ROOM                         = Fl(10),   // spawns in a dead-end room that is dominated by a chokepoint of the given size (as opposed to a random place of the given size)
        !          2417:     BP_TREAT_AS_BLOCKING            = Fl(11),   // abort the machine if, were it filled with wall tiles, it would disrupt the level connectivity
        !          2418:     BP_REQUIRE_BLOCKING             = Fl(12),   // abort the machine unless, were it filled with wall tiles, it would disrupt the level connectivity
        !          2419:     BP_NO_INTERIOR_FLAG             = Fl(13),   // don't flag the area as being part of a machine
        !          2420:     BP_REDESIGN_INTERIOR            = Fl(14),   // nuke and pave -- delete all terrain in the interior and build entirely new rooms within the bounds
        !          2421: };
        !          2422:
        !          2423: typedef struct blueprint {
        !          2424:     short depthRange[2];                // machine must be built between these dungeon depths
        !          2425:     short roomSize[2];                  // machine must be generated in a room of this size
        !          2426:     short frequency;                    // frequency (number of tickets this blueprint enters in the blueprint selection raffle)
        !          2427:     short featureCount;                 // how many different types of features follow (max of 20)
        !          2428:     short dungeonProfileType;           // if BP_REDESIGN_INTERIOR is set, which dungeon profile do we use?
        !          2429:     unsigned long flags;                // blueprint flags
        !          2430:     machineFeature feature[20];         // the features themselves
        !          2431: } blueprint;
        !          2432:
        !          2433: enum machineTypes {
        !          2434:     // Reward rooms:
        !          2435:     MT_REWARD_MULTI_LIBRARY = 1,
        !          2436:     MT_REWARD_MONO_LIBRARY,
        !          2437:     MT_REWARD_CONSUMABLES,
        !          2438:     MT_REWARD_PEDESTALS_PERMANENT,
        !          2439:     MT_REWARD_PEDESTALS_CONSUMABLE,
        !          2440:     MT_REWARD_COMMUTATION_ALTARS,
        !          2441:     MT_REWARD_RESURRECTION_ALTAR,
        !          2442:     MT_REWARD_ADOPTED_ITEM,
        !          2443:     MT_REWARD_DUNGEON,
        !          2444:     MT_REWARD_KENNEL,
        !          2445:     MT_REWARD_VAMPIRE_LAIR,
        !          2446:     MT_REWARD_ASTRAL_PORTAL,
        !          2447:     MT_REWARD_GOBLIN_WARREN,
        !          2448:     MT_REWARD_SENTINEL_SANCTUARY,
        !          2449:
        !          2450:     // Amulet holder:
        !          2451:     MT_AMULET_AREA,
        !          2452:
        !          2453:     // Door guard machines:
        !          2454:     MT_LOCKED_DOOR_VESTIBULE,
        !          2455:     MT_SECRET_DOOR_VESTIBULE,
        !          2456:     MT_SECRET_LEVER_VESTIBULE,
        !          2457:     MT_FLAMMABLE_BARRICADE_VESTIBULE,
        !          2458:     MT_STATUE_SHATTERING_VESTIBULE,
        !          2459:     MT_STATUE_MONSTER_VESTIBULE,
        !          2460:     MT_THROWING_TUTORIAL_VESTIBULE,
        !          2461:     MT_PIT_TRAPS_VESTIBULE,
        !          2462:     MT_BECKONING_OBSTACLE_VESTIBULE,
        !          2463:     MT_GUARDIAN_VESTIBULE,
        !          2464:
        !          2465:     // Key guard machines:
        !          2466:     MT_KEY_REWARD_LIBRARY,
        !          2467:     MT_KEY_SECRET_ROOM,
        !          2468:     MT_KEY_THROWING_TUTORIAL_AREA,
        !          2469:     MT_KEY_RAT_TRAP_ROOM,
        !          2470:     MT_KEY_FIRE_TRANSPORTATION_ROOM,
        !          2471:     MT_KEY_FLOOD_TRAP_ROOM,
        !          2472:     MT_KEY_FIRE_TRAP_ROOM,
        !          2473:     MT_KEY_THIEF_AREA,
        !          2474:     MT_KEY_COLLAPSING_FLOOR_AREA,
        !          2475:     MT_KEY_PIT_TRAP_ROOM,
        !          2476:     MT_KEY_LEVITATION_ROOM,
        !          2477:     MT_KEY_WEB_CLIMBING_ROOM,
        !          2478:     MT_KEY_LAVA_MOAT_ROOM,
        !          2479:     MT_KEY_LAVA_MOAT_AREA,
        !          2480:     MT_KEY_POISON_GAS_TRAP_ROOM,
        !          2481:     MT_KEY_EXPLOSIVE_TRAP_ROOM,
        !          2482:     MT_KEY_BURNING_TRAP_ROOM,
        !          2483:     MT_KEY_STATUARY_TRAP_AREA,
        !          2484:     MT_KEY_GUARDIAN_WATER_PUZZLE_ROOM,
        !          2485:     MT_KEY_GUARDIAN_GAUNTLET_ROOM,
        !          2486:     MT_KEY_GUARDIAN_CORRIDOR_ROOM,
        !          2487:     MT_KEY_SACRIFICE_ROOM,
        !          2488:     MT_KEY_SUMMONING_CIRCLE_ROOM,
        !          2489:     MT_KEY_BECKONING_OBSTACLE_ROOM,
        !          2490:     MT_KEY_WORM_TRAP_AREA,
        !          2491:     MT_KEY_MUD_TRAP_ROOM,
        !          2492:     MT_KEY_ELECTRIC_CRYSTALS_ROOM,
        !          2493:     MT_KEY_ZOMBIE_TRAP_ROOM,
        !          2494:     MT_KEY_PHANTOM_TRAP_ROOM,
        !          2495:     MT_KEY_WORM_TUNNEL_ROOM,
        !          2496:     MT_KEY_TURRET_TRAP_ROOM,
        !          2497:     MT_KEY_BOSS_ROOM,
        !          2498:
        !          2499:     // Thematic machines:
        !          2500:     MT_BLOODFLOWER_AREA,
        !          2501:     MT_SHRINE_AREA,
        !          2502:     MT_IDYLL_AREA,
        !          2503:     MT_SWAMP_AREA,
        !          2504:     MT_CAMP_AREA,
        !          2505:     MT_REMNANT_AREA,
        !          2506:     MT_DISMAL_AREA,
        !          2507:     MT_BRIDGE_TURRET_AREA,
        !          2508:     MT_LAKE_PATH_TURRET_AREA,
        !          2509:     MT_PARALYSIS_TRAP_AREA,
        !          2510:     MT_PARALYSIS_TRAP_HIDDEN_AREA,
        !          2511:     MT_TRICK_STATUE_AREA,
        !          2512:     MT_WORM_AREA,
        !          2513:     MT_SENTINEL_AREA,
        !          2514:
        !          2515:     NUMBER_BLUEPRINTS,
        !          2516: };
        !          2517:
        !          2518: typedef struct autoGenerator {
        !          2519:     // What spawns:
        !          2520:     enum tileType terrain;
        !          2521:     enum dungeonLayers layer;
        !          2522:
        !          2523:     enum dungeonFeatureTypes DFType;
        !          2524:
        !          2525:     enum machineTypes machine; // Machine placement also respects BP_ placement flags in the machine blueprint
        !          2526:
        !          2527:     // Parameters governing when and where it spawns:
        !          2528:     enum tileType requiredDungeonFoundationType;
        !          2529:     enum tileType requiredLiquidFoundationType;
        !          2530:     short minDepth;
        !          2531:     short maxDepth;
        !          2532:     short frequency;
        !          2533:     short minNumberIntercept; // actually intercept * 100
        !          2534:     short minNumberSlope; // actually slope * 100
        !          2535:     short maxNumber;
        !          2536: } autoGenerator;
        !          2537:
        !          2538: #define NUMBER_AUTOGENERATORS 49
        !          2539:
        !          2540: typedef struct feat {
        !          2541:     char name[100];
        !          2542:     char description[200];
        !          2543:     boolean initialValue;
        !          2544: } feat;
        !          2545:
        !          2546: #define PDS_FORBIDDEN   -1
        !          2547: #define PDS_OBSTRUCTION -2
        !          2548: #define PDS_CELL(map, x, y) ((map)->links + ((x) + DCOLS * (y)))
        !          2549:
        !          2550: typedef struct pdsLink pdsLink;
        !          2551: typedef struct pdsMap pdsMap;
        !          2552:
        !          2553: typedef struct brogueButton {
        !          2554:     char text[COLS*3];          // button label; can include color escapes
        !          2555:     short x;                    // button's leftmost cell will be drawn at (x, y)
        !          2556:     short y;
        !          2557:     signed long hotkey[10];     // up to 10 hotkeys to trigger the button
        !          2558:     color buttonColor;          // background of the button; further gradient-ized when displayed
        !          2559:     short opacity;              // further reduced by 50% if not enabled
        !          2560:     enum displayGlyph symbol[COLS];         // Automatically replace the nth asterisk in the button label text with
        !          2561:                                 // the nth character supplied here, if one is given.
        !          2562:                                 // (Primarily to display magic character and item symbols in the inventory display.)
        !          2563:     unsigned long flags;
        !          2564: } brogueButton;
        !          2565:
        !          2566: enum buttonDrawStates {
        !          2567:     BUTTON_NORMAL = 0,
        !          2568:     BUTTON_HOVER,
        !          2569:     BUTTON_PRESSED,
        !          2570: };
        !          2571:
        !          2572: enum BUTTON_FLAGS {
        !          2573:     B_DRAW                  = Fl(0),
        !          2574:     B_ENABLED               = Fl(1),
        !          2575:     B_GRADIENT              = Fl(2),
        !          2576:     B_HOVER_ENABLED         = Fl(3),
        !          2577:     B_WIDE_CLICK_AREA       = Fl(4),
        !          2578:     B_KEYPRESS_HIGHLIGHT    = Fl(5),
        !          2579: };
        !          2580:
        !          2581: typedef struct buttonState {
        !          2582:     // Indices of the buttons that are doing stuff:
        !          2583:     short buttonFocused;
        !          2584:     short buttonDepressed;
        !          2585:
        !          2586:     // Index of the selected button:
        !          2587:     short buttonChosen;
        !          2588:
        !          2589:     // The buttons themselves:
        !          2590:     short buttonCount;
        !          2591:     brogueButton buttons[50];
        !          2592:
        !          2593:     // The window location, to determine whether a click is a cancelation:
        !          2594:     short winX;
        !          2595:     short winY;
        !          2596:     short winWidth;
        !          2597:     short winHeight;
        !          2598:
        !          2599:     // Graphical buffers:
        !          2600:     cellDisplayBuffer dbuf[COLS][ROWS]; // Where buttons are drawn.
        !          2601:     cellDisplayBuffer rbuf[COLS][ROWS]; // Reversion screen state.
        !          2602: } buttonState;
        !          2603:
        !          2604: extern boolean serverMode;
        !          2605: extern boolean hasGraphics;
        !          2606: extern boolean graphicsEnabled;
        !          2607:
        !          2608: #if defined __cplusplus
        !          2609: extern "C" {
        !          2610: #endif
        !          2611:
        !          2612:     // Utilities.c - String functions
        !          2613:     boolean endswith(const char *str, const char *ending);
        !          2614:     void append(char *str, char *ending, int bufsize);
        !          2615:
        !          2616:     void rogueMain();
        !          2617:     void executeEvent(rogueEvent *theEvent);
        !          2618:     boolean fileExists(const char *pathname);
        !          2619:     boolean chooseFile(char *path, char *prompt, char *defaultName, char *suffix);
        !          2620:     boolean openFile(const char *path);
        !          2621:     void initializeRogue(unsigned long seed);
        !          2622:     void gameOver(char *killedBy, boolean useCustomPhrasing);
        !          2623:     void victory(boolean superVictory);
        !          2624:     void enableEasyMode();
        !          2625:     long rand_range(long lowerBound, long upperBound);
        !          2626:     unsigned long seedRandomGenerator(unsigned long seed);
        !          2627:     short randClumpedRange(short lowerBound, short upperBound, short clumpFactor);
        !          2628:     short randClump(randomRange theRange);
        !          2629:     boolean rand_percent(short percent);
        !          2630:     void shuffleList(short *list, short listLength);
        !          2631:     void fillSequentialList(short *list, short listLength);
        !          2632:     fixpt fp_round(fixpt x);
        !          2633:     fixpt fp_pow(fixpt base, int expn);
        !          2634:     fixpt fp_sqrt(fixpt val);
        !          2635:     short unflag(unsigned long flag);
        !          2636:     void considerCautiousMode();
        !          2637:     void refreshScreen();
        !          2638:     void displayLevel();
        !          2639:     void storeColorComponents(char components[3], const color *theColor);
        !          2640:     boolean separateColors(color *fore, color *back);
        !          2641:     void bakeColor(color *theColor);
        !          2642:     void shuffleTerrainColors(short percentOfCells, boolean refreshCells);
        !          2643:     void normColor(color *baseColor, const short aggregateMultiplier, const short colorTranslation);
        !          2644:     void getCellAppearance(short x, short y, enum displayGlyph *returnChar, color *returnForeColor, color *returnBackColor);
        !          2645:     void logBuffer(char array[DCOLS][DROWS]);
        !          2646:     //void logBuffer(short **array);
        !          2647:     boolean search(short searchStrength);
        !          2648:     boolean proposeOrConfirmLocation(short x, short y, char *failureMessage);
        !          2649:     boolean useStairs(short stairDirection);
        !          2650:     short passableArcCount(short x, short y);
        !          2651:     void analyzeMap(boolean calculateChokeMap);
        !          2652:     boolean buildAMachine(enum machineTypes bp,
        !          2653:                           short originX, short originY,
        !          2654:                           unsigned long requiredMachineFlags,
        !          2655:                           item *adoptiveItem,
        !          2656:                           item *parentSpawnedItems[50],
        !          2657:                           creature *parentSpawnedMonsters[50]);
        !          2658:     void attachRooms(short **grid, const dungeonProfile *theDP, short attempts, short maxRoomCount);
        !          2659:     void digDungeon();
        !          2660:     void updateMapToShore();
        !          2661:     short levelIsDisconnectedWithBlockingMap(char blockingMap[DCOLS][DROWS], boolean countRegionSize);
        !          2662:     void resetDFMessageEligibility();
        !          2663:     boolean fillSpawnMap(enum dungeonLayers layer,
        !          2664:                          enum tileType surfaceTileType,
        !          2665:                          char spawnMap[DCOLS][DROWS],
        !          2666:                          boolean blockedByOtherLayers,
        !          2667:                          boolean refresh,
        !          2668:                          boolean superpriority);
        !          2669:     boolean spawnDungeonFeature(short x, short y, dungeonFeature *feat, boolean refreshCell, boolean abortIfBlocking);
        !          2670:     void restoreMonster(creature *monst, short **mapToStairs, short **mapToPit);
        !          2671:     void restoreItem(item *theItem);
        !          2672:     void refreshWaypoint(short wpIndex);
        !          2673:     void setUpWaypoints();
        !          2674:     void zeroOutGrid(char grid[DCOLS][DROWS]);
        !          2675:     short oppositeDirection(short theDir);
        !          2676:
        !          2677:     void plotChar(enum displayGlyph inputChar,
        !          2678:                   short xLoc, short yLoc,
        !          2679:                   short backRed, short backGreen, short backBlue,
        !          2680:                   short foreRed, short foreGreen, short foreBlue);
        !          2681:     boolean pauseForMilliseconds(short milliseconds);
        !          2682:     boolean isApplicationActive();
        !          2683:     void nextKeyOrMouseEvent(rogueEvent *returnEvent, boolean textInput, boolean colorsDance);
        !          2684:     void notifyEvent(short eventId, int data1, int data2, const char *str1, const char *str2);
        !          2685:     boolean takeScreenshot();
        !          2686:     boolean setGraphicsEnabled(boolean);
        !          2687:     boolean controlKeyIsDown();
        !          2688:     boolean shiftKeyIsDown();
        !          2689:     short getHighScoresList(rogueHighScoresEntry returnList[HIGH_SCORES_COUNT]);
        !          2690:     boolean saveHighScore(rogueHighScoresEntry theEntry);
        !          2691:     fileEntry *listFiles(short *fileCount, char **dynamicMemoryBuffer);
        !          2692:     void initializeLaunchArguments(enum NGCommands *command, char *path, unsigned long *seed);
        !          2693:
        !          2694:     char nextKeyPress(boolean textInput);
        !          2695:     void refreshSideBar(short focusX, short focusY, boolean focusedEntityMustGoFirst);
        !          2696:     void printHelpScreen();
        !          2697:     void printDiscoveriesScreen();
        !          2698:     void printHighScores(boolean hiliteMostRecent);
        !          2699:     void displayGrid(short **map);
        !          2700:     void printSeed();
        !          2701:     void printProgressBar(short x, short y, const char barLabel[COLS], long amtFilled, long amtMax, color *fillColor, boolean dim);
        !          2702:     short printMonsterInfo(creature *monst, short y, boolean dim, boolean highlight);
        !          2703:     void describeHallucinatedItem(char *buf);
        !          2704:     short printItemInfo(item *theItem, short y, boolean dim, boolean highlight);
        !          2705:     short printTerrainInfo(short x, short y, short py, const char *description, boolean dim, boolean highlight);
        !          2706:     void rectangularShading(short x, short y, short width, short height,
        !          2707:                             const color *backColor, short opacity, cellDisplayBuffer dbuf[COLS][ROWS]);
        !          2708:     short printTextBox(char *textBuf, short x, short y, short width,
        !          2709:                        color *foreColor, color *backColor,
        !          2710:                        cellDisplayBuffer rbuf[COLS][ROWS],
        !          2711:                        brogueButton *buttons, short buttonCount);
        !          2712:     void printMonsterDetails(creature *monst, cellDisplayBuffer rbuf[COLS][ROWS]);
        !          2713:     void printFloorItemDetails(item *theItem, cellDisplayBuffer rbuf[COLS][ROWS]);
        !          2714:     unsigned long printCarriedItemDetails(item *theItem,
        !          2715:                                           short x, short y, short width,
        !          2716:                                           boolean includeButtons,
        !          2717:                                           cellDisplayBuffer rbuf[COLS][ROWS]);
        !          2718:     void funkyFade(cellDisplayBuffer displayBuf[COLS][ROWS], const color *colorStart, const color *colorEnd, short stepCount, short x, short y, boolean invert);
        !          2719:     void displayCenteredAlert(char *message);
        !          2720:     void flashMessage(char *message, short x, short y, int time, color *fColor, color *bColor);
        !          2721:     void flashTemporaryAlert(char *message, int time);
        !          2722:     void waitForAcknowledgment();
        !          2723:     void waitForKeystrokeOrMouseClick();
        !          2724:     boolean confirm(char *prompt, boolean alsoDuringPlayback);
        !          2725:     void refreshDungeonCell(short x, short y);
        !          2726:     void applyColorMultiplier(color *baseColor, const color *multiplierColor);
        !          2727:     void applyColorAverage(color *baseColor, const color *newColor, short averageWeight);
        !          2728:     void applyColorAugment(color *baseColor, const color *augmentingColor, short augmentWeight);
        !          2729:     void applyColorScalar(color *baseColor, short scalar);
        !          2730:     void applyColorBounds(color *baseColor, short lowerBound, short upperBound);
        !          2731:     void desaturate(color *baseColor, short weight);
        !          2732:     void randomizeColor(color *baseColor, short randomizePercent);
        !          2733:     void swapColors(color *color1, color *color2);
        !          2734:     void irisFadeBetweenBuffers(cellDisplayBuffer fromBuf[COLS][ROWS],
        !          2735:                                 cellDisplayBuffer toBuf[COLS][ROWS],
        !          2736:                                 short x, short y,
        !          2737:                                 short frameCount,
        !          2738:                                 boolean outsideIn);
        !          2739:     void colorBlendCell(short x, short y, color *hiliteColor, short hiliteStrength);
        !          2740:     void hiliteCell(short x, short y, const color *hiliteColor, short hiliteStrength, boolean distinctColors);
        !          2741:     void colorMultiplierFromDungeonLight(short x, short y, color *editColor);
        !          2742:     void plotCharWithColor(enum displayGlyph inputChar, short xLoc, short yLoc, const color *cellForeColor, const color *cellBackColor);
        !          2743:     void plotCharToBuffer(enum displayGlyph inputChar, short x, short y, color *foreColor, color *backColor, cellDisplayBuffer dbuf[COLS][ROWS]);
        !          2744:     void plotForegroundChar(enum displayGlyph inputChar, short x, short y, color *foreColor, boolean affectedByLighting);
        !          2745:     void commitDraws();
        !          2746:     void dumpLevelToScreen();
        !          2747:     void hiliteCharGrid(char hiliteCharGrid[DCOLS][DROWS], color *hiliteColor, short hiliteStrength);
        !          2748:     void blackOutScreen();
        !          2749:     void colorOverDungeon(const color *color);
        !          2750:     void copyDisplayBuffer(cellDisplayBuffer toBuf[COLS][ROWS], cellDisplayBuffer fromBuf[COLS][ROWS]);
        !          2751:     void clearDisplayBuffer(cellDisplayBuffer dbuf[COLS][ROWS]);
        !          2752:     color colorFromComponents(char rgb[3]);
        !          2753:     void overlayDisplayBuffer(cellDisplayBuffer overBuf[COLS][ROWS], cellDisplayBuffer previousBuf[COLS][ROWS]);
        !          2754:     void flashForeground(short *x, short *y, color **flashColor, short *flashStrength, short count, short frames);
        !          2755:     void flashCell(color *theColor, short frames, short x, short y);
        !          2756:     void colorFlash(const color *theColor, unsigned long reqTerrainFlags, unsigned long reqTileFlags, short frames, short maxRadius, short x, short y);
        !          2757:     void printString(const char *theString, short x, short y, color *foreColor, color*backColor, cellDisplayBuffer dbuf[COLS][ROWS]);
        !          2758:     short wrapText(char *to, const char *sourceText, short width);
        !          2759:     short printStringWithWrapping(char *theString, short x, short y, short width, color *foreColor,
        !          2760:                                   color*backColor, cellDisplayBuffer dbuf[COLS][ROWS]);
        !          2761:     boolean getInputTextString(char *inputText,
        !          2762:                                const char *prompt,
        !          2763:                                short maxLength,
        !          2764:                                const char *defaultEntry,
        !          2765:                                const char *promptSuffix,
        !          2766:                                short textEntryType,
        !          2767:                                boolean useDialogBox);
        !          2768:     void displayChokeMap();
        !          2769:     void displayLoops();
        !          2770:     boolean pauseBrogue(short milliseconds);
        !          2771:     void nextBrogueEvent(rogueEvent *returnEvent, boolean textInput, boolean colorsDance, boolean realInputEvenInPlayback);
        !          2772:     void executeMouseClick(rogueEvent *theEvent);
        !          2773:     void executeKeystroke(signed long keystroke, boolean controlKey, boolean shiftKey);
        !          2774:     void initializeLevel();
        !          2775:     void startLevel (short oldLevelNumber, short stairDirection);
        !          2776:     void updateMinersLightRadius();
        !          2777:     void freeCreature(creature *monst);
        !          2778:     void emptyGraveyard();
        !          2779:     void freeEverything();
        !          2780:     boolean randomMatchingLocation(short *x, short *y, short dungeonType, short liquidType, short terrainType);
        !          2781:     enum dungeonLayers highestPriorityLayer(short x, short y, boolean skipGas);
        !          2782:     enum dungeonLayers layerWithTMFlag(short x, short y, unsigned long flag);
        !          2783:     enum dungeonLayers layerWithFlag(short x, short y, unsigned long flag);
        !          2784:     char *tileFlavor(short x, short y);
        !          2785:     char *tileText(short x, short y);
        !          2786:     void describedItemBasedOnParameters(short theCategory, short theKind, short theQuantity, short theItemOriginDepth, char *buf);
        !          2787:     void describeLocation(char buf[DCOLS], short x, short y);
        !          2788:     void printLocationDescription(short x, short y);
        !          2789:     void useKeyAt(item *theItem, short x, short y);
        !          2790:     void playerRuns(short direction);
        !          2791:     void exposeCreatureToFire(creature *monst);
        !          2792:     void updateFlavorText();
        !          2793:     void updatePlayerUnderwaterness();
        !          2794:     boolean monsterShouldFall(creature *monst);
        !          2795:     void applyInstantTileEffectsToCreature(creature *monst);
        !          2796:     void vomit(creature *monst);
        !          2797:     void becomeAllyWith(creature *monst);
        !          2798:     void freeCaptive(creature *monst);
        !          2799:     boolean freeCaptivesEmbeddedAt(short x, short y);
        !          2800:     boolean handleWhipAttacks(creature *attacker, enum directions dir, boolean *aborted);
        !          2801:     boolean handleSpearAttacks(creature *attacker, enum directions dir, boolean *aborted);
        !          2802:     boolean diagonalBlocked(const short x1, const short y1, const short x2, const short y2, const boolean limitToPlayerKnowledge);
        !          2803:     boolean playerMoves(short direction);
        !          2804:     void calculateDistances(short **distanceMap,
        !          2805:                             short destinationX, short destinationY,
        !          2806:                             unsigned long blockingTerrainFlags,
        !          2807:                             creature *traveler,
        !          2808:                             boolean canUseSecretDoors,
        !          2809:                             boolean eightWays);
        !          2810:     short pathingDistance(short x1, short y1, short x2, short y2, unsigned long blockingTerrainFlags);
        !          2811:     short nextStep(short **distanceMap, short x, short y, creature *monst, boolean reverseDirections);
        !          2812:     void travelRoute(short path[1000][2], short steps);
        !          2813:     void travel(short x, short y, boolean autoConfirm);
        !          2814:     void populateGenericCostMap(short **costMap);
        !          2815:     void getLocationFlags(const short x, const short y,
        !          2816:                           unsigned long *tFlags, unsigned long *TMFlags, unsigned long *cellFlags,
        !          2817:                           const boolean limitToPlayerKnowledge);
        !          2818:     void populateCreatureCostMap(short **costMap, creature *monst);
        !          2819:     enum directions adjacentFightingDir();
        !          2820:     void getExploreMap(short **map, boolean headingToStairs);
        !          2821:     boolean explore(short frameDelay);
        !          2822:     short getPlayerPathOnMap(short path[1000][2], short **map, short originX, short originY);
        !          2823:     void reversePath(short path[1000][2], short steps);
        !          2824:     void hilitePath(short path[1000][2], short steps, boolean unhilite);
        !          2825:     void clearCursorPath();
        !          2826:     void hideCursor();
        !          2827:     void showCursor();
        !          2828:     void mainInputLoop();
        !          2829:     boolean isDisturbed(short x, short y);
        !          2830:     void discover(short x, short y);
        !          2831:     short randValidDirectionFrom(creature *monst, short x, short y, boolean respectAvoidancePreferences);
        !          2832:     boolean exposeTileToElectricity(short x, short y);
        !          2833:     boolean exposeTileToFire(short x, short y, boolean alwaysIgnite);
        !          2834:     boolean cellCanHoldGas(short x, short y);
        !          2835:     void monstersFall();
        !          2836:     void updateEnvironment();
        !          2837:     void updateAllySafetyMap();
        !          2838:     void updateSafetyMap();
        !          2839:     void updateSafeTerrainMap();
        !          2840:     short staffChargeDuration(const item *theItem);
        !          2841:     void rechargeItemsIncrementally(short multiplier);
        !          2842:     void extinguishFireOnCreature(creature *monst);
        !          2843:     void autoRest();
        !          2844:     void manualSearch();
        !          2845:     boolean startFighting(enum directions dir, boolean tillDeath);
        !          2846:     void autoFight(boolean tillDeath);
        !          2847:     void synchronizePlayerTimeState();
        !          2848:     void playerRecoversFromAttacking(boolean anAttackHit);
        !          2849:     void playerTurnEnded();
        !          2850:     void resetScentTurnNumber();
        !          2851:     void displayMonsterFlashes(boolean flashingEnabled);
        !          2852:     void displayMessageArchive();
        !          2853:     void temporaryMessage(char *msg1, boolean requireAcknowledgment);
        !          2854:     void messageWithColor(char *msg, color *theColor, boolean requireAcknowledgment);
        !          2855:     void flavorMessage(char *msg);
        !          2856:     void message(const char *msg, boolean requireAcknowledgment);
        !          2857:     void displayMoreSignWithoutWaitingForAcknowledgment();
        !          2858:     void displayMoreSign();
        !          2859:     short encodeMessageColor(char *msg, short i, const color *theColor);
        !          2860:     short decodeMessageColor(const char *msg, short i, color *returnColor);
        !          2861:     color *messageColorFromVictim(creature *monst);
        !          2862:     void upperCase(char *theChar);
        !          2863:     void updateMessageDisplay();
        !          2864:     void deleteMessages();
        !          2865:     void confirmMessages();
        !          2866:     void stripShiftFromMovementKeystroke(signed long *keystroke);
        !          2867:
        !          2868:     void storeMemories(const short x, const short y);
        !          2869:     void updateFieldOfViewDisplay(boolean updateDancingTerrain, boolean refreshDisplay);
        !          2870:     void updateFieldOfView(short xLoc, short yLoc, short radius, boolean paintScent,
        !          2871:                            boolean passThroughCreatures, boolean setFieldOfView, short theColor[3], short fadeToPercent);
        !          2872:     void betweenOctant1andN(short *x, short *y, short x0, short y0, short n);
        !          2873:
        !          2874:     void getFOVMask(char grid[DCOLS][DROWS], short xLoc, short yLoc, fixpt maxRadius,
        !          2875:                     unsigned long forbiddenTerrain, unsigned long forbiddenFlags, boolean cautiousOnWalls);
        !          2876:     void scanOctantFOV(char grid[DCOLS][DROWS], short xLoc, short yLoc, short octant, fixpt maxRadius,
        !          2877:                        short columnsRightFromOrigin, long startSlope, long endSlope, unsigned long forbiddenTerrain,
        !          2878:                        unsigned long forbiddenFlags, boolean cautiousOnWalls);
        !          2879:
        !          2880:     creature *generateMonster(short monsterID, boolean itemPossible, boolean mutationPossible);
        !          2881:     short chooseMonster(short forLevel);
        !          2882:     creature *spawnHorde(short hordeID, short x, short y, unsigned long forbiddenFlags, unsigned long requiredFlags);
        !          2883:     void fadeInMonster(creature *monst);
        !          2884:     boolean removeMonsterFromChain(creature *monst, creature *theChain);
        !          2885:     boolean monsterWillAttackTarget(const creature *attacker, const creature *defender);
        !          2886:     boolean monstersAreTeammates(const creature *monst1, const creature *monst2);
        !          2887:     boolean monstersAreEnemies(const creature *monst1, const creature *monst2);
        !          2888:     void initializeGender(creature *monst);
        !          2889:     boolean stringsMatch(const char *str1, const char *str2);
        !          2890:     void resolvePronounEscapes(char *text, creature *monst);
        !          2891:     short pickHordeType(short depth, enum monsterTypes summonerType, unsigned long forbiddenFlags, unsigned long requiredFlags);
        !          2892:     creature *cloneMonster(creature *monst, boolean announce, boolean placeClone);
        !          2893:     void empowerMonster(creature *monst);
        !          2894:     unsigned long forbiddenFlagsForMonster(creatureType *monsterType);
        !          2895:     unsigned long avoidedFlagsForMonster(creatureType *monsterType);
        !          2896:     boolean monsterCanSubmergeNow(creature *monst);
        !          2897:     void populateMonsters();
        !          2898:     void updateMonsterState(creature *monst);
        !          2899:     void decrementMonsterStatus(creature *monst);
        !          2900:     boolean specifiedPathBetween(short x1, short y1, short x2, short y2,
        !          2901:                                  unsigned long blockingTerrain, unsigned long blockingFlags);
        !          2902:     boolean traversiblePathBetween(creature *monst, short x2, short y2);
        !          2903:     boolean openPathBetween(short x1, short y1, short x2, short y2);
        !          2904:     creature *monsterAtLoc(short x, short y);
        !          2905:     creature *dormantMonsterAtLoc(short x, short y);
        !          2906:     void perimeterCoords(short returnCoords[2], short n);
        !          2907:     boolean monsterBlinkToPreferenceMap(creature *monst, short **preferenceMap, boolean blinkUphill);
        !          2908:     boolean monsterSummons(creature *monst, boolean alwaysUse);
        !          2909:     boolean resurrectAlly(const short x, const short y);
        !          2910:     void unAlly(creature *monst);
        !          2911:     boolean monsterFleesFrom(creature *monst, creature *defender);
        !          2912:     void monstersTurn(creature *monst);
        !          2913:     boolean getRandomMonsterSpawnLocation(short *x, short *y);
        !          2914:     void spawnPeriodicHorde();
        !          2915:     void clearStatus(creature *monst);
        !          2916:     void moralAttack(creature *attacker, creature *defender);
        !          2917:     short runicWeaponChance(item *theItem, boolean customEnchantLevel, fixpt enchantLevel);
        !          2918:     void magicWeaponHit(creature *defender, item *theItem, boolean backstabbed);
        !          2919:     void teleport(creature *monst, short x, short y, boolean respectTerrainAvoidancePreferences);
        !          2920:     void chooseNewWanderDestination(creature *monst);
        !          2921:     boolean canPass(creature *mover, creature *blocker);
        !          2922:     boolean isPassableOrSecretDoor(short x, short y);
        !          2923:     boolean knownToPlayerAsPassableOrSecretDoor(short x, short y);
        !          2924:     void setMonsterLocation(creature *monst, short newX, short newY);
        !          2925:     boolean moveMonster(creature *monst, short dx, short dy);
        !          2926:     unsigned long burnedTerrainFlagsAtLoc(short x, short y);
        !          2927:     unsigned long discoveredTerrainFlagsAtLoc(short x, short y);
        !          2928:     boolean monsterAvoids(creature *monst, short x, short y);
        !          2929:     short distanceBetween(short x1, short y1, short x2, short y2);
        !          2930:     void alertMonster(creature *monst);
        !          2931:     void wakeUp(creature *monst);
        !          2932:     boolean monsterRevealed(creature *monst);
        !          2933:     boolean monsterHiddenBySubmersion(const creature *monst, const creature *observer);
        !          2934:     boolean monsterIsHidden(const creature *monst, const creature *observer);
        !          2935:     boolean canSeeMonster(creature *monst);
        !          2936:     boolean canDirectlySeeMonster(creature *monst);
        !          2937:     void monsterName(char *buf, creature *monst, boolean includeArticle);
        !          2938:     boolean monsterIsInClass(const creature *monst, const short monsterClass);
        !          2939:     fixpt strengthModifier(item *theItem);
        !          2940:     fixpt netEnchant(item *theItem);
        !          2941:     short hitProbability(creature *attacker, creature *defender);
        !          2942:     boolean attackHit(creature *attacker, creature *defender);
        !          2943:     void applyArmorRunicEffect(char returnString[DCOLS], creature *attacker, short *damage, boolean melee);
        !          2944:     void processStaggerHit(creature *attacker, creature *defender);
        !          2945:     boolean attack(creature *attacker, creature *defender, boolean lungeAttack);
        !          2946:     void inflictLethalDamage(creature *attacker, creature *defender);
        !          2947:     boolean inflictDamage(creature *attacker, creature *defender,
        !          2948:                           short damage, const color *flashColor, boolean ignoresProtectionShield);
        !          2949:     void addPoison(creature *monst, short totalDamage, short concentrationIncrement);
        !          2950:     void killCreature(creature *decedent, boolean administrativeDeath);
        !          2951:     void buildHitList(creature **hitList, const creature *attacker, creature *defender, const boolean sweep);
        !          2952:     void addScentToCell(short x, short y, short distance);
        !          2953:     void populateItems(short upstairsX, short upstairsY);
        !          2954:     item *placeItem(item *theItem, short x, short y);
        !          2955:     void removeItemFrom(short x, short y);
        !          2956:     void pickUpItemAt(short x, short y);
        !          2957:     item *addItemToPack(item *theItem);
        !          2958:     void aggravateMonsters(short distance, short x, short y, const color *flashColor);
        !          2959:     short getLineCoordinates(short listOfCoordinates[][2], const short originLoc[2], const short targetLoc[2]);
        !          2960:     void getImpactLoc(short returnLoc[2], const short originLoc[2], const short targetLoc[2],
        !          2961:                       const short maxDistance, const boolean returnLastEmptySpace);
        !          2962:     void negate(creature *monst);
        !          2963:     short monsterAccuracyAdjusted(const creature *monst);
        !          2964:     fixpt monsterDamageAdjustmentAmount(const creature *monst);
        !          2965:     short monsterDefenseAdjusted(const creature *monst);
        !          2966:     void weaken(creature *monst, short maxDuration);
        !          2967:     void slow(creature *monst, short turns);
        !          2968:     void haste(creature *monst, short turns);
        !          2969:     void heal(creature *monst, short percent, boolean panacea);
        !          2970:     boolean projectileReflects(creature *attacker, creature *defender);
        !          2971:     short reflectBolt(short targetX, short targetY, short listOfCoordinates[][2], short kinkCell, boolean retracePath);
        !          2972:     void checkForMissingKeys(short x, short y);
        !          2973:     enum boltEffects boltEffectForItem(item *theItem);
        !          2974:     enum boltType boltForItem(item *theItem);
        !          2975:     boolean zap(short originLoc[2], short targetLoc[2], bolt *theBolt, boolean hideDetails);
        !          2976:     boolean nextTargetAfter(short *returnX,
        !          2977:                             short *returnY,
        !          2978:                             short targetX,
        !          2979:                             short targetY,
        !          2980:                             boolean targetEnemies,
        !          2981:                             boolean targetAllies,
        !          2982:                             boolean targetItems,
        !          2983:                             boolean targetTerrain,
        !          2984:                             boolean requireOpenPath,
        !          2985:                             boolean reverseDirection);
        !          2986:     boolean moveCursor(boolean *targetConfirmed,
        !          2987:                        boolean *canceled,
        !          2988:                        boolean *tabKey,
        !          2989:                        short targetLoc[2],
        !          2990:                        rogueEvent *event,
        !          2991:                        buttonState *state,
        !          2992:                        boolean colorsDance,
        !          2993:                        boolean keysMoveCursor,
        !          2994:                        boolean targetCanLeaveMap);
        !          2995:     void identifyItemKind(item *theItem);
        !          2996:     void autoIdentify(item *theItem);
        !          2997:     short numberOfItemsInPack();
        !          2998:     char nextAvailableInventoryCharacter();
        !          2999:     void checkForDisenchantment(item *theItem);
        !          3000:     void updateFloorItems();
        !          3001:     void itemKindName(item *theItem, char *kindName);
        !          3002:     void itemRunicName(item *theItem, char *runicName);
        !          3003:     void itemName(item *theItem, char *root, boolean includeDetails, boolean includeArticle, color *baseColor);
        !          3004:     char displayInventory(unsigned short categoryMask,
        !          3005:                           unsigned long requiredFlags,
        !          3006:                           unsigned long forbiddenFlags,
        !          3007:                           boolean waitForAcknowledge,
        !          3008:                           boolean includeButtons);
        !          3009:     short numberOfMatchingPackItems(unsigned short categoryMask,
        !          3010:                                     unsigned long requiredFlags, unsigned long forbiddenFlags,
        !          3011:                                     boolean displayErrors);
        !          3012:     void clearInventory(char keystroke);
        !          3013:     item *initializeItem();
        !          3014:     item *generateItem(unsigned short theCategory, short theKind);
        !          3015:     short chooseKind(itemTable *theTable, short numKinds);
        !          3016:     item *makeItemInto(item *theItem, unsigned long itemCategory, short itemKind);
        !          3017:     void updateEncumbrance();
        !          3018:     short displayedArmorValue();
        !          3019:     void strengthCheck(item *theItem);
        !          3020:     void recalculateEquipmentBonuses();
        !          3021:     void equipItem(item *theItem, boolean force);
        !          3022:     void equip(item *theItem);
        !          3023:     item *keyInPackFor(short x, short y);
        !          3024:     item *keyOnTileAt(short x, short y);
        !          3025:     void unequip(item *theItem);
        !          3026:     void drop(item *theItem);
        !          3027:     void findAlternativeHomeFor(creature *monst, short *x, short *y, boolean chooseRandomly);
        !          3028:     boolean getQualifyingLocNear(short loc[2],
        !          3029:                                  short x, short y,
        !          3030:                                  boolean hallwaysAllowed,
        !          3031:                                  char blockingMap[DCOLS][DROWS],
        !          3032:                                  unsigned long forbiddenTerrainFlags,
        !          3033:                                  unsigned long forbiddenMapFlags,
        !          3034:                                  boolean forbidLiquid,
        !          3035:                                  boolean deterministic);
        !          3036:     boolean getQualifyingGridLocNear(short loc[2],
        !          3037:                                      short x, short y,
        !          3038:                                      boolean grid[DCOLS][DROWS],
        !          3039:                                      boolean deterministic);
        !          3040:
        !          3041:     // Grid operations
        !          3042:     short **allocGrid();
        !          3043:     void freeGrid(short **array);
        !          3044:     void copyGrid(short **to, short **from);
        !          3045:     void fillGrid(short **grid, short fillValue);
        !          3046:     void hiliteGrid(short **grid, color *hiliteColor, short hiliteStrength);
        !          3047:     void findReplaceGrid(short **grid, short findValueMin, short findValueMax, short fillValue);
        !          3048:     short floodFillGrid(short **grid, short x, short y, short eligibleValueMin, short eligibleValueMax, short fillValue);
        !          3049:     void drawRectangleOnGrid(short **grid, short x, short y, short width, short height, short value);
        !          3050:     void drawCircleOnGrid(short **grid, short x, short y, short radius, short value);
        !          3051:     void getTerrainGrid(short **grid, short value, unsigned long terrainFlags, unsigned long mapFlags);
        !          3052:     void getTMGrid(short **grid, short value, unsigned long TMflags);
        !          3053:     short validLocationCount(short **grid, short validValue);
        !          3054:     void randomLocationInGrid(short **grid, short *x, short *y, short validValue);
        !          3055:     boolean getQualifyingPathLocNear(short *retValX, short *retValY,
        !          3056:                                      short x, short y,
        !          3057:                                      boolean hallwaysAllowed,
        !          3058:                                      unsigned long blockingTerrainFlags,
        !          3059:                                      unsigned long blockingMapFlags,
        !          3060:                                      unsigned long forbiddenTerrainFlags,
        !          3061:                                      unsigned long forbiddenMapFlags,
        !          3062:                                      boolean deterministic);
        !          3063:     void createBlobOnGrid(short **grid,
        !          3064:                           short *retMinX, short *retMinY, short *retWidth, short *retHeight,
        !          3065:                           short roundCount,
        !          3066:                           short minBlobWidth, short minBlobHeight,
        !          3067:                           short maxBlobWidth, short maxBlobHeight, short percentSeeded,
        !          3068:                           char birthParameters[9], char survivalParameters[9]);
        !          3069:
        !          3070:     void checkForContinuedLeadership(creature *monst);
        !          3071:     void demoteMonsterFromLeadership(creature *monst);
        !          3072:     void toggleMonsterDormancy(creature *monst);
        !          3073:     void monsterDetails(char buf[], creature *monst);
        !          3074:     void makeMonsterDropItem(creature *monst);
        !          3075:     void throwCommand(item *theItem, boolean autoThrow);
        !          3076:     void relabel(item *theItem);
        !          3077:     void apply(item *theItem, boolean recordCommands);
        !          3078:     boolean itemCanBeCalled(item *theItem);
        !          3079:     void call(item *theItem);
        !          3080:     short chooseVorpalEnemy();
        !          3081:     void describeMonsterClass(char *buf, const short classID, boolean conjunctionAnd);
        !          3082:     void identify(item *theItem);
        !          3083:     void updateIdentifiableItem(item *theItem);
        !          3084:     void updateIdentifiableItems();
        !          3085:     void readScroll(item *theItem);
        !          3086:     void updateRingBonuses();
        !          3087:     void updatePlayerRegenerationDelay();
        !          3088:     boolean removeItemFromChain(item *theItem, item *theChain);
        !          3089:     void addItemToChain(item *theItem, item *theChain);
        !          3090:     void drinkPotion(item *theItem);
        !          3091:     item *promptForItemOfType(unsigned short category,
        !          3092:                               unsigned long requiredFlags,
        !          3093:                               unsigned long forbiddenFlags,
        !          3094:                               char *prompt,
        !          3095:                               boolean allowInventoryActions);
        !          3096:     item *itemOfPackLetter(char letter);
        !          3097:     void unequipItem(item *theItem, boolean force);
        !          3098:     short magicCharDiscoverySuffix(short category, short kind);
        !          3099:     int itemMagicPolarity(item *theItem);
        !          3100:     item *itemAtLoc(short x, short y);
        !          3101:     item *dropItem(item *theItem);
        !          3102:     itemTable *tableForItemCategory(enum itemCategory theCat, short *kindCount);
        !          3103:     boolean isVowelish(char *theChar);
        !          3104:     short charmEffectDuration(short charmKind, short enchant);
        !          3105:     short charmRechargeDelay(short charmKind, short enchant);
        !          3106:     boolean itemIsCarried(item *theItem);
        !          3107:     void itemDetails(char *buf, item *theItem);
        !          3108:     void deleteItem(item *theItem);
        !          3109:     void shuffleFlavors();
        !          3110:     unsigned long itemValue(item *theItem);
        !          3111:     short strLenWithoutEscapes(const char *str);
        !          3112:     void combatMessage(char *theMsg, color *theColor);
        !          3113:     void displayCombatText();
        !          3114:     void flashMonster(creature *monst, const color *theColor, short strength);
        !          3115:
        !          3116:     boolean paintLight(lightSource *theLight, short x, short y, boolean isMinersLight, boolean maintainShadows);
        !          3117:     void backUpLighting(short lights[DCOLS][DROWS][3]);
        !          3118:     void restoreLighting(short lights[DCOLS][DROWS][3]);
        !          3119:     void updateLighting();
        !          3120:     boolean playerInDarkness();
        !          3121:     flare *newFlare(lightSource *light, short x, short y, short changePerFrame, short limit);
        !          3122:     void createFlare(short x, short y, enum lightType lightIndex);
        !          3123:     void animateFlares(flare **flares, short count);
        !          3124:     void deleteAllFlares();
        !          3125:     void demoteVisibility();
        !          3126:     void discoverCell(const short x, const short y);
        !          3127:     void updateVision(boolean refreshDisplay);
        !          3128:     void burnItem(item *theItem);
        !          3129:     void activateMachine(short machineNumber);
        !          3130:     boolean circuitBreakersPreventActivation(short machineNumber);
        !          3131:     void promoteTile(short x, short y, enum dungeonLayers layer, boolean useFireDF);
        !          3132:     void autoPlayLevel(boolean fastForward);
        !          3133:     void updateClairvoyance();
        !          3134:     short scentDistance(short x1, short y1, short x2, short y2);
        !          3135:     short armorAggroAdjustment(item *theArmor);
        !          3136:     short currentAggroValue();
        !          3137:
        !          3138:     void initRecording();
        !          3139:     void flushBufferToFile();
        !          3140:     void fillBufferFromFile();
        !          3141:     void recordEvent(rogueEvent *event);
        !          3142:     void recallEvent(rogueEvent *event);
        !          3143:     void pausePlayback();
        !          3144:     void displayAnnotation();
        !          3145:     boolean loadSavedGame();
        !          3146:     void switchToPlaying();
        !          3147:     void recordKeystroke(int keystroke, boolean controlKey, boolean shiftKey);
        !          3148:     void recordKeystrokeSequence(unsigned char *commandSequence);
        !          3149:     void recordMouseClick(short x, short y, boolean controlKey, boolean shiftKey);
        !          3150:     void OOSCheck(unsigned long x, short numberOfBytes);
        !          3151:     void RNGCheck();
        !          3152:     boolean executePlaybackInput(rogueEvent *recordingInput);
        !          3153:     void getAvailableFilePath(char *filePath, const char *defaultPath, const char *suffix);
        !          3154:     boolean characterForbiddenInFilename(const char theChar);
        !          3155:     void saveGame();
        !          3156:     void saveGameNoPrompt();
        !          3157:     void saveRecording(char *filePath);
        !          3158:     void saveRecordingNoPrompt(char *filePath);
        !          3159:     void parseFile();
        !          3160:     void RNGLog(char *message);
        !          3161:
        !          3162:     short wandDominate(creature *monst);
        !          3163:     short staffDamageLow(fixpt enchant);
        !          3164:     short staffDamageHigh(fixpt enchant);
        !          3165:     short staffDamage(fixpt enchant);
        !          3166:     int staffPoison(fixpt enchant);
        !          3167:     short staffBlinkDistance(fixpt enchant);
        !          3168:     short staffHasteDuration(fixpt enchant);
        !          3169:     short staffBladeCount(fixpt enchant);
        !          3170:     short staffDiscordDuration(fixpt enchant);
        !          3171:     int staffProtection(fixpt enchant);
        !          3172:     short staffEntrancementDuration(fixpt enchant);
        !          3173:     fixpt ringWisdomMultiplier(fixpt enchant);
        !          3174:     short charmHealing(fixpt enchant);
        !          3175:     int charmProtection(fixpt enchant);
        !          3176:     short charmShattering(fixpt enchant);
        !          3177:     short charmGuardianLifespan(fixpt enchant);
        !          3178:     short charmNegationRadius(fixpt enchant);
        !          3179:     short weaponParalysisDuration(fixpt enchant);
        !          3180:     short weaponConfusionDuration(fixpt enchant);
        !          3181:     short weaponForceDistance(fixpt enchant);
        !          3182:     short weaponSlowDuration(fixpt enchant);
        !          3183:     short weaponImageCount(fixpt enchant);
        !          3184:     short weaponImageDuration(fixpt enchant);
        !          3185:     short armorReprisalPercent(fixpt enchant);
        !          3186:     short armorAbsorptionMax(fixpt enchant);
        !          3187:     short armorImageCount(fixpt enchant);
        !          3188:     short reflectionChance(fixpt enchant);
        !          3189:     long turnsForFullRegenInThousandths(fixpt bonus);
        !          3190:     fixpt damageFraction(fixpt netEnchant);
        !          3191:     fixpt accuracyFraction(fixpt netEnchant);
        !          3192:     fixpt defenseFraction(fixpt netDefense);
        !          3193:
        !          3194:     void checkForDungeonErrors();
        !          3195:
        !          3196:     boolean dialogChooseFile(char *path, const char *suffix, const char *prompt);
        !          3197:     void quitImmediately();
        !          3198:     void dialogAlert(char *message);
        !          3199:     void mainBrogueJunction();
        !          3200:     void printSeedCatalog(unsigned long startingSeed, unsigned long numberOfSeedsToScan, unsigned int scanThroughDepth, boolean isCsvFormat);
        !          3201:
        !          3202:     void initializeButton(brogueButton *button);
        !          3203:     void drawButtonsInState(buttonState *state);
        !          3204:     void initializeButtonState(buttonState *state,
        !          3205:                                brogueButton *buttons,
        !          3206:                                short buttonCount,
        !          3207:                                short winX,
        !          3208:                                short winY,
        !          3209:                                short winWidth,
        !          3210:                                short winHeight);
        !          3211:     short processButtonInput(buttonState *state, boolean *canceled, rogueEvent *event);
        !          3212:     short smoothHiliteGradient(const short currentXValue, const short maxXValue);
        !          3213:     void drawButton(brogueButton *button, enum buttonDrawStates highlight, cellDisplayBuffer dbuf[COLS][ROWS]);
        !          3214:     short buttonInputLoop(brogueButton *buttons,
        !          3215:                           short buttonCount,
        !          3216:                           short winX,
        !          3217:                           short winY,
        !          3218:                           short winWidth,
        !          3219:                           short winHeight,
        !          3220:                           rogueEvent *returnEvent);
        !          3221:
        !          3222:     void dijkstraScan(short **distanceMap, short **costMap, boolean useDiagonals);
        !          3223:     void pdsClear(pdsMap *map, short maxDistance, boolean eightWays);
        !          3224:     void pdsSetDistance(pdsMap *map, short x, short y, short distance);
        !          3225:     void pdsBatchOutput(pdsMap *map, short **distanceMap);
        !          3226:
        !          3227: #if defined __cplusplus
        !          3228: }
        !          3229: #endif

CVSweb