Crossfire Server, Branches 1.12
R18729
|
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) |
void | include_map_in_map (mapstruct *dest_map, mapstruct *in_map, int x, int y) |
void | insert_multisquare_ob_in_map (object *new_obj, mapstruct *map) |
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) |
char ** | make_square_spiral_layout (int xsize, int ysize) |
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) |
char ** | maze_gen (int xsize, int ysize, int option) |
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, mapstruct *style_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, 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) |
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) |
void | write_map_parameters_to_string (RMParms *RP, char *buf, int size) |
void | write_parameters_to_string (char *buf, int xsize_n, int ysize_n, const char *wallstyle_n, const char *floorstyle_n, const char *monsterstyle_n, const char *treasurestyle_n, const char *layoutstyle_n, const char *decorstyle_n, const char *doorstyle_n, const char *exitstyle_n, const char *final_map_n, const char *exit_on_final_map_n, const char *this_map_n, int layoutoptions1_n, int layoutoptions2_n, int layoutoptions3_n, int symmetry_n, int dungeon_depth_n, int dungeon_level_n, int difficulty_n, int difficulty_given_n, int decoroptions_n, int orientation_n, int origin_x_n, int origin_y_n, int random_seed_n, int treasureoptions_n, float difficulty_increase) |
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 224 of file room_gen_onion.c.
References draw_onion(), make_doors(), MIN, and OPT_IRR_SPACE.
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 460 of file room_gen_onion.c.
References draw_onion(), make_doors(), MIN, and OPT_IRR_SPACE.
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 516 of file random_map.c.
References surround_flag2(), RMParms::Xsize, 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 149 of file room_gen_onion.c.
References draw_onion(), make_doors(), MIN, and OPT_IRR_SPACE.
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.c.
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 636 of file random_map.c.
References 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.c.
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 53 of file random_map.c.
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 39 of file expand2x.c.
References expand_door(), expand_misc(), and expand_wall().
Referenced by layoutgen(), and main().
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 311 of file treasure.c.
References obj::above, FLAG_MONSTER, freearr_x, freearr_y, GET_MAP_FLAGS, GET_MAP_OB, P_IS_ALIVE, QUERY_FLAG, and SIZEOFFREE.
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 871 of file treasure.c.
References find_doors_in_room_recursive(), wall_blocked(), RMParms::Xsize, 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 824 of file treasure.c.
References door_in_square(), freearr_x, freearr_y, llevError, and LOG().
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 653 of file treasure.c.
References find_archetype(), find_first_free_spot(), freearr_x, freearr_y, SIZEOFFREE1, and surround_flag3().
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 58 of file exit.c.
References 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 513 of file treasure.c.
References find_monster_in_room_recursive(), wall_blocked(), RMParms::Xsize, 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 465 of file treasure.c.
References obj::above, FLAG_ALIVE, freearr_x, freearr_y, GET_MAP_FLAGS, GET_MAP_OB, P_IS_ALIVE, and QUERY_FLAG.
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 141 of file special.c.
References MAP_HEIGHT, and MAP_WIDTH.
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 600 of file treasure.c.
References find_spot_in_room_recursive(), free_spots_struct::number_of_free_spots_in_room, free_spots_struct::room_free_spots_x, free_spots_struct::room_free_spots_y, wall_blocked(), RMParms::Xsize, 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 177 of file style.c.
References Settings::datadir, load_dir(), load_style_map(), S_ISDIR, settings, and snprintf().
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(), place_treasure(), 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 68 of file square_spiral.c.
Referenced by make_square_spiral_layout().
void free_style_maps | ( | void | ) |
Frees cached style maps.
Definition at line 300 of file style.c.
References delete_map(), llevDebug, LOG(), and mapdef::next.
Referenced by cleanup().
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. |
Definition at line 80 of file random_map.c.
References calculate_difficulty(), RMParms::decoroptions, RMParms::decorstyle, RMParms::difficulty, mapdef::difficulty, RMParms::difficulty_given, RMParms::difficulty_increase, RMParms::doorstyle, dump_layout(), RMParms::dungeon_level, RMParms::exitstyle, RMParms::expand2x, fix_auto_apply(), RMParms::floorstyle, gettimeofday(), HUGE_BUF, mapdef::last_reset_time, layoutgen(), make_map_floor(), make_map_walls(), MIN_RANDOM_MAP_SIZE, RMParms::monsterstyle, mapdef::msg, RMParms::orientation, mapdef::path, place_exits(), place_monsters(), place_specials_in_map(), place_treasure(), put_decor(), put_doors(), RMParms::random_seed, RMParms::region, mapdef::region, rotate_layout(), strdup_local(), 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 main().
Copy in_map into dest_map at point x,y
dest_map | map where to copy to. |
in_map | map to copy from. |
x | |
y | coordinates to put in_map to. |
Definition at line 100 of file special.c.
References obj::above, add_button_link(), obj::arch, arch_to_object(), copy_object_with_inv(), FLAG_IS_LINKED, GET_MAP_OB, obj::head, insert_multisquare_ob_in_map(), MAP_HEIGHT, MAP_WIDTH, nuke_map_region(), obj::path_attuned, QUERY_FLAG, obj::x, and obj::y.
Referenced by place_specials_in_map().
Inserts a monster in the map. Some monsters are multisquare, and these guys require special handling.
new_obj | monster to insert. Its x and y fields must be the desired location. |
map | where to insert to. |
Definition at line 49 of file monster.c.
References obj::arch, arch_to_object(), archt::clone, obj::head, INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), obj::map, obj::more, archt::more, obj::x, and obj::y.
Referenced by include_map_in_map(), and place_monsters().
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 361 of file treasure.c.
References add_string(), create_archetype(), distance(), RMParms::dungeon_level, RMParms::dungeon_name, find_closest_monster(), find_first_free_spot(), find_monster_in_room(), find_spot_in_room(), free_string(), freearr_x, freearr_y, insert_ob_in_map(), insert_ob_in_ob(), obj::name, NO_PASS_DOORS, PASS_DOORS, obj::slaying, snprintf(), wall_blocked(), obj::x, RMParms::Xsize, obj::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 203 of file random_map.c.
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_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 83 of file style.c.
References closedir(), dirent::d_name, NAME_MAX, opendir(), pointer_strcmp(), readdir(), S_ISDIR, snprintf(), and strdup_local().
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.c.
References first_map, load_original_map(), MAP_STYLE, mapdef::next, mapdef::path, and styles.
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 952 of file treasure.c.
References add_string(), create_archetype(), DOORED, obj::face, FLAG_REMOVED, free_object(), HIDDEN, insert_ob_in_map(), keyplace(), NO_PASS_DOORS, QUERY_FLAG, remove_adjacent_doors(), remove_ob(), retrofit_joined_wall(), obj::slaying, snprintf(), obj::x, and obj::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 344 of file room_gen_onion.c.
References OPT_BOTTOM_C, OPT_BOTTOM_R, OPT_LINEAR, and OPT_NO_DOORS.
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 89 of file floor.c.
References obj::arch, arch_to_object(), find_style(), get_empty_map(), GET_MAP_OB, INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), RMParms::multiple_floors, pick_random_object(), put_floor(), snprintf(), obj::x, RMParms::Xsize, obj::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 180 of file wall.c.
References obj::arch, arch_to_object(), find_style(), INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), MOVE_ALL, obj::move_allow, obj::move_block, archt::name, pick_joined_wall(), pick_random_object(), snprintf(), RMParms::wall_name, obj::x, RMParms::Xsize, obj::y, and RMParms::Ysize.
Referenced by generate_random_map().
char** make_snake_layout | ( | int | xsize, |
int | ysize | ||
) |
Generate a snake-like layout.
xsize | |
ysize | layout size. |
Definition at line 20 of file snake.c.
Referenced by layoutgen().
char** make_square_spiral_layout | ( | int | xsize, |
int | ysize | ||
) |
Generates a square-spiral layout.
xsize | |
ysize | size of the layout. |
Definition at line 90 of file square_spiral.c.
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 602 of file random_map.c.
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 85 of file room_gen_onion.c.
char** map_gen_spiral | ( | int | xsize, |
int | ysize, | ||
int | option | ||
) |
Generates a spiral layout.
xsize | |
ysize | layout size. |
option | combination of SPIRAL_xxx values. |
Definition at line 68 of file room_gen_spiral.c.
char** maze_gen | ( | int | xsize, |
int | ysize, | ||
int | option | ||
) |
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. |
Definition at line 68 of file maze_gen.c.
References fill_maze_full(), fill_maze_sparse(), make_wall_free_list(), pop_wall_point(), free_walls_struct::wall_free_size, free_walls_struct::wall_x_list, and free_walls_struct::wall_y_list.
Referenced by layoutgen().
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 70 of file special.c.
References obj::above, FLAG_IS_FLOOR, free_object(), GET_MAP_OB, obj::head, QUERY_FLAG, and remove_ob().
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 51 of file decor.c.
References obj::above, and GET_MAP_OB.
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 241 of file wall.c.
References obj::arch, arch_to_object(), archt::name, surround_flag2(), and try_find_archetype().
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 275 of file style.c.
References GET_MAP_OB, obj::head, MAP_HEIGHT, and MAP_WIDTH.
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, | ||
mapstruct * | style_map, | ||
int | n_treasures, | ||
RMParms * | RP | ||
) |
Put a chest into the map. near x and y, with the treasure style determined (may be null, or may be a treasure list from lib/treasures, if the global variable "treasurestyle" is set to that treasure list's name
treasureoptions | options. |
x | |
y | around which spot to put treasure. |
map | map to put on. |
style_map | unused. |
n_treasures | ? |
RP | parameters the map was generated from. |
Definition at line 232 of file treasure.c.
References add_string(), obj::arch, arch_to_object(), BC_RANDOM, liv::Cha, copy_object(), create_archetype(), RMParms::difficulty, find_first_free_spot(), find_style(), find_treasurelist(), free_object(), freearr_x, freearr_y, liv::hp, insert_ob_in_map(), insert_ob_in_ob(), keyplace(), KEYREQUIRED, obj::level, PASS_DOORS, pick_random_object(), obj::randomitems, obj::slaying, snprintf(), obj::stats, TRAPPED, wall_blocked(), obj::x, and obj::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 153 of file exit.c.
References add_string(), obj::arch, arch_to_object(), 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_first_free_spot(), find_in_layout(), find_style(), free_object(), freearr_x, freearr_y, GET_MAP_OB, liv::hp, insert_ob_in_map(), MAP_ENTER_X, MAP_ENTER_Y, MOVE_ALL, obj::move_block, obj::msg, RMParms::origin_map, RMParms::origin_x, RMParms::origin_y, mapdef::path, pick_random_object(), ready_map_name(), remove_ob(), set_map_timeout(), obj::slaying, snprintf(), liv::sp, obj::stats, wall_blocked(), write_map_parameters_to_string(), obj::x, RMParms::Xsize, obj::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 192 of file special.c.
References add_string(), copy_object(), create_archetype(), obj::face, find_first_free_spot(), find_style(), FLAG_IDENTIFIED, FLAG_NO_PICK, free_object(), freearr_x, freearr_y, get_object(), insert_ob_in_map(), M_ADAMANT, MAP_HEIGHT, MAP_WIDTH, obj::material, obj::name, obj::name_pl, pick_random_object(), SET_FLAG, obj::x, and obj::y.
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 89 of file monster.c.
References obj::arch, arch_to_object(), copy_object_with_inv(), liv::exp, find_first_free_spot(), find_style(), freearr_x, freearr_y, liv::hp, insert_multisquare_ob_in_map(), level_exp(), MAP_HEIGHT, MAP_WIDTH, archt::more, pick_random_object(), snprintf(), obj::stats, RMParms::total_map_hp, obj::x, RMParms::Xsize, obj::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 235 of file special.c.
References add_string(), copy_object(), RMParms::difficulty, RMParms::difficulty_increase, RMParms::dungeon_level, RMParms::exitstyle, find_first_free_spot(), find_style(), RMParms::floorstyle, freearr_x, freearr_y, get_object(), GLORY_HOLE, HUGE_BUF, insert_ob_in_map(), llevError, LOG(), MAP_HEIGHT, MAP_WIDTH, MIN_RANDOM_MAP_SIZE, MINING_ZONE, mon, obj::msg, NR_OF_HOLE_TYPES, OPT_WALLS_ONLY, ORC_ZONE, pick_random_object(), obj::slaying, RMParms::wallstyle, write_parameters_to_string(), obj::x, and obj::y.
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 323 of file special.c.
References RMParms::difficulty, find_spot_for_submap(), find_style(), include_map_in_map(), MAP_HEIGHT, MAP_WIDTH, NUM_OF_SPECIAL_TYPES, place_fountain_with_specials(), place_special_exit(), 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 empty or 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 empty or NULL for random style, or "none" for no treasures. |
treasureoptions | treasure options. |
RP | random map parameters. |
Definition at line 101 of file treasure.c.
References BC_RANDOM, CONCENTRATED, RMParms::difficulty, DOORED, find_doors_in_room(), find_enclosed_spot(), find_style(), HIDDEN, LAST_OPTION, lock_and_hide_doors(), RMParms::map_layout_style, ONION_LAYOUT, place_chest(), RICH, snprintf(), SPARSE, SPIRAL_LAYOUT, SQUARE_SPIRAL_LAYOUT, surround_by_doors(), RMParms::symmetry_used, RMParms::total_map_hp, wall_blocked(), obj::x, RMParms::Xsize, obj::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 76 of file decor.c.
References obj::arch, arch_to_object(), copy_object(), find_style(), insert_ob_in_map(), obj::move_block, MOVE_BLOCK_DEFAULT, NR_DECOR_OPTIONS, obj_count_in_map(), pick_random_object(), snprintf(), obj::x, RMParms::Xsize, obj::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 80 of file door.c.
References obj::arch, arch_to_object(), copy_object(), find_style(), insert_ob_in_map(), mapdef::path, pick_random_object(), snprintf(), surround_check2(), obj::x, RMParms::Xsize, obj::y, 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 722 of file treasure.c.
References obj::above, FLAG_ALIVE, free_object(), GET_MAP_OB, obj::head, QUERY_FLAG, and remove_ob().
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 362 of file wall.c.
References obj::above, arch_to_object(), DOOR, EXIT, free_object(), GET_MAP_OB, INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), LOCKED_DOOR, obj::map, MOVE_ALL, obj::move_block, obj::move_type, MOVE_WALK, remove_ob(), surround_flag4(), TELEPORTER, try_find_archetype(), obj::type, RMParms::wall_name, obj::x, and obj::y.
Referenced by lock_and_hide_doors().
char** roguelike_layout_gen | ( | int | xsize, |
int | ysize, | ||
int | options | ||
) |
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. |
options | 2 to have circular rooms, 1 for rectanglar ones, another value for random choice. |
Definition at line 69 of file rogue_layout.c.
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 471 of file random_map.c.
References can_make_wall(), make_wall(), 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 403 of file random_map.c.
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 44 of file rogue_layout.c.
Referenced by roguelike_layout_gen().
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 55 of file door.c.
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 56 of file wall.c.
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 88 of file wall.c.
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 120 of file wall.c.
References GET_MAP_MOVE_BLOCK, 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 153 of file wall.c.
References 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 327 of file random_map.c.
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 392 of file exit.c.
References obj::above, GET_MAP_OB, LOCKED_DOOR, MOVE_ALL, obj::move_block, MOVE_BLOCK_DEFAULT, obj::type, UP_OBJ_CHANGE, update_object(), 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 73 of file treasure.c.
References GET_MAP_MOVE_BLOCK, MOVE_BLOCK_DEFAULT, and OUT_OF_REAL_MAP.
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().
void write_map_parameters_to_string | ( | RMParms * | RP, |
char * | buf, | ||
int | bufsize | ||
) |
Creates a suitable message for exit from RP.
RP | parameters to convert to message. |
buf | buffer that will contain RP's values. |
bufsize | length of buf. |
Definition at line 689 of file random_map.c.
References 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::layoutoptions3, RMParms::layoutstyle, RMParms::monsterstyle, RMParms::multiple_floors, RMParms::orientation, RMParms::origin_x, RMParms::origin_y, RMParms::random_seed, snprintf(), RMParms::symmetry, RMParms::this_map, RMParms::treasureoptions, RMParms::treasurestyle, RMParms::wallstyle, RMParms::Xsize, and RMParms::Ysize.
Referenced by generate_random_map(), and place_exits().
void write_parameters_to_string | ( | char * | buf, |
int | xsize_n, | ||
int | ysize_n, | ||
const char * | wallstyle_n, | ||
const char * | floorstyle_n, | ||
const char * | monsterstyle_n, | ||
const char * | treasurestyle_n, | ||
const char * | layoutstyle_n, | ||
const char * | decorstyle_n, | ||
const char * | doorstyle_n, | ||
const char * | exitstyle_n, | ||
const char * | final_map_n, | ||
const char * | exit_on_final_map_n, | ||
const char * | this_map_n, | ||
int | layoutoptions1_n, | ||
int | layoutoptions2_n, | ||
int | layoutoptions3_n, | ||
int | symmetry_n, | ||
int | dungeon_depth_n, | ||
int | dungeon_level_n, | ||
int | difficulty_n, | ||
int | difficulty_given_n, | ||
int | decoroptions_n, | ||
int | orientation_n, | ||
int | origin_x_n, | ||
int | origin_y_n, | ||
int | random_seed_n, | ||
int | treasureoptions_n, | ||
float | difficulty_increase | ||
) |
Converts various parameters to string suitable for an exit message.
buf | buffer to write to. |
xsize_n | |
ysize_n | |
wallstyle_n | |
floorstyle_n | |
monsterstyle_n | |
treasurestyle_n | |
layoutstyle_n | |
decorstyle_n | |
doorstyle_n | |
exitstyle_n | |
final_map_n | |
exit_on_final_map_n | |
this_map_n | |
layoutoptions1_n | |
layoutoptions2_n | |
layoutoptions3_n | |
symmetry_n | |
dungeon_depth_n | |
dungeon_level_n | |
difficulty_n | |
difficulty_given_n | |
decoroptions_n | |
orientation_n | |
origin_x_n | |
origin_y_n | |
random_seed_n | |
treasureoptions_n | |
difficulty_increase | random map parameters. |
Definition at line 877 of file random_map.c.
References snprintf().
Referenced by place_special_exit().