Atrinik Server  4.0
Data Structures | Macros | Typedefs | Functions | Variables
world_maker.c File Reference
#include <global.h>
#include <loader.h>
#include <gd.h>
#include <toolkit/string.h>
#include <arch.h>
#include <toolkit/path.h>

Go to the source code of this file.

Data Structures

struct  wm_region
 
struct  region_map_def
 

Macros

#define MAX_PIXELS   3
 

Typedefs

typedef struct wm_region wm_region
 
typedef struct region_map_def region_map_def_t
 

Functions

static int region_map_def_sort (const void *a, const void *b)
 
static void wm_images_init (void)
 
static void wm_images_deinit (void)
 
static int render_object (gdImagePtr im, int x, int y, object *ob)
 
static void region_add_map (wm_region *r, mapstruct *m)
 
static int map_in_region (mapstruct *m, const char *name)
 
static void region_add_rec (wm_region *r, mapstruct *m, const char *region_name)
 
void world_maker (void)
 

Variables

static int ** wm_face_colors
 

Detailed Description

Handles the world maker code.

Definition in file world_maker.c.

Macro Definition Documentation

#define MAX_PIXELS   3

Pixels per tile (3 = 3x3 box).

Definition at line 51 of file world_maker.c.

Typedef Documentation

Temporary structure used to hold data about the maps that will be stored in the definitions file.

typedef struct wm_region wm_region

Region.

Function Documentation

static int map_in_region ( mapstruct m,
const char *  name 
)
static

Check if the specified map is in the specified region. Parent regions are checked for match.

Parameters
mMap.
nameRegion to check.
Returns
1 if it is in the region, 0 otherwise.

Definition at line 384 of file world_maker.c.

static void region_add_map ( wm_region r,
mapstruct m 
)
static

Add map to region.

Parameters
rRegion.
mMap to add.

Definition at line 364 of file world_maker.c.

static void region_add_rec ( wm_region r,
mapstruct m,
const char *  region_name 
)
static

Recursively add maps to a region.

Parameters
rRegion.
mStart map.
region_nameRegion name.

Definition at line 406 of file world_maker.c.

static int region_map_def_sort ( const void *  a,
const void *  b 
)
static

Sorts an array of region_map_def_t elements.

Definition at line 104 of file world_maker.c.

static int render_object ( gdImagePtr  im,
int  x,
int  y,
object ob 
)
static

Render a single object on the image 'im'.

Parameters
imImage to render on.
xX position.
yY position.
obObject to render.
Returns
1 if we rendered the object, 0 otherwise.

Definition at line 197 of file world_maker.c.

static void wm_images_deinit ( void  )
static

Deinitialize the face colors.

Definition at line 175 of file world_maker.c.

static void wm_images_init ( void  )
static

Initialize the face colors.

Definition at line 113 of file world_maker.c.

void world_maker ( void  )

The main world maker function.

Definition at line 490 of file world_maker.c.

Variable Documentation

int** wm_face_colors
static

Array of colors used by the different faces.

Each entry is an array consisting of:

  • average color value of the face
  • darker shade of the average color
  • red average
  • green average
  • blue average

Definition at line 48 of file world_maker.c.