 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
47 for (i = 0; i < RP->
Xsize; i++) {
48 for (j = 0; j < RP->
Ysize; j++) {
52 printf(
"%c",
layout[i][j]);
194 for (i = 0; i < RP->
Xsize; i++) {
385 int Xsize_orig, Ysize_orig;
387 Xsize_orig = RP->
Xsize;
388 Ysize_orig = RP->
Ysize;
391 RP->
Xsize = Xsize_orig;
392 RP->
Ysize = Ysize_orig;
399 sym_maze = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
400 for (i = 0; i < RP->
Xsize; i++) {
401 sym_maze[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
405 for (i = 0; i < RP->
Xsize/2+1; i++)
406 for (j = 0; j < RP->
Ysize; j++) {
407 sym_maze[i][j] = maze[i][j];
408 sym_maze[RP->
Xsize-i-1][j] = maze[i][j];
411 for (i = 0; i < RP->
Xsize; i++)
412 for (j = 0; j < RP->
Ysize/2+1; j++) {
413 sym_maze[i][j] = maze[i][j];
414 sym_maze[i][RP->
Ysize-j-1] = maze[i][j];
417 for (i = 0; i < RP->
Xsize/2+1; i++)
418 for (j = 0; j < RP->
Ysize/2+1; j++) {
419 sym_maze[i][j] = maze[i][j];
420 sym_maze[i][RP->
Ysize-j-1] = maze[i][j];
421 sym_maze[RP->
Xsize-i-1][j] = maze[i][j];
422 sym_maze[RP->
Xsize-i-1][RP->
Ysize-j-1] = maze[i][j];
426 for (i = 0; i < Xsize_orig; i++) {
472 char *rotated =
static_cast<char *
>(malloc(
sizeof(
char)*RP->
Xsize*RP->
Ysize));
474 for (i = 0; i < RP->
Xsize; i++) {
475 for (j = 0; j < RP->
Ysize; j++) {
476 rotated[i*RP->
Ysize+j] = maze[i][j];
479 for (i = 0; i < RP->
Xsize; i++) {
480 for (j = 0; j < RP->
Ysize; j++) {
492 new_maze = (
char **)calloc(
sizeof(
char *), RP->
Ysize);
493 for (i = 0; i < RP->
Ysize; i++) {
494 new_maze[i] = (
char *)calloc(
sizeof(
char), RP->
Xsize);
497 for (i = 0; i < RP->
Xsize; i++)
498 for (j = 0; j < RP->
Ysize; j++) {
499 new_maze[j][i] = maze[i][j];
503 for (i = 0; i < RP->
Xsize; i++)
504 for (j = 0; j < RP->
Ysize; j++) {
505 new_maze[j][i] = maze[RP->
Xsize-i-1][RP->
Ysize-j-1];
510 for (i = 0; i < RP->
Xsize; i++) {
536 for (ti = 0; ti < tries; ti++) {
585 if (dx == 0 || dx == (RP->
Xsize-1) || dy == 0 || dy == (RP->
Ysize-1)) {
590 if (maze[dx][dy] != 0) {
598 for (i1 = dx-1; i1 > 0; i1--) {
607 if (maze[i1][y] != 0) {
613 for (i1 = dx+1; i1 < RP->
Xsize-1; i1++) {
622 if (maze[i1][y] != 0) {
632 for (i1 = dy-1; i1 > 0; i1--) {
641 if (maze[x][i1] != 0) {
647 for (i1 = dy+1; i1 < RP->
Ysize-1; i1++) {
656 if (maze[x][i1] != 0) {
686 for (i1 = x-1; maze[i1][y] == 0; i1--) {
689 for (i1 = x+1; maze[i1][y] == 0; i1++) {
698 for (i1 = y-1; maze[x][i1] == 0; i1--) {
701 for (i1 = y+1; maze[x][i1] == 0; i1++) {
726 doorlist_x =
static_cast<int *
>(malloc(
sizeof(
int)*RP->
Xsize*RP->
Ysize));
727 doorlist_y =
static_cast<int *
>(malloc(
sizeof(
int)*RP->
Xsize*RP->
Ysize));
731 for (i = 1; i < RP->
Xsize-1; i++)
732 for (j = 1; j < RP->
Ysize-1; j++) {
734 if (sindex == 3 || sindex == 12) {
736 doorlist_x[doorlocs] = i;
737 doorlist_y[doorlocs] = j;
742 while (ndoors > 0 && doorlocs > 0) {
750 if (sindex == 3 || sindex == 12) {
756 doorlist_x[di] = doorlist_x[doorlocs];
757 doorlist_y[di] = doorlist_y[doorlocs];
char ** map_gen_onion(int xsize, int ysize, int option, int layers)
Generates an onion layout.
mapstruct * generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout, sstring reset_group)
Main random map routine.
char layoutstyle[RM_SIZE]
Contains the layout type to generate, see layoutgen() for valid types.
struct region * region
What jurisdiction in the game world this map is ruled by points to the struct containing all the prop...
char ** roguelike_layout_gen(int xsize, int ysize, int options, int _unused_layers)
Actually make the rogue layout.
uint16_t difficulty
What level the player should be to play here.
int difficulty_given
If non zero, this means the difficulty was not zero initially.
int multiple_floors
If non zero, then the map will have multiple floors, else only one floor will be used.
uint32_t outdoor
True if an outdoor map.
int make_wall(char **maze, int x, int y, int dir)
Cuts the layout horizontally or vertically by a wall with a door.
same as sound ncom command like but with extra the client want tick commands so it knows animation timing the client wants to be informed of pickup mode changes Mode will be sent when the player successfully logs and afterward any time the value is but over time
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
char ** make_square_spiral_layout(int xsize, int ysize, int _unused_options, int _unused_layers)
Generates a square-spiral layout.
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,...
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 ...
#define OPT_WALLS_ONLY
Only walls.
void roomify_layout(char **maze, RMParms *RP)
Take a layout and make some rooms in it.
char path[HUGE_BUF]
Filename of the map.
char ** map_gen_spiral(int xsize, int ysize, int option, int _unused_layers)
Generates a spiral 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.
void unblock_exits(mapstruct *map, char **maze, RMParms *RP)
This function unblocks the exits.
void set_darkness_map(mapstruct *m)
Set the darkness level for a map, based on the time of the day.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
void apply_auto_fix(mapstruct *m)
Go through the entire map (only the first time when an original map is loaded) and performs special a...
#define SQUARE_SPIRAL_LAYOUT
void place_specials_in_map(mapstruct *map, char **layout, RMParms *RP)
Main function for specials.
StringBuffer * write_map_parameters_to_string(const RMParms *RP)
Creates a suitable message for exit from RP.
char this_map[RM_SIZE]
Path of the map from which the random map(s) were created.
char decorstyle[RM_SIZE]
Name of the decor style file, in /styles/decorstyles, can be an empty string in which case a random o...
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.
int darkness
Map darkness.
char final_map[RM_SIZE]
If not empty, the path of the final map this whole maze leads to.
void dump_layout(char **layout, RMParms *RP)
Dumps specified layout using printf().
sstring add_string(const char *str)
Share a string.
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.
int change_map_light(mapstruct *m, int change)
Used to change map light level (darkness) up or down.
#define MIN_RANDOM_MAP_SIZE
Minimal size a random should have to actually be generated.
void doorify_layout(char **maze, RMParms *RP)
Puts doors at appropriate locations in a layout.
#define NO_SYM
No symmetry.
char ** expand2x(char **layout, int xsize, int ysize)
Expands the layout be a factor 2.
char ** rotate_layout(char **maze, int rotation, RMParms *RP)
Takes a map and rotates it.
sstring reset_group
For reset purpose, all maps in the same group reset at the same time.
char wallstyle[RM_SIZE]
Name of the wall style file, in /styles/wallstyles, can be an empty string in which case a random one...
char ** map_gen_crawl(int xsize, int ysize, int iter, int hallway)
Generator of the crawl maze.
char doorstyle[RM_SIZE]
Name of the doors style file, in /styles/doorstyles, see put_doors().
long last_reset_time
A timestamp of the last original map loading.
long seconds(void)
Return wall clock time in seconds.
#define X_SYM
Vertical symmetry.
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.
A buffer that will be expanded as content is added to it.
char final_exit_archetype[RM_SIZE]
If not empty, the archetype name of the exit leading to the final map.
void place_treasure(mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP)
Place treasures in the map.
void connect_spirals(int xsize, int ysize, int sym, char **layout)
Connects disjoint spirals which may result from the symmetrization process.
char cheststyle[RM_SIZE]
Name of the chests style file, in /styles/cheststyles, can be an empty string in which case a random ...
int outdoor
Whether generated map is outdoor or not.
const typedef char * sstring
void place_exits(mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
Place exits in the map.
void put_doors(mapstruct *the_map, char **maze, const char *doorstyle, RMParms *RP)
Add doors to a map.
void place_monsters(mapstruct *map, char *monsterstyle, int difficulty, RMParms *RP)
Place some monsters into the map.
char exit_on_final_map[RM_SIZE]
If this is "no", then no exit will be made to the final map from the previous random map.
char treasurestyle[RM_SIZE]
Name of the treasures style file, in /styles/treasurestyles, can be an empty string in which case a r...
char dungeon_name[RM_SIZE]
If not empty, will be used in the name of the random keys.
char ** make_snake_layout(int xsize, int ysize, int _unused_options, int _unused_layers)
Generate a snake-like layout.
mapstruct * make_map_floor(char **layout, char *floorstyle, RMParms *RP)
Creates the Crossfire mapstruct object from the layout, and adds the floor.
char floorstyle[RM_SIZE]
Name of the floor style file, in /styles/floors, can be an empty string in which case a random one is...
char * msg
Message map creator may have left.
void put_decor(mapstruct *map, char **maze, char *decorstyle, int decor_option, RMParms *RP)
Put the decor into the map.
char monsterstyle[RM_SIZE]
Name of the monster style directory, in /styles/monsters, can be an empty string in which case a rand...
int calculate_difficulty(mapstruct *m)
This routine is supposed to find out the difficulty of the map.
#define XY_SYM
Reflection.
char exitstyle[RM_SIZE]
Name of the exit style files, in /styles/exitstyles/{up,down}, can be an empty string in which case a...
#define Y_SYM
Horizontal symmetry.
bool link_source_map
Whether to set the reset group (if not already defined) of the source map for this random map.
float difficulty_increase
char ** layoutgen(RMParms *RP)
This function builds the actual layout.
#define RANDOM_SYM
Random symmetry.