Crossfire Server, Trunk
|
Go to the source code of this file.
Functions | |
void | bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
void | bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
int | can_make_wall (char **maze, int dx, int dy, int dir, RMParms *RP) |
void | centered_onion (char **maze, int xsize, int ysize, int option, int layers) |
void | connect_spirals (int xsize, int ysize, int sym, char **layout) |
void | doorify_layout (char **maze, RMParms *RP) |
void | draw_onion (char **maze, float *xlocations, float *ylocations, int layers) |
void | dump_layout (char **layout, RMParms *RP) |
char ** | expand2x (char **layout, int xsize, int ysize) |
object * | find_closest_monster (mapstruct *map, int x, int y, RMParms *RP) |
object ** | find_doors_in_room (mapstruct *map, int x, int y, RMParms *RP) |
void | find_doors_in_room_recursive (char **layout, mapstruct *map, int x, int y, object **doorlist, int *ndoors, RMParms *RP) |
void | find_enclosed_spot (mapstruct *map, int *cx, int *cy, RMParms *RP) |
void | find_in_layout (int mode, char target, int *fx, int *fy, char **layout, RMParms *RP) |
object * | find_monster_in_room (mapstruct *map, int x, int y, RMParms *RP) |
object * | find_monster_in_room_recursive (char **layout, mapstruct *map, int x, int y, RMParms *RP) |
int | find_spot_for_submap (mapstruct *map, char **layout, int *ix, int *iy, int xsize, int ysize) |
int | find_spot_in_room (mapstruct *map, int x, int y, int *kx, int *ky, RMParms *RP) |
mapstruct * | find_style (const char *dirname, const char *stylename, int difficulty) |
void | find_top_left_corner (char **maze, int *cx, int *cy) |
void | free_style_maps (void) |
mapstruct * | generate_random_map (const char *OutFileName, RMParms *RP, char **use_layout, sstring reset_group) |
void | include_map_in_map (mapstruct *dest_map, const mapstruct *in_map, int x, int y) |
int | keyplace (mapstruct *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms *RP) |
char ** | layoutgen (RMParms *RP) |
int | load_dir (const char *dir, char ***namelist, int skip_dirs) |
mapstruct * | load_style_map (char *style_name) |
void | lock_and_hide_doors (object **doorlist, mapstruct *map, int opts, RMParms *RP) |
void | make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options) |
mapstruct * | make_map_floor (char **layout, char *floorstyle, RMParms *RP) |
void | make_map_walls (mapstruct *map, char **layout, char *w_style, RMParms *RP) |
char ** | make_snake_layout (int xsize, int ysize, int _unused_options, int _unused_layers) |
char ** | make_square_spiral_layout (int xsize, int ysize, int _unused_options, int _unused_layers) |
int | make_wall (char **maze, int x, int y, int dir) |
char ** | map_gen_onion (int xsize, int ysize, int option, int layers) |
char ** | map_gen_spiral (int xsize, int ysize, int option, int _unused_layers) |
char ** | maze_gen (int xsize, int ysize, int option, int _unused_layers) |
void | nuke_map_region (mapstruct *map, int xstart, int ystart, int xsize, int ysize) |
int | obj_count_in_map (mapstruct *map, int x, int y) |
object * | pick_joined_wall (object *the_wall, char **layout, int i, int j, RMParms *RP) |
object * | pick_random_object (mapstruct *style) |
object * | place_chest (int treasureoptions, int x, int y, mapstruct *map, int n_treasures, RMParms *RP) |
void | place_exits (mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP) |
void | place_fountain_with_specials (mapstruct *map) |
void | place_monsters (mapstruct *map, char *monsterstyle, int difficulty, RMParms *RP) |
void | place_special_exit (mapstruct *map, int hole_type, const RMParms *RP) |
void | place_specials_in_map (mapstruct *map, char **layout, RMParms *RP) |
void | place_treasure (mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP) |
void | put_decor (mapstruct *map, char **maze, char *decorstyle, int decor_option, RMParms *RP) |
void | put_doors (mapstruct *the_map, char **maze, const char *doorstyle, RMParms *RP) |
void | remove_monsters (int x, int y, mapstruct *map) |
object * | retrofit_joined_wall (mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP) |
char ** | roguelike_layout_gen (int xsize, int ysize, int options, int _unused_layers) |
void | roomify_layout (char **maze, RMParms *RP) |
char ** | rotate_layout (char **maze, int rotation, RMParms *RP) |
int | surround_check (char **layout, int i, int j, int Xsize, int Ysize) |
int | surround_check2 (char **layout, int i, int j, int Xsize, int Ysize) |
int | surround_flag (char **layout, int i, int j, RMParms *RP) |
int | surround_flag2 (char **layout, int i, int j, RMParms *RP) |
int | surround_flag3 (mapstruct *map, int i, int j, RMParms *RP) |
int | surround_flag4 (mapstruct *map, int i, int j, RMParms *RP) |
char ** | symmetrize_layout (char **maze, int sym, RMParms *RP) |
void | unblock_exits (mapstruct *map, char **maze, RMParms *RP) |
int | wall_blocked (mapstruct *m, int x, int y) |
StringBuffer * | write_map_parameters_to_string (const RMParms *RP) |
void bottom_centered_onion | ( | char ** | maze, |
int | xsize, | ||
int | ysize, | ||
int | option, | ||
int | layers | ||
) |
Create a bottom-centered layout.
maze | layout. |
xsize | |
ysize | layout size. |
option | combination of OPT_xxx values. |
layers | number of layers to create. |
Definition at line 219 of file room_gen_onion.cpp.
References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, CFweardisguise::option, and RANDOM.
Referenced by map_gen_onion().
void bottom_right_centered_onion | ( | char ** | maze, |
int | xsize, | ||
int | ysize, | ||
int | option, | ||
int | layers | ||
) |
Create a bottom-right-centered layout.
maze | layout. |
xsize | |
ysize | layout size. |
option | combination of OPT_xxx values. |
layers | number of layers to create. |
Definition at line 471 of file room_gen_onion.cpp.
References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, CFweardisguise::option, and RANDOM.
Referenced by map_gen_onion().
int can_make_wall | ( | char ** | maze, |
int | dx, | ||
int | dy, | ||
int | dir, | ||
RMParms * | RP | ||
) |
Checks the layout to see if we can stick a horizontal (dir = 0) wall (or vertical, dir == 1) here which ends up on other walls sensibly.
maze | layout. |
dx | |
dy | coordinates to check |
dir | direction:
|
RP | random map parameters. |
Definition at line 558 of file random_map.cpp.
References surround_flag2(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by roomify_layout().
void centered_onion | ( | char ** | maze, |
int | xsize, | ||
int | ysize, | ||
int | option, | ||
int | layers | ||
) |
Creates a centered onion layout.
maze | layout. |
xsize | |
ysize | layout size. |
option | combination of OPT_xxx values. |
layers | number of layers to create. |
Definition at line 141 of file room_gen_onion.cpp.
References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, CFweardisguise::option, and RANDOM.
Referenced by map_gen_onion().
void connect_spirals | ( | int | xsize, |
int | ysize, | ||
int | sym, | ||
char ** | layout | ||
) |
Connects disjoint spirals which may result from the symmetrization process.
xsize | |
ysize | layout size. |
sym | one of the SYM_xxx values. |
layout | layout to alter. |
Definition at line 159 of file room_gen_spiral.cpp.
References surround_check(), X_SYM, XY_SYM, and Y_SYM.
Referenced by symmetrize_layout().
void doorify_layout | ( | char ** | maze, |
RMParms * | RP | ||
) |
Puts doors at appropriate locations in a layout.
maze | layout. |
RP | map parameters. |
Definition at line 697 of file random_map.cpp.
References RANDOM, surround_flag(), RMParms::Xsize, and RMParms::Ysize.
Referenced by layoutgen().
void draw_onion | ( | char ** | maze, |
float * | xlocations, | ||
float * | ylocations, | ||
int | layers | ||
) |
Draws the lines in the maze defining the onion layers.
maze | map to draw to. |
xlocations | |
ylocations | array of locations. |
layers | number of layers. |
Definition at line 306 of file room_gen_onion.cpp.
References make_face_from_files::int, and banquet::l.
Referenced by bottom_centered_onion(), bottom_right_centered_onion(), and centered_onion().
void dump_layout | ( | char ** | layout, |
RMParms * | RP | ||
) |
Dumps specified layout using printf().
layout | layout to dump. |
RP | layout parameters. |
Definition at line 43 of file random_map.cpp.
References RMParms::Xsize, and RMParms::Ysize.
Referenced by generate_random_map(), and layoutgen().
char** expand2x | ( | char ** | layout, |
int | xsize, | ||
int | ysize | ||
) |
Expands the layout be a factor 2. Doors and walls are taken care of.
layout | layout to expand. Memory is free()d at the end, so pointer becomes invalid. |
xsize | |
ysize | layout size. |
Definition at line 43 of file expand2x.cpp.
References expand_door(), expand_misc(), and expand_wall().
finds the closest monster and returns him, regardless of doors or walls
map | |
x | |
y | where to look from. |
RP | parameters for random map. |
Definition at line 335 of file treasure.cpp.
References FLAG_MONSTER, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, GET_MAP_FLAGS, disinfect::map, P_IS_ALIVE, QUERY_FLAG, SIZEOFFREE, diamondslots::x, and diamondslots::y.
Referenced by keyplace().
Gets all doors in a room.
map | map to look into. |
x | |
y | point of a room to find door for. |
RP | map parameters. |
Definition at line 920 of file treasure.cpp.
References find_doors_in_room_recursive(), disinfect::map, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by place_treasure().
void find_doors_in_room_recursive | ( | char ** | layout, |
mapstruct * | map, | ||
int | x, | ||
int | y, | ||
object ** | doorlist, | ||
int * | ndoors, | ||
RMParms * | RP | ||
) |
The workhorse routine, which finds the doors in a room
layout | |
map | |
x | |
y | random map to look into. |
doorlist | list of doors. |
ndoors | number of found doors. |
RP | map parameters. |
Definition at line 870 of file treasure.cpp.
References door_in_square(), freearr_x, freearr_y, llevError, LOG(), disinfect::map, RANDOM, diamondslots::x, and diamondslots::y.
Referenced by find_doors_in_room().
Searches the map for a spot with walls around it. The more walls the better, but it'll settle for 1 wall, or even 0, but it'll return 0 if no FREE spots are found.
map | where to look. |
cx | |
cy | where to look, and coordinates of found spot. -1 if no spot found. |
RP | parameters of the random map. |
Definition at line 691 of file treasure.cpp.
References archininventory::arch, find_archetype(), freearr_x, freearr_y, disinfect::map, object_find_first_free_spot(), SIZEOFFREE1, surround_flag3(), diamondslots::x, and diamondslots::y.
Referenced by place_treasure().
void find_in_layout | ( | int | mode, |
char | target, | ||
int * | fx, | ||
int * | fy, | ||
char ** | layout, | ||
RMParms * | RP | ||
) |
Find a character in the layout.
mode | how to look:
|
target | character to search. |
fx | |
fy | position of character, or -1 if not found. |
layout | maze. |
RP | maze parameters. |
Definition at line 47 of file exit.cpp.
References RANDOM, RMParms::Xsize, and RMParms::Ysize.
Referenced by place_exits().
Find a monster in a room. Real work is done by find_monster_in_room_recursive().
map | generated map. |
x | |
y | where to look from. |
RP | random map parameters. |
Definition at line 543 of file treasure.cpp.
References find_monster_in_room_recursive(), disinfect::map, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by keyplace().
object* find_monster_in_room_recursive | ( | char ** | layout, |
mapstruct * | map, | ||
int | x, | ||
int | y, | ||
RMParms * | RP | ||
) |
A recursive routine which will return a monster, eventually, if there is one. One should really call find_monster_in_room().
layout | map layout. |
map | generated map. |
x | |
y | where to look from. |
RP | random map parameters. |
Definition at line 492 of file treasure.cpp.
References FLAG_ALIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, GET_MAP_FLAGS, HEAD, disinfect::map, P_IS_ALIVE, QUERY_FLAG, RANDOM, diamondslots::x, and diamondslots::y.
Referenced by find_monster_in_room().
int find_spot_for_submap | ( | mapstruct * | map, |
char ** | layout, | ||
int * | ix, | ||
int * | iy, | ||
int | xsize, | ||
int | ysize | ||
) |
Finds a place to put a submap into.
map | map to insert. |
layout | where to insert into. |
ix | |
iy | coordinates of suitable location if return is 1. |
xsize | |
ysize | size of layout. |
Definition at line 154 of file special.cpp.
References banquet::l, m, disinfect::map, MAP_HEIGHT, MAP_WIDTH, RANDOM, settings, and Settings::special_break_map.
Referenced by place_specials_in_map().
Find a random non-blocked spot in this room to drop a key. Returns 1 if success, 0 else.
map | map to look into. | |
x | ||
y | where to look from. | |
[out] | kx | |
[out] | ky | found spot if 1 is returned. |
RP | random map parameters. |
Definition at line 635 of file treasure.cpp.
References find_spot_in_room_recursive(), disinfect::map, free_spots_struct::number_of_free_spots_in_room, RANDOM, free_spots_struct::room_free_spots_x, free_spots_struct::room_free_spots_y, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by keyplace().
mapstruct* find_style | ( | const char * | dirname, |
const char * | stylename, | ||
int | difficulty | ||
) |
Loads and returns the map requested. Dirname, for example, is "/styles/wallstyles", stylename, is, for example, "castle", difficulty is -1 when difficulty is irrelevant to the style. If dirname is given, but stylename isn't, and difficult is -1, it returns a random style map. Otherwise, it tries to match the difficulty given with a style file, named style_name_# where # is an integer
dirname | where to look. |
stylename | style to use, can be NULL. |
difficulty | style difficulty. |
Definition at line 180 of file style.cpp.
References Settings::datadir, load_dir(), load_style_map(), item::q, RANDOM, settings, and strlcpy().
Referenced by make_map_floor(), make_map_walls(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), place_specials_in_map(), put_decor(), and put_doors().
void find_top_left_corner | ( | char ** | maze, |
int * | cx, | ||
int * | cy | ||
) |
This starts from within a centered onion layer (or between two layers), and looks up until it finds a wall, and then looks right until it finds a vertical wall, i.e., the corner. It sets cx and cy to that. it also starts from cx and cy.
maze | where to look. |
cx | |
cy | where to start from, and detected corner. |
Definition at line 53 of file square_spiral.cpp.
Referenced by make_square_spiral_layout().
void free_style_maps | ( | void | ) |
Frees cached style maps.
Definition at line 312 of file style.cpp.
References delete_map(), llevDebug, LOG(), give::next, mapstruct::next, and styles.
Referenced by cleanup().
mapstruct* generate_random_map | ( | const char * | OutFileName, |
RMParms * | RP, | ||
char ** | use_layout, | ||
sstring | reset_group | ||
) |
Main random map routine. Generates a random map based on specified parameters.
OutFileName | the path the map should have. |
RP | parameters for generation. |
use_layout | if not NULL, this should be a suitable layout. |
reset_group | if not NULL, the reset group this map will be part of, else the path will be used. |
Definition at line 75 of file random_map.cpp.
References add_string(), apply_auto_fix(), buf, calculate_difficulty(), change_map_light(), RMParms::darkness, RMParms::decoroptions, RMParms::decorstyle, RMParms::difficulty, mapstruct::difficulty, RMParms::difficulty_given, RMParms::difficulty_increase, RMParms::doorstyle, dump_layout(), RMParms::dungeon_level, RMParms::exitstyle, RMParms::expand2x, RMParms::floorstyle, make_face_from_files::int, mapstruct::last_reset_time, layoutgen(), make_map_floor(), make_map_walls(), RMParms::map_layout_style, MIN_RANDOM_MAP_SIZE, RMParms::monsterstyle, mapstruct::msg, RMParms::orientation, mapstruct::outdoor, mapstruct::path, place_exits(), place_monsters(), place_specials_in_map(), place_treasure(), put_decor(), put_doors(), RANDOM, RMParms::random_seed, RMParms::region, mapstruct::region, mapstruct::reset_group, ROGUELIKE_LAYOUT, rotate_layout(), safe_strncpy, seconds(), set_darkness_map(), SRANDOM, stringbuffer_finish(), RMParms::treasureoptions, RMParms::treasurestyle, unblock_exits(), RMParms::wallstyle, write_map_parameters_to_string(), RMParms::Xsize, and RMParms::Ysize.
Referenced by cfapi_generate_random_map(), enter_random_map(), enter_random_template_map(), and generate_map().
Copy in_map into dest_map at point x,y. This also copies shop information if set in in_map.
dest_map | map where to copy to. |
in_map | map to copy from. |
x | |
y | coordinates to put in_map to. |
Definition at line 86 of file special.cpp.
References add_button_link(), CALLOC, FLAG_IS_LINKED, FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_AND_CLEAR, shopitems::index, INS_NO_MERGE, INS_NO_WALK_ON, MAP_HEIGHT, MAP_WIDTH, nuke_map_region(), object_copy_with_inv(), object_create_arch(), object_insert_in_map_at(), QUERY_FLAG, mapstruct::shopgreed, mapstruct::shopitems, mapstruct::shopmax, mapstruct::shopmin, mapstruct::shoprace, strdup_local, Ice::tmp, diamondslots::x, and diamondslots::y.
Referenced by place_specials_in_map().
int keyplace | ( | mapstruct * | map, |
int | x, | ||
int | y, | ||
char * | keycode, | ||
int | door_flag, | ||
int | n_keys, | ||
RMParms * | RP | ||
) |
Places keys in the map, preferably in something alive.
The idea is that you call keyplace on x,y where a door is, and it'll make sure a key is placed on both sides of the door.
map | |
x | |
y | where to put a key. |
keycode | keycode is the key's code. |
door_flag | if NO_PASS_DOORS won't cross doors or walls to keyplace, PASS_DOORS will. if PASS_DOORS is set, the x & y values that are passed in are basically meaningless - IMO, it is a bit of misnomer, as when it is set, it just randomly chooses spaces on the map, ideally finding a close monster, to put the key in. In fact, if PASS_DOORS is set, there is no guarantee that the keys will be on both sides of the door - it may happen by randomness, but the code doesn't work to make sure it happens. |
n_keys | number of keys to place. If 1, it will place 1 key. Else, it will place 2-4 keys. |
RP | random map parameters. |
Definition at line 385 of file treasure.cpp.
References add_string(), create_archetype(), RMParms::dungeon_level, RMParms::dungeon_name, find_closest_monster(), find_monster_in_room(), find_spot_in_room(), free_string(), freearr_x, freearr_y, hall_of_fame::keys, disinfect::map, object::name, NO_PASS_DOORS, object_find_first_free_spot(), object_insert_in_map_at(), object_insert_in_ob(), PASS_DOORS, RANDOM, object::slaying, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by lock_and_hide_doors(), and place_chest().
char** layoutgen | ( | RMParms * | RP | ) |
This function builds the actual layout. Selects the layout based on parameters and gives it whatever arguments it needs.
RP | random map parameters. |
Definition at line 225 of file random_map.cpp.
References doorify_layout(), dump_layout(), expand2x(), RMParms::expand2x, RMParms::layoutoptions1, RMParms::layoutoptions2, RMParms::layoutstyle, make_snake_layout(), make_square_spiral_layout(), map_gen_onion(), map_gen_spiral(), RMParms::map_layout_style, maze_gen(), MAZE_LAYOUT, MIN_RANDOM_MAP_SIZE, NO_SYM, NROFLAYOUTS, ONION_LAYOUT, OPT_WALLS_ONLY, RANDOM, RANDOM_SYM, ROGUELIKE_LAYOUT, roguelike_layout_gen(), roomify_layout(), SNAKE_LAYOUT, SPIRAL_LAYOUT, SQUARE_SPIRAL_LAYOUT, symmetrize_layout(), RMParms::symmetry, RMParms::symmetry_used, X_SYM, RMParms::Xsize, XY_SYM, Y_SYM, and RMParms::Ysize.
Referenced by generate_random_map().
int load_dir | ( | const char * | dir, |
char *** | namelist, | ||
int | skip_dirs | ||
) |
This is our own version of scandir/select_regular_files/sort. To support having subdirectories in styles, we need to know if in fact the directory we read is a subdirectory. However, we can't get that through the normal dirent entry. So instead, we do our own where we do have the full directory path so can do stat calls to see if in fact it is a directory. dir is the name of the director to scan. namelist is the array of file names returned. IT needs to be freed by the caller. skip_dirs controls our behavioru - if nonzero, we don't skip any subdirectories - if zero, we store those away, since there are cases where we want to choose a random directory.
dir | directory to list. | |
[out] | namelist | list of files found. |
skip_dirs | if non 0, don't list directories. |
Definition at line 74 of file style.cpp.
References closedir(), give::name, opendir(), pointer_strcmp(), readdir(), strdup_local, and nlohmann::detail::void().
Referenced by find_style().
mapstruct* load_style_map | ( | char * | style_name | ) |
Loads specified map (or take it from cache list).
style_name | map to load. |
Definition at line 131 of file style.cpp.
References first_map, MAP_STYLE, mapfile_load(), mapstruct::next, mapstruct::path, styles, and Ice::tmp.
Referenced by find_style().
Locks and/or hides all the doors in doorlist, or does nothing if opts doesn't say to lock/hide doors. Note that some doors can be not locked if no good spot to put a key was found.
doorlist | doors to list. NULL-terminated. |
map | map we're working on. |
opts | options. |
RP | map parameters. |
Definition at line 1005 of file treasure.cpp.
References add_string(), create_archetype(), DOORED, object::face, FLAG_REMOVED, HIDDEN, keyplace(), disinfect::map, NO_PASS_DOORS, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), QUERY_FLAG, RANDOM, remove_adjacent_doors(), retrofit_joined_wall(), object::slaying, object::x, and object::y.
Referenced by place_treasure().
void make_doors | ( | char ** | maze, |
float * | xlocations, | ||
float * | ylocations, | ||
int | layers, | ||
int | options | ||
) |
Add doors to the layout.
maze | map to draw to. |
xlocations | |
ylocations | array of locations. Will be free()d. |
layers | number of layers. |
options | combination of OPT_xxx values. |
Definition at line 345 of file room_gen_onion.cpp.
References cleanup(), make_face_from_files::int, banquet::l, OPT_BOTTOM_C, OPT_BOTTOM_R, OPT_LINEAR, OPT_NO_DOORS, options, and RANDOM.
Referenced by bottom_centered_onion(), bottom_right_centered_onion(), and centered_onion().
Creates the Crossfire mapstruct object from the layout, and adds the floor.
layout | generated layout. |
floorstyle | floor style. Can be NULL, in which case a random one is chosen. |
RP | parameters of the random map. |
Definition at line 75 of file floor.cpp.
References object::arch, arch_to_object(), find_style(), get_empty_map(), GET_MAP_OB, INS_NO_MERGE, INS_NO_WALK_ON, RMParms::multiple_floors, object_insert_in_map_at(), pick_random_object(), put_floor(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by generate_random_map().
takes a map and a layout, and puts walls in the map (picked from w_style) at '#' marks.
map | map where walls will be put. |
layout | layout containing walls and such. |
w_style | wall style. Must not be NULL, can be "none". |
RP | map parameters. |
Definition at line 184 of file wall.cpp.
References object::arch, arch_to_object(), find_style(), INS_NO_MERGE, INS_NO_WALK_ON, disinfect::map, MOVE_ALL, object::move_allow, object::move_block, archetype::name, object_insert_in_map_at(), pick_joined_wall(), pick_random_object(), strlcpy(), RMParms::wall_name, RMParms::Xsize, and RMParms::Ysize.
Referenced by generate_random_map().
char** make_snake_layout | ( | int | xsize, |
int | ysize, | ||
int | _unused_option, | ||
int | _unused_layers | ||
) |
Generate a snake-like layout.
xsize | |
ysize | layout size. |
_unused_option | unused. |
_unused_layers | unused. |
Definition at line 36 of file snake.cpp.
References RANDOM, and nlohmann::detail::void().
Referenced by layoutgen().
char** make_square_spiral_layout | ( | int | xsize, |
int | ysize, | ||
int | _unused_option, | ||
int | _unused_layers | ||
) |
Generates a square-spiral layout.
xsize | |
ysize | size of the layout. |
_unused_option | unused. |
_unused_layers | unused. |
Definition at line 80 of file square_spiral.cpp.
References find_top_left_corner(), make_wall(), map_gen_onion(), OPT_CENTERED, OPT_NO_DOORS, RANDOM, and nlohmann::detail::void().
Referenced by layoutgen().
int make_wall | ( | char ** | maze, |
int | x, | ||
int | y, | ||
int | dir | ||
) |
Cuts the layout horizontally or vertically by a wall with a door.
maze | layout. |
x | |
y | where to put the door. |
dir | wall direction:
|
Definition at line 658 of file random_map.cpp.
References diamondslots::x, and diamondslots::y.
Referenced by make_square_spiral_layout(), and roomify_layout().
char** map_gen_onion | ( | int | xsize, |
int | ysize, | ||
int | option, | ||
int | layers | ||
) |
Generates an onion layout.
xsize | |
ysize | layout size. |
option | combination of OPT_xxx values. |
layers | number of layers the onion should have. |
Definition at line 70 of file room_gen_onion.cpp.
char** map_gen_spiral | ( | int | xsize, |
int | ysize, | ||
int | option, | ||
int | _unused_layers | ||
) |
Generates a spiral layout.
xsize | |
ysize | layout size. |
option | combination of SPIRAL_xxx values. |
_unused_layers | unused. |
Definition at line 62 of file room_gen_spiral.cpp.
References FINE_SPIRAL, FIT_SPIRAL, make_face_from_files::int, MAX_FINE, MAX_SPIRAL_OPT, MIN, CFweardisguise::option, RANDOM, REGULAR_SPIRAL, nlohmann::detail::void(), diamondslots::x, and diamondslots::y.
Referenced by layoutgen().
char** maze_gen | ( | int | xsize, |
int | ysize, | ||
int | option, | ||
int | _unused_layers | ||
) |
This function generates a random blocked maze with the property that there is only one path from one spot to any other, and there is always a path from one spot to any other.
xsize | |
ysize | wanted map size. |
option | if 0, maze will be sparse (sizeable rooms), else totally filled. |
_unused_layers | unused. |
Definition at line 59 of file maze_gen.cpp.
References fill_maze_full(), fill_maze_sparse(), make_wall_free_list(), CFweardisguise::option, pop_wall_point(), nlohmann::detail::void(), free_walls_struct::wall_free_size, free_walls_struct::wall_x_list, and free_walls_struct::wall_y_list.
void nuke_map_region | ( | mapstruct * | map, |
int | xstart, | ||
int | ystart, | ||
int | xsize, | ||
int | ysize | ||
) |
Erases all objects (except floor) in the given rectangle.
map | map to process. |
xstart | |
ystart | top-left coordinates of zone. |
xsize | |
ysize | size of zone. |
Definition at line 59 of file special.cpp.
References FLAG_IS_FLOOR, FOR_MAP_FINISH, FOR_MAP_PREPARE, HEAD, disinfect::map, object_free_drop_inventory(), object_remove(), QUERY_FLAG, and Ice::tmp.
Referenced by include_map_in_map().
int obj_count_in_map | ( | mapstruct * | map, |
int | x, | ||
int | y | ||
) |
Count objects at a spot.
map | map we want to check |
x | |
y | coordinates |
Definition at line 39 of file decor.cpp.
References disinfect::count, FOR_MAP_FINISH, FOR_MAP_PREPARE, disinfect::map, Ice::tmp, diamondslots::x, and diamondslots::y.
Referenced by put_decor().
Picks the right wall type for this square, to make it look nice, and have everything nicely joined. It uses the layout.
the_wall | wall we want to insert. |
layout | |
i | |
j | where to insert. |
RP | map parameters. |
Definition at line 255 of file wall.cpp.
References object::arch, arch_to_object(), banquet::l, archetype::name, surround_flag2(), try_find_archetype(), and wall_join.
Referenced by make_map_walls().
Picks a random object from a style map. Redone by MSW so it should be faster and not use static variables to generate tables.
style | map to pick from. |
Definition at line 289 of file style.cpp.
References GET_MAP_OB, HEAD, MAP_HEIGHT, MAP_WIDTH, RANDOM, CFInsulter::style, diamondslots::x, and diamondslots::y.
Referenced by make_map_floor(), make_map_walls(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), put_decor(), and put_doors().
object* place_chest | ( | int | treasureoptions, |
int | x, | ||
int | y, | ||
mapstruct * | map, | ||
int | n_treasures, | ||
RMParms * | RP | ||
) |
Put a chest into the map, near x and y, with a chest from the styles/cheststyles map.
treasureoptions | options. |
x | |
y | around which spot to put treasure. |
map | map to put on. |
n_treasures | ? |
RP | parameters the map was generated from. |
Definition at line 220 of file treasure.cpp.
References add_string(), BC_RANDOM, living::Cha, RMParms::cheststyle, create_archetype(), RMParms::difficulty, find_style(), find_treasurelist(), freearr_x, freearr_y, living::hp, keyplace(), KEYREQUIRED, object::level, disinfect::map, MIMIC, object_copy_with_inv(), object_find_first_free_spot(), object_free_drop_inventory(), object_insert_in_map_at(), object_insert_in_ob(), object_new(), PASS_DOORS, pick_random_object(), RANDOM, object::randomitems, object::slaying, object::stats, TRAPPED, TREASURE, object::type, wall_blocked(), diamondslots::x, object::x, diamondslots::y, and object::y.
Referenced by place_treasure().
Place exits in the map.
map | map to put exits into. |
maze | map layout. |
exitstyle | what style to use. If NULL uses a random one. |
orientation | how exits should be oriented:
|
RP | map parameters. |
Definition at line 144 of file exit.cpp.
References add_string(), archininventory::arch, object::arch, arch_to_object(), buf, create_archetype(), RMParms::dungeon_depth, RMParms::dungeon_level, EXIT, RMParms::exit_on_final_map, EXIT_PATH, EXIT_X, EXIT_Y, RMParms::final_exit_archetype, RMParms::final_map, find_archetype(), find_in_layout(), find_style(), FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, living::hp, disinfect::map, MAP_ENTER_X, MAP_ENTER_Y, MOVE_ALL, object::move_block, object_find_first_free_spot(), object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_set_msg(), RMParms::origin_map, RMParms::origin_x, RMParms::origin_y, mapstruct::path, pick_random_object(), RANDOM, ready_map_name(), mapstruct::reset_group, set_map_timeout(), object::slaying, living::sp, object::stats, stringbuffer_finish(), Ice::tmp, try_find_archetype(), wall_blocked(), write_map_parameters_to_string(), object::x, RMParms::Xsize, object::y, and RMParms::Ysize.
Referenced by generate_random_map().
void place_fountain_with_specials | ( | mapstruct * | map | ) |
Places a special fountain on the map.
map | map to place to. |
Definition at line 217 of file special.cpp.
References object::anim_speed, object::animation, CLEAR_FLAG, archetype::clone, object::face, find_archetype(), find_style(), FLAG_ANIMATE, FLAG_CLIENT_ANIM_RANDOM, FLAG_IDENTIFIED, FLAG_NO_PICK, FREE_AND_CLEAR_STR, FREE_AND_COPY, freearr_x, freearr_y, disinfect::map, MAP_HEIGHT, MAP_WIDTH, object::material, object::materialname, object::name, archetype::name, object::name_pl, object_copy_with_inv(), object_find_first_free_spot(), object_free_drop_inventory(), object_insert_in_map_at(), object_new(), object_set_value(), object_update_speed(), pick_random_object(), QUERY_FLAG, RANDOM, SET_FLAG, and object::speed.
Referenced by place_specials_in_map().
Place some monsters into the map. Their experience is linked to difficulty to insert a suitable number of critters.
map | where to put monsters on. |
monsterstyle | style. Can be NULL, in which case a random one is used. |
difficulty | how difficult the monsters should be, and how many there should be. |
RP | random map parameters. |
Definition at line 38 of file monster.cpp.
References object::arch, living::exp, find_style(), freearr_x, freearr_y, generate_artifact(), living::hp, INS_NO_MERGE, INS_NO_WALK_ON, level_exp(), disinfect::map, MAP_HEIGHT, MAP_WIDTH, archetype::more, object_copy_with_inv(), object_create_arch(), object_find_first_free_spot(), object_insert_in_map_at(), pick_random_object(), RANDOM, rndm(), object::stats, RMParms::total_map_hp, diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by generate_random_map().
Place an exit with a resource map.
map | where to put the exit. |
hole_type | type of random map to link to, see HOLE_xxx. |
RP | parameters from which map was generated. |
Definition at line 277 of file special.cpp.
References add_string(), buf, RMParms::decoroptions, RMParms::decorstyle, RMParms::difficulty, RMParms::difficulty_given, RMParms::difficulty_increase, RMParms::doorstyle, RMParms::dungeon_depth, RMParms::dungeon_level, RMParms::exit_on_final_map, RMParms::exitstyle, RMParms::final_map, find_style(), RMParms::floorstyle, freearr_x, freearr_y, GLORY_HOLE, RMParms::layoutoptions1, RMParms::layoutoptions2, RMParms::layoutstyle, llevError, LOG(), disinfect::map, MAP_HEIGHT, MAP_WIDTH, MIN_RANDOM_MAP_SIZE, MINING_ZONE, mon, RMParms::monsterstyle, NR_OF_HOLE_TYPES, object_copy(), object_find_first_free_spot(), object_insert_in_map_at(), object_new(), object_set_msg(), OPT_WALLS_ONLY, ORC_ZONE, RMParms::orientation, RMParms::origin_x, RMParms::origin_y, pick_random_object(), RANDOM, RMParms::random_seed, object::slaying, stringbuffer_finish(), CFInsulter::style, RMParms::symmetry, RMParms::this_map, RMParms::treasureoptions, RMParms::treasurestyle, RMParms::wallstyle, write_map_parameters_to_string(), RMParms::Xsize, and RMParms::Ysize.
Referenced by place_specials_in_map().
Main function for specials.
map | map to alter. |
layout | layout the map was generated from. |
RP | parameters the map was generated from. |
Definition at line 396 of file special.cpp.
References RMParms::difficulty, find_spot_for_submap(), find_style(), include_map_in_map(), disinfect::map, MAP_HEIGHT, MAP_WIDTH, NUM_OF_SPECIAL_TYPES, place_fountain_with_specials(), place_special_exit(), RANDOM, SPECIAL_EXIT, SPECIAL_FOUNTAIN, and SPECIAL_SUBMAP.
Referenced by generate_random_map().
void place_treasure | ( | mapstruct * | map, |
char ** | layout, | ||
char * | treasure_style, | ||
int | treasureoptions, | ||
RMParms * | RP | ||
) |
Place treasures in the map. map, (required) layout, (required) treasure style (may be NULL or "none" to cause no treasure.) treasureoptions (may be 0 for random choices or positive)
map | where to insert to. |
layout | layout the map was generated from. |
treasure_style | treasure style. May be NULL or "none" for no treasures, any other value to put treasures. |
treasureoptions | treasure options. |
RP | random map parameters. |
Definition at line 92 of file treasure.cpp.
References BC_RANDOM, CONCENTRATED, RMParms::difficulty, DOORED, find_doors_in_room(), find_enclosed_spot(), HIDDEN, LAST_OPTION, lock_and_hide_doors(), disinfect::map, RMParms::map_layout_style, ONION_LAYOUT, place_chest(), RANDOM, RICH, SPARSE, SPIRAL_LAYOUT, SQUARE_SPIRAL_LAYOUT, surround_by_doors(), RMParms::symmetry_used, RMParms::total_map_hp, wall_blocked(), object::x, RMParms::Xsize, object::y, and RMParms::Ysize.
Referenced by generate_random_map().
Put the decor into the map. Right now, it's very primitive.
map | map to add decor to. |
maze | layout of the map, as was generated. |
decorstyle | style to use. Can be NULL. |
decor_option | how to place decor:
|
RP | parameters of the random map. |
Definition at line 65 of file decor.cpp.
References object::arch, arch_to_object(), find_style(), disinfect::map, NR_DECOR_OPTIONS, obj_count_in_map(), object_copy(), object_insert_in_map_at(), pick_random_object(), RANDOM, diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.
Referenced by generate_random_map().
Add doors to a map.
the_map | map we're adding doors to. |
maze | maze layout. |
doorstyle | door style to be. If "none", won't do anything. If NULL, will choose one randomly. |
RP | random map parameters. |
Definition at line 73 of file door.cpp.
References object::arch, arch_to_object(), find_style(), object_copy(), object_insert_in_map_at(), mapstruct::path, pick_random_object(), surround_check2(), RMParms::Xsize, and RMParms::Ysize.
Referenced by generate_random_map().
void remove_monsters | ( | int | x, |
int | y, | ||
mapstruct * | map | ||
) |
Remove living things on specified spot.
x | |
y | |
map | where to remove. |
Definition at line 764 of file treasure.cpp.
References FLAG_ALIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_OB, HEAD, disinfect::map, object_free_drop_inventory(), object_remove(), QUERY_FLAG, Ice::tmp, diamondslots::x, and diamondslots::y.
Referenced by surround_by_doors().
this takes a map, and changes an existing wall to match what's blocked around it, counting only doors and walls as blocked. If insert_flag is 1, . If not, it will only return the wall which would belong there, and doesn't remove anything. It depends on the global, previously-set variable, "wall_name"
the_map | |
i | |
j | where to look. |
insert_flag | if 1, insert the correct wall into the map, else don't insert. |
RP | map parameters. |
Definition at line 314 of file wall.cpp.
References arch_to_object(), DOOR, EXIT, FOR_MAP_FINISH, FOR_MAP_PREPARE, INS_NO_MERGE, INS_NO_WALK_ON, banquet::l, LOCKED_DOOR, object::map, MOVE_ALL, object::move_block, MOVE_WALK, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), surround_flag4(), TELEPORTER, Ice::tmp, try_find_archetype(), object::type, wall_join, and RMParms::wall_name.
Referenced by lock_and_hide_doors().
char** roguelike_layout_gen | ( | int | xsize, |
int | ysize, | ||
int | _unused_options, | ||
int | _unused_layers | ||
) |
Actually make the rogue layout. We work by a reduction process: first we make everything a wall, then we remove areas to make rooms
xsize | |
ysize | wanted layout size. |
_unused_options | unused. |
_unused_layers | unused. |
Definition at line 309 of file rogue_layout.cpp.
References RANDOM, roguelike_link_rooms(), roguelike_make_rooms(), roguelike_place_room(), surround_check(), nlohmann::detail::void(), Room::x, and Room::y.
Referenced by layoutgen(), and main().
void roomify_layout | ( | char ** | maze, |
RMParms * | RP | ||
) |
Take a layout and make some rooms in it. Works best on onions.
maze | layout to alter. |
RP | map parameters. |
Definition at line 510 of file random_map.cpp.
References can_make_wall(), make_wall(), RANDOM, RMParms::Xsize, and RMParms::Ysize.
Referenced by layoutgen().
char** rotate_layout | ( | char ** | maze, |
int | rotation, | ||
RMParms * | RP | ||
) |
Takes a map and rotates it. This completes the onion layouts, making them possibly centered on any wall. It'll modify Xsize and Ysize if they're swapped.
maze | layout to rotate, will be free()d by this function. |
rotation | how to rotate:
|
RP | random map parameters. |
Definition at line 441 of file random_map.cpp.
References RMParms::Xsize, and RMParms::Ysize.
Referenced by generate_random_map().
int surround_check | ( | char ** | layout, |
int | i, | ||
int | j, | ||
int | Xsize, | ||
int | Ysize | ||
) |
Checks free spots around a spot.
layout | map layout. |
i | |
j | coordinates to check. |
Xsize | |
Ysize | size of the layout. |
Definition at line 280 of file rogue_layout.cpp.
int surround_check2 | ( | char ** | layout, |
int | i, | ||
int | j, | ||
int | Xsize, | ||
int | Ysize | ||
) |
Serch for doors or walls around a spot.
layout | maze. |
i | |
j | coordinates to check. |
Xsize | |
Ysize | maze size. |
Definition at line 43 of file door.cpp.
Referenced by put_doors().
int surround_flag | ( | char ** | layout, |
int | i, | ||
int | j, | ||
RMParms * | RP | ||
) |
Given a layout and a coordinate, tell me which squares up/down/right/left are occupied.
layout | |
i | |
j | spot to look. |
RP | map parameters. |
Definition at line 40 of file wall.cpp.
Referenced by doorify_layout().
int surround_flag2 | ( | char ** | layout, |
int | i, | ||
int | j, | ||
RMParms * | RP | ||
) |
Given a layout and a coordinate, tell me which squares up/down/right/left are occupied by walls.
layout | |
i | |
j | spot to look. |
RP | map parameters. |
Definition at line 77 of file wall.cpp.
Referenced by can_make_wall(), and pick_joined_wall().
Check a map for blocked spots. Since this is part of the random map code, presumption is that this is not a tiled map. What is considered blocking and not is somewhat hard coded.
map | |
i | |
j | spot to look. |
RP | map parameters. |
Definition at line 114 of file wall.cpp.
References GET_MAP_MOVE_BLOCK, disinfect::map, and MOVE_BLOCK_DEFAULT.
Referenced by find_enclosed_spot().
Check a map for spots with walls. Since this is part of the random map code, presumption is that this is not a tiled map. What is considered blocking and not is somewhat hard coded.
map | |
i | |
j | spot to look. |
RP | map parameters. |
Definition at line 152 of file wall.cpp.
References disinfect::map, and wall_blocked().
Referenced by retrofit_joined_wall().
char** symmetrize_layout | ( | char ** | maze, |
int | sym, | ||
RMParms * | RP | ||
) |
Takes a map and makes it symmetric: adjusts Xsize and Ysize to produce a symmetric map.
maze | layout to symmetrize. Will be free()d by this function. |
sym | how to make symetric, a Random map symetry value. |
RP | map parameters. |
Definition at line 360 of file random_map.cpp.
References connect_spirals(), RMParms::map_layout_style, NO_SYM, ROGUELIKE_LAYOUT, SPIRAL_LAYOUT, RMParms::symmetry_used, X_SYM, RMParms::Xsize, XY_SYM, Y_SYM, and RMParms::Ysize.
Referenced by layoutgen().
This function unblocks the exits. We blocked them to keep things from being dumped on them during the other phases of random map generation.
map | map to alter. |
maze | map layout. |
RP | map generation parameters. |
Definition at line 401 of file exit.cpp.
References FOR_MAP_FINISH, FOR_MAP_PREPARE, LOCKED_DOOR, disinfect::map, MOVE_ALL, MOVE_BLOCK_DEFAULT, object_update(), UP_OBJ_CHANGE, RMParms::Xsize, and RMParms::Ysize.
Referenced by generate_random_map().
int wall_blocked | ( | mapstruct * | m, |
int | x, | ||
int | y | ||
) |
Returns true if square x,y has P_NO_PASS set, which is true for walls and doors but not monsters. This function is not map tile aware.
m | |
x | |
y | map and coordinates to check for. |
Definition at line 62 of file treasure.cpp.
References GET_MAP_MOVE_BLOCK, m, MOVE_BLOCK_DEFAULT, OUT_OF_REAL_MAP, ring_occidental_mages::r, diamondslots::x, and diamondslots::y.
Referenced by find_doors_in_room(), find_monster_in_room(), find_spot_in_room(), keyplace(), place_chest(), place_exits(), place_treasure(), surround_by_doors(), and surround_flag4().
StringBuffer* write_map_parameters_to_string | ( | const RMParms * | RP | ) |
Creates a suitable message for exit from RP.
RP | parameters to convert to message. |
Definition at line 749 of file random_map.cpp.
References buf, RMParms::cheststyle, RMParms::darkness, RMParms::decoroptions, RMParms::decorstyle, RMParms::difficulty, RMParms::difficulty_given, RMParms::difficulty_increase, RMParms::doorstyle, RMParms::dungeon_depth, RMParms::dungeon_level, RMParms::dungeon_name, RMParms::exit_on_final_map, RMParms::exitstyle, RMParms::expand2x, RMParms::final_exit_archetype, RMParms::final_map, RMParms::floorstyle, RMParms::layoutoptions1, RMParms::layoutoptions2, RMParms::layoutstyle, RMParms::link_source_map, RMParms::monsterstyle, RMParms::multiple_floors, RMParms::orientation, RMParms::origin_x, RMParms::origin_y, RMParms::outdoor, RMParms::random_seed, stringbuffer_append_printf(), stringbuffer_new(), RMParms::symmetry, RMParms::this_map, RMParms::treasureoptions, RMParms::treasurestyle, RMParms::wallstyle, RMParms::Xsize, and RMParms::Ysize.
Referenced by generate_random_map(), place_exits(), place_special_exit(), CREMapInformationManager::storeCache(), and CRERandomMapPanel::updateItem().