Crossfire Server, Trunk  R20513
Macros | Functions
room_gen_onion.c File Reference

The onion room generator: Onion rooms are like this: More...

#include <stdlib.h>
#include <global.h>
#include <random_map.h>
Include dependency graph for room_gen_onion.c:

Go to the source code of this file.

Macros

#define MIN(x, y)   (((x) < (y)) ? (x) : (y))
 

Functions

void bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers)
 Create a bottom-centered layout. More...
 
void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers)
 Create a bottom-right-centered layout. More...
 
void centered_onion (char **maze, int xsize, int ysize, int option, int layers)
 Creates a centered onion layout. More...
 
void draw_onion (char **maze, float *xlocations, float *ylocations, int layers)
 Draws the lines in the maze defining the onion layers. More...
 
void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options)
 Add doors to the layout. More...
 
char ** map_gen_onion (int xsize, int ysize, int option, int layers)
 Generates an onion layout. More...
 

Detailed Description

The onion room generator: Onion rooms are like this:

char **map_gen_onion(int xsize, int ysize, int option, int layers);

like this: regular random centered, linear onion bottom/right centered, nonlinear

Definition in file room_gen_onion.c.

Macro Definition Documentation

#define MIN (   x,
 
)    (((x) < (y)) ? (x) : (y))

Function Documentation

void bottom_centered_onion ( char **  maze,
int  xsize,
int  ysize,
int  option,
int  layers 
)

Create a bottom-centered layout.

Parameters
mazelayout.
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers to create.

Definition at line 219 of file room_gen_onion.c.

References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, and RANDOM.

Referenced by map_gen_onion().

Here is the call graph for this function:

Here is the caller graph for this function:

void bottom_right_centered_onion ( char **  maze,
int  xsize,
int  ysize,
int  option,
int  layers 
)

Create a bottom-right-centered layout.

Parameters
mazelayout.
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers to create.

Definition at line 471 of file room_gen_onion.c.

References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, and RANDOM.

Referenced by map_gen_onion().

Here is the call graph for this function:

Here is the caller graph for this function:

void centered_onion ( char **  maze,
int  xsize,
int  ysize,
int  option,
int  layers 
)

Creates a centered onion layout.

Parameters
mazelayout.
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers to create.

Definition at line 141 of file room_gen_onion.c.

References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, and RANDOM.

Referenced by map_gen_onion().

Here is the call graph for this function:

Here is the caller graph for this function:

void draw_onion ( char **  maze,
float *  xlocations,
float *  ylocations,
int  layers 
)

Draws the lines in the maze defining the onion layers.

Parameters
mazemap to draw to.
xlocations
ylocationsarray of locations.
layersnumber of layers.
Todo:
explain what locations arrays should be, and the meaning of layers.

Definition at line 306 of file room_gen_onion.c.

Referenced by bottom_centered_onion(), bottom_right_centered_onion(), and centered_onion().

Here is the caller graph for this function:

void make_doors ( char **  maze,
float *  xlocations,
float *  ylocations,
int  layers,
int  options 
)

Add doors to the layout.

Parameters
mazemap to draw to.
xlocations
ylocationsarray of locations. Will be free()d.
layersnumber of layers.
optionscombination of OPT_xxx values.
Todo:
explain what locations arrays should be, and the meaning of layers.

Definition at line 345 of file room_gen_onion.c.

References cleanup(), OPT_BOTTOM_C, OPT_BOTTOM_R, OPT_LINEAR, OPT_NO_DOORS, and RANDOM.

Referenced by bottom_centered_onion(), bottom_right_centered_onion(), and centered_onion().

Here is the call graph for this function:

Here is the caller graph for this function:

char** map_gen_onion ( int  xsize,
int  ysize,
int  option,
int  layers 
)

Generates an onion layout.

Parameters
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers the onion should have.
Returns
layout.

Definition at line 70 of file room_gen_onion.c.

References bottom_centered_onion(), bottom_right_centered_onion(), centered_onion(), OPT_BOTTOM_C, OPT_BOTTOM_R, OPT_CENTERED, OPT_IRR_SPACE, OPT_LINEAR, OPT_WALL_OFF, OPT_WALLS_ONLY, and RANDOM.

Referenced by layoutgen(), and make_square_spiral_layout().

Here is the call graph for this function:

Here is the caller graph for this function: