/* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2001 Mark Wedel & Crossfire Development Team * Copyright (©) 1992 Frank Tore Johansen * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your * option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the Affero GNU General Public License * and the GNU General Public License along with this program. If not, see * . * * The authors can be reached via e-mail to */ #ifndef RANDOM_MAP_H #define RANDOM_MAP_H #include "util.h" struct random_map_params { char wallstyle[512]; char wall_name[512]; char floorstyle[512]; char monsterstyle[512]; char treasurestyle[512]; char layoutstyle[512]; char doorstyle[512]; char decorstyle[512]; shstr origin_map; shstr final_map; char exitstyle[512]; shstr this_map; char exit_on_final_map[512]; char *custom; int xsize, ysize; int expand2x; int layoutoptions1; int layoutoptions2; int layoutoptions3; int symmetry; int difficulty; int difficulty_given; float difficulty_increase; int dungeon_level; int dungeon_depth; int decoroptions; int orientation; int origin_y; int origin_x; uint32_t random_seed; uint64_t total_map_hp; int map_layout_style; int treasureoptions; int symmetry_used; struct region *region; // "private", adjusted sizes int Xsize; int Ysize; }; enum { LAYOUT_NONE, LAYOUT_ONION, LAYOUT_MAZE, LAYOUT_SPIRAL, LAYOUT_ROGUELIKE, LAYOUT_SNAKE, LAYOUT_SQUARE_SPIRAL, NROFLAYOUTS, }; /* * Move these defines out of room_gen_onion.c to here, as * other files (like square_spiral) also uses them. options: 0 Pick random options below 1 "centered" 2 linear doors (default is nonlinear) 4 bottom "centered" 8 bottom-right centered 16 irregularly/randomly spaced layers (default: regular) 32 outer wall off: i.e., no outer wall. */ enum { RMOPT_RANDOM = 0, RMOPT_CENTERED = 1, RMOPT_LINEAR = 2, RMOPT_BOTTOM_C = 4, RMOPT_BOTTOM_R = 8, RMOPT_IRR_SPACE = 16, RMOPT_WALL_OFF = 32, RMOPT_WALLS_ONLY = 64, RMOPT_NO_DOORS = 256, /* Place walls insead of doors. Produces broken map. */ }; /* symmetry definitions--used in this file AND in treasure.c: the numerical values matter so don't change them. */ enum { SYMMETRY_RANDOM, SYMMETRY_NONE, SYMMETRY_X, SYMMETRY_Y, SYMMETRY_XY, }; // 12 has been experimentally :( determined ot be a lot more stable // than 11 or 10, leading to the assumption that something inherently // needs a minimum size of at least 12 #define MIN_RANDOM_MAP_SIZE 12 // reference // // \0 floor only // # wall // D door // < up // > down // C "center" (of onion layout) // . ?? (rogue) // struct LayoutData : zero_initialised { char **col; int w, h; LayoutData (int w, int h); ~LayoutData (); operator char **() { return col; } void clear (char fill = 0); void border (char fill = '#'); }; struct Layout { LayoutData *ptr; Layout () { } Layout (int xsize, int ysize) : ptr (new LayoutData (xsize, ysize)) { } Layout (random_map_params *RP) : ptr (new LayoutData (RP->Xsize, RP->Ysize)) { } void free () { delete ptr; } LayoutData *operator ->() const { return ptr; } operator char **() const { return *ptr; } void swap (const Layout &layout) const { ::swap (layout.ptr->col, ptr->col); ::swap (layout.ptr->w , ptr->w ); ::swap (layout.ptr->h , ptr->h ); } }; #endif