Atrinik Client  4.0
Functions | Variables
effects.c File Reference
#include <global.h>
#include <toolkit/string.h>

Go to the source code of this file.

Functions

void effects_init (void)
 
void effects_deinit (void)
 
void effects_reinit (void)
 
void effect_sprites_free (effect_struct *effect)
 
void effect_free (effect_struct *effect)
 
void effect_sprite_def_free (effect_sprite_def *sprite_def)
 
void effect_sprite_free (effect_sprite *sprite)
 
void effect_sprite_remove (effect_sprite *sprite)
 
static effect_spriteeffect_sprite_create (effect_struct *effect)
 
void effect_sprites_play (void)
 
void effect_frames (int frames)
 
int effect_start (const char *name)
 
void effect_debug (const char *type)
 
void effect_stop (void)
 
uint8_t effect_has_overlay (void)
 
const char * effect_overlay_identifier (void)
 
SDL_Surface * effect_sprite_overlay (SDL_Surface *surface)
 

Variables

static effect_structeffects = NULL
 
static effect_structcurrent_effect = NULL
 
static const char * overlay_cols [] = {"r", "g", "b", "a"}
 
static int max_frames = 60
 

Detailed Description

Map effects handling.

Author
Alex Tokar

Definition in file effects.c.

Function Documentation

void effect_debug ( const char *  type)

Used for debugging effects code using /d_effect command.

Parameters
typeWhat debugging command to run.

Definition at line 654 of file effects.c.

void effect_free ( effect_struct effect)

Deinitialize a single effect.

Parameters
effectEffect that will be freed.

Definition at line 335 of file effects.c.

uint8_t effect_has_overlay ( void  )

Check whether there is an overlay on the active effect (if any).

Returns
1 if there is an overlay, 0 otherwise.

Definition at line 704 of file effects.c.

const char* effect_overlay_identifier ( void  )

Acquire an identifier for the overlay effect, if any.

Returns
Identifier; empty string in case no overlay is present.

Definition at line 718 of file effects.c.

static effect_sprite* effect_sprite_create ( effect_struct effect)
static

Allocate a new sprite object and add it to the link of currently shown sprites.

A random sprite definition object will be chosen.

Parameters
effectEffect this is being done for.
Returns
The created sprite.

Definition at line 401 of file effects.c.

void effect_sprite_def_free ( effect_sprite_def sprite_def)

Deinitialize a single sprite definition.

Parameters
sprite_defSprite definition that will be freed.

Definition at line 349 of file effects.c.

void effect_sprite_free ( effect_sprite sprite)

Deinitialize a single shown sprite.

Parameters
spriteSprite that will be freed.

Definition at line 360 of file effects.c.

SDL_Surface* effect_sprite_overlay ( SDL_Surface *  surface)

Add an effect overlay to a sprite surface.

Parameters
surfaceThe sprite surface to add overlay to.
Returns
New surface, NULL in case of failure.

Definition at line 734 of file effects.c.

void effect_sprite_remove ( effect_sprite sprite)

Remove a single shown sprite from the linked list and free it.

Parameters
spriteSprite to remove and free.

Definition at line 370 of file effects.c.

void effect_sprites_free ( effect_struct effect)

Deinitialize shown sprites of a single effect.

Parameters
effectThe effect to have shown sprites deinitialized.

Definition at line 311 of file effects.c.

void effect_sprites_play ( void  )

Try to play effect sprites.

Definition at line 445 of file effects.c.

int effect_start ( const char *  name)

Start an effect identified by its name.

Parameters
nameName of the effect to start. 'none' is a reserved effect name and will stop any currently playing effect.
Returns
1 if the effect was started, 0 otherwise.

Definition at line 612 of file effects.c.

void effect_stop ( void  )

Stop currently playing effect.

Definition at line 689 of file effects.c.

void effects_deinit ( void  )

Deinitialize effects linked list.

Definition at line 267 of file effects.c.

void effects_init ( void  )

Initialize effects from file.

Definition at line 46 of file effects.c.

void effects_reinit ( void  )

Makes sure all sprite definitions have correct sprite IDs and their images are properly loaded.

Definition at line 294 of file effects.c.

Variable Documentation

effect_struct* current_effect = NULL
static

Current effect.

Definition at line 38 of file effects.c.

effect_struct* effects = NULL
static

Linked list of possible effects.

Definition at line 36 of file effects.c.

const char* overlay_cols[] = {"r", "g", "b", "a"}
static

RGBA as lowercase overlay color names.

Definition at line 40 of file effects.c.