| 1 | /** |
| 2 | * @file random_maps/random_map.h |
| 3 | * Random map related variables. |
| 4 | */ |
| 5 | |
| 6 | #ifndef _RANDOM_MAP_H |
| 7 | #define _RANDOM_MAP_H |
| 8 | |
| 9 | #define RM_SIZE 512 |
| 10 | |
| 11 | /** |
| 12 | * Random map parameters. |
| 13 | */ |
| 14 | typedef struct RMParms { |
| 15 | /** |
| 16 | * Name of the wall style file, in /styles/wallstyles, can be an empty |
| 17 | * string in which case a random one is chosen, or "none". |
| 18 | */ |
| 19 | char wallstyle[RM_SIZE]; |
| 20 | /** |
| 21 | * Will contain the actual wall archetype, can be an empty |
| 22 | * string in which case a random one is chosen, or "none". |
| 23 | */ |
| 24 | char wall_name[RM_SIZE]; |
| 25 | /** |
| 26 | * Name of the floor style file, in /styles/floors, can be an empty |
| 27 | * string in which case a random one is chosen, or "none". |
| 28 | */ |
| 29 | char floorstyle[RM_SIZE]; |
| 30 | /** |
| 31 | * Name of the monster style directory, in /styles/monsters, can be an empty |
| 32 | * string in which case a random one is chosen. |
| 33 | */ |
| 34 | char monsterstyle[RM_SIZE]; |
| 35 | /** |
| 36 | * Name of the treasures style file, in /styles/treasurestyles, can be an empty |
| 37 | * string in which case a random one is chosen, or "none". |
| 38 | */ |
| 39 | char treasurestyle[RM_SIZE]; |
| 40 | /** Contains the layout type to generate, see layoutgen() for valid types. */ |
| 41 | char layoutstyle[RM_SIZE]; |
| 42 | /** Name of the doors style file, in /styles/doorstyles, see put_doors(). */ |
| 43 | char doorstyle[RM_SIZE]; |
| 44 | /** |
| 45 | * Name of the decor style file, in /styles/decorstyles, can be an empty |
| 46 | * string in which case a random one is chosen, or "none". |
| 47 | */ |
| 48 | char decorstyle[RM_SIZE]; |
| 49 | /** |
| 50 | * Name of the chests style file, in /styles/cheststyles, can be an empty |
| 51 | * string in which case a random one is chosen. |
| 52 | */ |
| 53 | char cheststyle[RM_SIZE]; |
| 54 | /** Path to the map this random map is generated from, to make an exit back. */ |
| 55 | char origin_map[RM_SIZE]; |
| 56 | /** If not empty, the path of the final map this whole maze leads to. */ |
| 57 | char final_map[RM_SIZE]; |
| 58 | /** If not empty, the archetype name of the exit leading to the final map. */ |
| 59 | char final_exit_archetype[RM_SIZE]; |
| 60 | /** Name of the exit style files, in /styles/exitstyles/{up,down}, can be |
| 61 | * an empty string in which case a random one is chosen, or "none". |
| 62 | */ |
| 63 | char exitstyle[RM_SIZE]; |
| 64 | /** Path of the map from which the random map(s) were created. */ |
| 65 | char this_map[RM_SIZE]; |
| 66 | /** |
| 67 | * If this is "no", then no exit will be made to the final map from the |
| 68 | * previous random map. |
| 69 | */ |
| 70 | char exit_on_final_map[RM_SIZE]; |
| 71 | /** If not empty, will be used in the name of the random keys. */ |
| 72 | char dungeon_name[RM_SIZE]; |
| 73 | |
| 74 | int Xsize; |
| 75 | int Ysize; |
| 76 | int expand2x; |
| 77 | int layoutoptions1; |
| 78 | int layoutoptions2; |
| 79 | int symmetry; |
| 80 | int difficulty; |
| 81 | /** If non zero, this means the difficulty was not zero initially. */ |
| 82 | int difficulty_given; |
| 83 | float difficulty_increase; |
| 84 | int dungeon_level; |
| 85 | int dungeon_depth; |
| 86 | int decoroptions; |
| 87 | int orientation; |
| 88 | int origin_y; |
| 89 | int origin_x; |
| 90 | int random_seed; |
| 91 | int map_layout_style; |
| 92 | /** Total hit points of the monsters in the map, used for treasure generation. */ |
| 93 | long unsigned int total_map_hp; |
| 94 | int treasureoptions; |
| 95 | int symmetry_used; |
| 96 | struct regiondef *region; |
| 97 | /** |
| 98 | * If non zero, then the map will have multiple floors, else only one |
| 99 | * floor will be used. |
| 100 | */ |
| 101 | int multiple_floors; |
| 102 | } RMParms; |
| 103 | |
| 104 | int load_parameters(FILE *fp, int bufstate, RMParms *RP); |
| 105 | |
| 106 | /** |
| 107 | * @defgroup RM_LAYOUT Random map layout |
| 108 | */ |
| 109 | /*@{*/ |
| 110 | #define ONION_LAYOUT 1 |
| 111 | #define MAZE_LAYOUT 2 |
| 112 | #define SPIRAL_LAYOUT 3 |
| 113 | #define ROGUELIKE_LAYOUT 4 |
| 114 | #define SNAKE_LAYOUT 5 |
| 115 | #define SQUARE_SPIRAL_LAYOUT 6 |
| 116 | #define NROFLAYOUTS 6 |
| 117 | /*@}*/ |
| 118 | |
| 119 | /** |
| 120 | * @defgroup OPT_xxx Random map layout options. |
| 121 | * |
| 122 | * Move these defines out of room_gen_onion.c to here, as |
| 123 | * other files (like square_spiral) also uses them. |
| 124 | */ |
| 125 | /*@{*/ |
| 126 | #define OPT_RANDOM 0 /**< Random option. */ |
| 127 | #define OPT_CENTERED 1 /**< Centered. */ |
| 128 | #define OPT_LINEAR 2 /**< Linear doors (default is nonlinear). */ |
| 129 | #define OPT_BOTTOM_C 4 /**< Bottom-centered. */ |
| 130 | #define OPT_BOTTOM_R 8 /**< Bottom-right centered. */ |
| 131 | #define OPT_IRR_SPACE 16 /**< Irregularly/randomly spaced layers (default: regular). */ |
| 132 | #define OPT_WALL_OFF 32 /**< No outer wall. */ |
| 133 | #define OPT_WALLS_ONLY 64 /**< Only walls. */ |
| 134 | #define OPT_NO_DOORS 256 /**< Place walls insead of doors. Produces broken map. */ |
| 135 | /*@}*/ |
| 136 | |
| 137 | /** |
| 138 | * @defgroup SYM_xxx Random map symetry |
| 139 | * Symmetry definitions -- used in this file AND in @ref treasure.c, |
| 140 | * the numerical values matter so don't change them. |
| 141 | */ |
| 142 | /*@{*/ |
| 143 | #define RANDOM_SYM 0 /**< Random symmetry. */ |
| 144 | #define NO_SYM 1 /**< No symmetry. */ |
| 145 | #define X_SYM 2 /**< Vertical symmetry. */ |
| 146 | #define Y_SYM 3 /**< Horizontal symmetry. */ |
| 147 | #define XY_SYM 4 /**< Reflection. */ |
| 148 | /*@}*/ |
| 149 | |
| 150 | /** Minimal size a random should have to actually be generated. */ |
| 151 | #define MIN_RANDOM_MAP_SIZE 10 |
| 152 | |
| 153 | /** |
| 154 | * Macro to get a strongly centered random distribution, |
| 155 | * from 0 to x, centered at x/2 */ |
| 156 | #define BC_RANDOM(x) ((int) ((RANDOM()%(x)+RANDOM()%(x)+RANDOM()%(x))/3.)) |
| 157 | |
| 158 | int set_random_map_variable(RMParms *rp, const char *buf); |
| 159 | |
| 160 | #endif |