Crossfire Server, Trunk  R20513
rproto.h
Go to the documentation of this file.
1 #ifndef _RPROTO_H
2 #define _RPROTO_H
3 
4 /* random_map.c */
5 extern void dump_layout(char **layout, RMParms *RP);
6 extern mapstruct *generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout);
7 extern char **layoutgen(RMParms *RP);
8 extern char **symmetrize_layout(char **maze, int sym, RMParms *RP);
9 extern char **rotate_layout(char **maze, int rotation, RMParms *RP);
10 extern void roomify_layout(char **maze, RMParms *RP);
11 extern int can_make_wall(char **maze, int dx, int dy, int dir, RMParms *RP);
12 extern int make_wall(char **maze, int x, int y, int dir);
13 extern void doorify_layout(char **maze, RMParms *RP);
15 /* room_gen_onion.c */
16 extern char **map_gen_onion(int xsize, int ysize, int option, int layers);
17 extern void centered_onion(char **maze, int xsize, int ysize, int option, int layers);
18 extern void bottom_centered_onion(char **maze, int xsize, int ysize, int option, int layers);
19 extern void draw_onion(char **maze, float *xlocations, float *ylocations, int layers);
20 extern void make_doors(char **maze, float *xlocations, float *ylocations, int layers, int options);
21 extern void bottom_right_centered_onion(char **maze, int xsize, int ysize, int option, int layers);
22 /* room_gen_spiral.c */
23 extern char **map_gen_spiral(int xsize, int ysize, int option);
24 extern void connect_spirals(int xsize, int ysize, int sym, char **layout);
25 /* maze_gen.c */
26 extern char **maze_gen(int xsize, int ysize, int option);
27 /* floor.c */
28 extern mapstruct *make_map_floor(char **layout, char *floorstyle, RMParms *RP);
29 /* wall.c */
30 extern int surround_flag(char **layout, int i, int j, RMParms *RP);
31 extern int surround_flag2(char **layout, int i, int j, RMParms *RP);
32 extern int surround_flag3(mapstruct *map, int i, int j, RMParms *RP);
33 extern int surround_flag4(mapstruct *map, int i, int j, RMParms *RP);
34 extern void make_map_walls(mapstruct *map, char **layout, char *w_style, RMParms *RP);
35 extern object *pick_joined_wall(object *the_wall, char **layout, int i, int j, RMParms *RP);
36 extern object *retrofit_joined_wall(mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP);
37 /* monster.c */
38 extern void place_monsters(mapstruct *map, char *monsterstyle, int difficulty, RMParms *RP);
39 /* door.c */
40 extern int surround_check2(char **layout, int i, int j, int Xsize, int Ysize);
41 extern void put_doors(mapstruct *the_map, char **maze, const char *doorstyle, RMParms *RP);
42 /* decor.c */
43 extern int obj_count_in_map(mapstruct *map, int x, int y);
44 extern void put_decor(mapstruct *map, char **maze, char *decorstyle, int decor_option, RMParms *RP);
45 /* exit.c */
46 extern void find_in_layout(int mode, char target, int *fx, int *fy, char **layout, RMParms *RP);
47 extern void place_exits(mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP);
48 extern void unblock_exits(mapstruct *map, char **maze, RMParms *RP);
49 /* treasure.c */
50 extern int wall_blocked(mapstruct *m, int x, int y);
51 extern void place_treasure(mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP);
52 extern object *place_chest(int treasureoptions, int x, int y, mapstruct *map, mapstruct *style_map, int n_treasures, RMParms *RP);
53 extern object *find_closest_monster(mapstruct *map, int x, int y, RMParms *RP);
54 extern int keyplace(mapstruct *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms *RP);
55 extern object *find_monster_in_room_recursive(char **layout, mapstruct *map, int x, int y, RMParms *RP);
56 extern object *find_monster_in_room(mapstruct *map, int x, int y, RMParms *RP);
57 extern int find_spot_in_room(mapstruct *map, int x, int y, int *kx, int *ky, RMParms *RP);
58 extern void find_enclosed_spot(mapstruct *map, int *cx, int *cy, RMParms *RP);
59 extern void remove_monsters(int x, int y, mapstruct *map);
60 extern void find_doors_in_room_recursive(char **layout, mapstruct *map, int x, int y, object **doorlist, int *ndoors, RMParms *RP);
61 extern object **find_doors_in_room(mapstruct *map, int x, int y, RMParms *RP);
62 extern void lock_and_hide_doors(object **doorlist, mapstruct *map, int opts, RMParms *RP);
63 /* special.c */
64 extern void nuke_map_region(mapstruct *map, int xstart, int ystart, int xsize, int ysize);
65 extern void include_map_in_map(mapstruct *dest_map, const mapstruct *in_map, int x, int y);
66 extern int find_spot_for_submap(mapstruct *map, char **layout, int *ix, int *iy, int xsize, int ysize);
67 extern void place_fountain_with_specials(mapstruct *map);
68 extern void place_special_exit(mapstruct *map, int hole_type, const RMParms *RP);
69 extern void place_specials_in_map(mapstruct *map, char **layout, RMParms *RP);
70 /* style.c */
71 extern int load_dir(const char *dir, char ***namelist, int skip_dirs);
72 extern mapstruct *load_style_map(char *style_name);
73 extern mapstruct *find_style(const char *dirname, const char *stylename, int difficulty);
74 extern object *pick_random_object(mapstruct *style);
75 extern void free_style_maps(void);
76 /* rogue_layout.c */
77 extern int surround_check(char **layout, int i, int j, int Xsize, int Ysize);
78 extern char **roguelike_layout_gen(int xsize, int ysize, int options);
79 /* snake.c */
80 extern char **make_snake_layout(int xsize, int ysize);
81 /* square_spiral.c */
82 extern void find_top_left_corner(char **maze, int *cx, int *cy);
83 extern char **make_square_spiral_layout(int xsize, int ysize);
84 /* expand2x.c */
85 extern char **expand2x(char **layout, int xsize, int ysize);
86 
87 #endif
char ** roguelike_layout_gen(int xsize, int ysize, int options)
Actually make the rogue layout.
Definition: rogue_layout.c:332
void draw_onion(char **maze, float *xlocations, float *ylocations, int layers)
Draws the lines in the maze defining the onion layers.
Random map parameters.
Definition: random_map.h:14
mapstruct * generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout)
Main random map routine.
Definition: random_map.c:74
mapstruct * make_map_floor(char **layout, char *floorstyle, RMParms *RP)
Creates the Crossfire mapstruct object from the layout, and adds the floor.
Definition: floor.c:75
void remove_monsters(int x, int y, mapstruct *map)
Remove living things on specified spot.
Definition: treasure.c:745
void place_fountain_with_specials(mapstruct *map)
Places a special fountain on the map.
Definition: special.c:217
static struct Command_Line_Options options[]
Actual valid command line options.
Definition: init.c:284
void place_treasure(mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP)
Place treasures in the map.
Definition: treasure.c:92
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...
Definition: square_spiral.c:53
void unblock_exits(mapstruct *map, char **maze, RMParms *RP)
This function unblocks the exits.
Definition: exit.c:385
void doorify_layout(char **maze, RMParms *RP)
Puts doors at appropriate locations in a layout.
Definition: random_map.c:683
void dump_layout(char **layout, RMParms *RP)
Dumps specified layout using printf().
Definition: random_map.c:44
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...
Definition: random_map.c:343
char ** make_snake_layout(int xsize, int ysize)
Generate a snake-like layout.
Definition: snake.c:34
void place_special_exit(mapstruct *map, int hole_type, const RMParms *RP)
Place an exit with a resource map.
Definition: special.c:274
void place_monsters(mapstruct *map, char *monsterstyle, int difficulty, RMParms *RP)
Place some monsters into the map.
Definition: monster.c:38
mapstruct * load_style_map(char *style_name)
Loads specified map (or take it from cache list).
Definition: style.c:131
int surround_flag4(mapstruct *map, int i, int j, RMParms *RP)
Check a map for spots with walls.
Definition: wall.c:152
void make_map_walls(mapstruct *map, char **layout, char *w_style, RMParms *RP)
takes a map and a layout, and puts walls in the map (picked from w_style) at '#' marks.
Definition: wall.c:184
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.
Definition: special.c:154
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 ...
Definition: maze_gen.c:58
object * pick_random_object(mapstruct *style)
Picks a random object from a style map.
Definition: style.c:286
void bottom_right_centered_onion(char **maze, int xsize, int ysize, int option, int layers)
Create a bottom-right-centered layout.
void find_enclosed_spot(mapstruct *map, int *cx, int *cy, RMParms *RP)
Searches the map for a spot with walls around it.
Definition: treasure.c:675
void include_map_in_map(mapstruct *dest_map, const mapstruct *in_map, int x, int y)
Copy in_map into dest_map at point x,y.
Definition: special.c:86
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.
Definition: treasure.c:476
char ** make_square_spiral_layout(int xsize, int ysize)
Generates a square-spiral layout.
Definition: square_spiral.c:78
void connect_spirals(int xsize, int ysize, int sym, char **layout)
Connects disjoint spirals which may result from the symmetrization process.
object ** find_doors_in_room(mapstruct *map, int x, int y, RMParms *RP)
Gets all doors in a room.
Definition: treasure.c:901
int surround_flag3(mapstruct *map, int i, int j, RMParms *RP)
Check a map for blocked spots.
Definition: wall.c:114
void put_doors(mapstruct *the_map, char **maze, const char *doorstyle, RMParms *RP)
Add doors to a map.
Definition: door.c:73
int load_dir(const char *dir, char ***namelist, int skip_dirs)
This is our own version of scandir/select_regular_files/sort.
Definition: style.c:74
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.
Definition: treasure.c:233
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...
Definition: wall.c:77
object * retrofit_joined_wall(mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP)
this takes a map, and changes an existing wall to match what's blocked around it, counting only doors...
Definition: wall.c:315
void place_exits(mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
Place exits in the map.
Definition: exit.c:144
char ** rotate_layout(char **maze, int rotation, RMParms *RP)
Takes a map and rotates it.
Definition: random_map.c:424
char ** map_gen_spiral(int xsize, int ysize, int option)
Generates a spiral layout.
void find_in_layout(int mode, char target, int *fx, int *fy, char **layout, RMParms *RP)
Find a character in the layout.
Definition: exit.c:47
StringBuffer * write_map_parameters_to_string(const RMParms *RP)
Creates a suitable message for exit from RP.
Definition: random_map.c:735
void make_doors(char **maze, float *xlocations, float *ylocations, int layers, int options)
Add doors to the layout.
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.
Definition: treasure.c:369
int obj_count_in_map(mapstruct *map, int x, int y)
Count objects at a spot.
Definition: decor.c:39
char ** expand2x(char **layout, int xsize, int ysize)
Expands the layout be a factor 2.
Definition: expand2x.c:43
char ** map_gen_onion(int xsize, int ysize, int option, int layers)
Generates an onion layout.
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...
Definition: treasure.c:62
void put_decor(mapstruct *map, char **maze, char *decorstyle, int decor_option, RMParms *RP)
Put the decor into the map.
Definition: decor.c:65
object * find_monster_in_room(mapstruct *map, int x, int y, RMParms *RP)
Find a monster in a room.
Definition: treasure.c:527
char ** layoutgen(RMParms *RP)
This function builds the actual layout.
Definition: random_map.c:208
void centered_onion(char **maze, int xsize, int ysize, int option, int layers)
Creates a centered onion layout.
int surround_check(char **layout, int i, int j, int Xsize, int Ysize)
Checks free spots around a spot.
Definition: rogue_layout.c:303
object * find_closest_monster(mapstruct *map, int x, int y, RMParms *RP)
finds the closest monster and returns him, regardless of doors or walls
Definition: treasure.c:319
object * pick_joined_wall(object *the_wall, char **layout, int i, int j, RMParms *RP)
Picks the right wall type for this square, to make it look nice, and have everything nicely joined...
Definition: wall.c:256
void lock_and_hide_doors(object **doorlist, mapstruct *map, int opts, RMParms *RP)
Locks and/or hides all the doors in doorlist, or does nothing if opts doesn't say to lock/hide doors...
Definition: treasure.c:986
int find_spot_in_room(mapstruct *map, int x, int y, int *kx, int *ky, RMParms *RP)
Find a random non-blocked spot in this room to drop a key.
Definition: treasure.c:619
void free_style_maps(void)
Frees cached style maps.
Definition: style.c:309
void place_specials_in_map(mapstruct *map, char **layout, RMParms *RP)
Main function for specials.
Definition: special.c:393
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.
Definition: treasure.c:851
mapstruct * find_style(const char *dirname, const char *stylename, int difficulty)
Loads and returns the map requested.
Definition: style.c:180
void bottom_centered_onion(char **maze, int xsize, int ysize, int option, int layers)
Create a bottom-centered layout.
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.
Definition: wall.c:40
A buffer that will be expanded as content is added to it.
Definition: stringbuffer.c:25
void roomify_layout(char **maze, RMParms *RP)
Take a layout and make some rooms in it.
Definition: random_map.c:496
void nuke_map_region(mapstruct *map, int xstart, int ystart, int xsize, int ysize)
Erases all objects (except floor) in the given rectangle.
Definition: special.c:59
This is a game-map.
Definition: map.h:325
int surround_check2(char **layout, int i, int j, int Xsize, int Ysize)
Serch for doors or walls around a spot.
Definition: door.c:43
int make_wall(char **maze, int x, int y, int dir)
Cuts the layout horizontally or vertically by a wall with a door.
Definition: random_map.c:644
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.
Definition: random_map.c:544
Definition: main.c:88