27#ifndef __N_PARTICLE_HEADER
28#define __N_PARTICLE_HEADER
39#include <allegro5/allegro.h>
40#include <allegro5/allegro_audio.h>
41#include <allegro5/allegro_acodec.h>
42#include <allegro5/allegro_font.h>
43#include <allegro5/allegro_image.h>
44#include <allegro5/allegro_primitives.h>
193int add_particle_ex(
PARTICLE_SYSTEM* psys,
int spr,
int mode,
int off_x,
int off_y,
int lifetime,
int size, ALLEGRO_COLOR color,
double vx,
double vy,
double vz,
double ax,
double ay,
double az);
218int add_particle_at(
PARTICLE_SYSTEM* psys,
int spr,
int mode,
double px,
double py,
double pz,
int lifetime,
int size_start,
int size_end, ALLEGRO_COLOR color_start, ALLEGRO_COLOR color_end,
double vx,
double vy,
double vz,
double ax,
double ay,
double az);
Structure of a generic LIST container.
double shape_h
shape dimension 2: rect height (world units)
int size_start
particle size at birth
int particle_mode
particle draw mode (NORMAL_PART, CIRCLE_PART, PIXEL_PART, FIRE_PART, etc.)
N_TIME timer
Internal: particle system timer.
LIST * emitters
list of PARTICLE_EMITTER pointers
int size
current size of particle
int max_sprites
size of the picture library
VECTOR3D velocity_max
random velocity range max
ALLEGRO_COLOR color
color of the particle
ALLEGRO_COLOR color_end
end color for lerp
int additive
1=additive blend, 0=normal alpha
int depth_sort
1=depth-sorted with terrain, 0=flat overlay after iso pass
int active
1=emitting, 0=paused
PHYSICS object
particle physical properties
int spr_id
sprite id in library
int size_end
particle size at death
int lifetime
lifetime (counts down, msecs)
ALLEGRO_COLOR color_start
particle start color
ALLEGRO_COLOR color_end
particle end color (lerp over lifetime)
int shape
emission shape: 0=point, 1=line, 2=rect, 3=circle
VECTOR3D velocity_min
random velocity range min
int live_count
current live particle count for this emitter (managed by system)
VECTOR3D source
Coordinate of emitting point (used by add_particle/add_particle_ex)
double emit_accumulator
internal: fractional particle accumulator
VECTOR3D position
emitter world position
VECTOR3D offset
offset when attached to entity
int size_start
particle size at birth
LIST * list
list of PARTICLE pointers
int attached_entity_id
-1=not attached, >=0=entity id
int spr_id
sprite id or -1
struct PARTICLE_EMITTER * emitter
back-pointer to owning emitter (NULL if spawned manually)
int mode
particle mode: NORMAL_PART,SINUS_PART,PIXEL_PART
double emit_rate
particles per second (continuous mode)
int max_particles
per-emitter particle cap (0=unlimited)
ALLEGRO_BITMAP ** sprites
Library of picture for the particles.
int lifetime_min
particle lifetime range min (msecs)
int lifetime_max
original lifetime at birth (needed for lerp ratio = age/lifetime_max)
int size_end
particle size at death
double shape_rotation
shape rotation in radians
int depth_sort
1=depth-sorted with terrain, 0=flat overlay
double shape_w
shape dimension 1: line length, rect width, or circle radius (world units)
int lifetime_max
particle lifetime range max (msecs)
int burst_count
if >0, emit this many instantly then deactivate
ALLEGRO_COLOR color_start
start color for lerp (set by emitter, ignored if color_start == color_end)
VECTOR3D acceleration
constant acceleration (gravity etc.)
int additive_blend
1=additive blend, 0=normal alpha blend
int age
current age in msecs (incremented by manage_particle_ex)
int draw_particle(PARTICLE_SYSTEM *psys, double xpos, double ypos, int w, int h, double range)
draw particles on screen
int add_particle_at(PARTICLE_SYSTEM *psys, int spr, int mode, double px, double py, double pz, int lifetime, int size_start, int size_end, ALLEGRO_COLOR color_start, ALLEGRO_COLOR color_end, double vx, double vy, double vz, double ax, double ay, double az)
add a particle at an absolute world position (not relative to psys->source)
int move_particles(PARTICLE_SYSTEM *psys, double vx, double vy, double vz)
move all particles by a velocity offset
PARTICLE_EMITTER * add_emitter(PARTICLE_SYSTEM *psys)
add a new emitter to the particle system.
int free_emitters(PARTICLE_SYSTEM *psys)
free all emitters in the particle system
int manage_particle_ex(PARTICLE_SYSTEM *psys, double delta_t)
manage particles with custom delta time
int remove_emitter(PARTICLE_SYSTEM *psys, const PARTICLE_EMITTER *em)
remove an emitter from the particle system and free it
int free_particle_system(PARTICLE_SYSTEM **psys)
free a particle system
int manage_particle(PARTICLE_SYSTEM *psys)
manage particles using internal timer
int add_particle_ex(PARTICLE_SYSTEM *psys, int spr, int mode, int off_x, int off_y, int lifetime, int size, ALLEGRO_COLOR color, double vx, double vy, double vz, double ax, double ay, double az)
add a particle to the system (extended version)
int add_particle(PARTICLE_SYSTEM *psys, int spr, int mode, int lifetime, int size, ALLEGRO_COLOR color, PHYSICS object)
add a particle to the system
int init_particle_system(PARTICLE_SYSTEM **psys, int max, double x, double y, double z, int max_sprites)
initialize a particle system
Structure of a single particle.
Structure of a particle emitter.
Structure of a particle system.
double VECTOR3D[3]
struct of a point
structure of the physics of an object
Simple 3D movement simulation.
Common headers and low-level functions & define.
List structures and definitions.