Atrinik Server  4.0
Macros | Functions | Variables
light.c File Reference
#include <global.h>
#include <object.h>

Go to the source code of this file.

Macros

#define MAX_MASK_SIZE   81
 
#define NR_LIGHT_MASK   10
 
#define MAX_LIGHT_SOURCE   13
 

Functions

static int get_real_light_source_value (int l)
 
static int light_mask_adjust (mapstruct *map, int x, int y, int intensity, int mod, mapstruct *restore_map, int other_only)
 
void adjust_light_source (mapstruct *map, int x, int y, int light)
 
void check_light_source_list (mapstruct *map)
 
void remove_light_source_list (mapstruct *map)
 

Variables

static int lmask_x [MAX_MASK_SIZE]
 
static int lmask_y [MAX_MASK_SIZE]
 
static int light_mask [MAX_LIGHT_SOURCE+1]
 
static int light_mask_width [NR_LIGHT_MASK]
 
static int light_mask_size [NR_LIGHT_MASK]
 
static int light_masks [NR_LIGHT_MASK][MAX_MASK_SIZE]
 

Detailed Description

Lighting system.

Definition in file light.c.

Function Documentation

void adjust_light_source ( mapstruct map,
int  x,
int  y,
int  light 
)

Add or remove a light source to a map space. Adjust the light source map counter and apply the area of light it invokes around it.

Parameters
mapThe map of this light
xX position of light
yY position of light
lightGlow radius of the light

Definition at line 257 of file light.c.

void check_light_source_list ( mapstruct map)

Check light source list of specified map. This will also check all tiled maps attached to the map.

Parameters
mapThe map to check.

Definition at line 324 of file light.c.

void remove_light_source_list ( mapstruct map)

Remove light sources list from a map.

Parameters
mapThe map to remove from.

Definition at line 424 of file light.c.

Variable Documentation

int light_mask[MAX_LIGHT_SOURCE+1]
static
Initial value:
= {
0,
1,
2, 3,
4, 5, 6, 6,
7, 7, 8, 8,
8, 9
}

Definition at line 49 of file light.c.

int light_mask_size[NR_LIGHT_MASK]
static
Initial value:
= {
0, 9, 25, 25, 49,
49, 49, 81, 81, 81
}

Definition at line 63 of file light.c.

int light_mask_width[NR_LIGHT_MASK]
static
Initial value:
= {
0, 1, 2, 2, 3,
3, 3, 4, 4, 4
}

Definition at line 58 of file light.c.

int lmask_x[MAX_MASK_SIZE]
static
Initial value:
= {
0, 0, 1, 1, 1, 0, -1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1,
0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3, -3, -3, -3, -3, -2, -1,
0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 2, 1, 0, -1, -2, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -2, -1
}

Definition at line 37 of file light.c.

int lmask_y[MAX_MASK_SIZE]
static
Initial value:
= {
0, -1, -1, 0, 1, 1, 1, 0, -1, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2,
-3, -3, -3, -3, -2, -1, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, -1, -2, -3, -3, -3,
4, 4, 4, 4, 4, 3, 2, 1, 0, -1, -2, -3, -4, -4, -4, -4, -4, -4, -4, -4, -4, -3, -2, -1, 0, 1, 2, 3, 4, 4, 4, 4
}

Definition at line 43 of file light.c.