28 (*psys)->list = new_generic_list(max);
30 (*psys)->source[0] = x;
31 (*psys)->source[1] = y;
32 (*psys)->source[2] = z;
35 (*psys)->sprites = (ALLEGRO_BITMAP**)calloc(max_sprites,
sizeof(ALLEGRO_BITMAP*));
37 (*psys)->sprites = NULL;
61 for (it = 0; it < 3; it++) {
62 object.position[it] += psys->
source[it];
97int 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) {
104 VECTOR3D_SET(
object.angular_acceleration, 0.0, 0.0, 0.0);
106 return add_particle(psys, spr, mode, lifetime, size, color,
object);
180 if ((x < -range) || (x > (w + range)) || (y < -range) || (y > (h + range))) {
185 for (
int it = 0; it < 3; it++) {
206 int spr_h = al_get_bitmap_height(psys->
sprites[ptr->
spr_id]);
210 al_draw_circle(x, y, ptr->
size, ptr->
color, 1);
216 int bmp_h = al_get_bitmap_height(psys->
sprites[ptr->
spr_id]);
220 al_draw_circle(x, y, ptr->
size, ptr->
color, 1);
224 al_draw_circle(x, y, ptr->
size, ptr->
color, 1);
240 while ((*psys)->list->start) {
#define Malloc(__ptr, __struct, __size)
Malloc Handler to get errors and set to 0.
#define __n_assert(__ptr, __ret)
macro to assert things
#define Free(__ptr)
Free Handler to get errors.
void * ptr
void pointer to store
size_t nb_max_items
maximum number of item in the list.
LIST_NODE * start
pointer to the start of the list
size_t nb_items
number of item currently in the list
struct LIST_NODE * next
pointer to the next node
int list_push(LIST *list, void *ptr, void(*destructor)(void *ptr))
Add a pointer to the end of the list.
#define remove_list_node(__LIST_, __NODE_, __TYPE_)
Remove macro helper for void pointer casting.
Structure of a generic list node.
#define n_log(__LEVEL__,...)
Logging function wrapper to get line and func.
#define LOG_ERR
error conditions
int start_HiTimer(N_TIME *timer)
Initialize or restart from zero any N_TIME HiTimer.
time_t get_usec(N_TIME *timer)
Poll any N_TIME HiTimer, returning usec, and moving currentTime to startTime.
N_TIME timer
Internal: particle system timer.
int max_sprites
size of the picture library
ALLEGRO_COLOR color
color of the particle
PHYSICS object
particle physical properties
int spr_id
sprite id in library
VECTOR3D source
Coordinate of emitting point.
LIST * list
list of PARTICLE pointers
int mode
particle mode: NORMAL_PART,SINUS_PART,PIXEL_PART
ALLEGRO_BITMAP ** sprites
Library of picture for the particles.
int draw_particle(PARTICLE_SYSTEM *psys, double xpos, double ypos, int w, int h, double range)
draw particles of a particle system
#define NORMAL_PART
classic moving particle
int move_particles(PARTICLE_SYSTEM *psys, double vx, double vy, double vz)
draw particles of a particle system
#define PIXEL_PART
pixel particle
int manage_particle_ex(PARTICLE_SYSTEM *psys, double delta_t)
update particles positions usting provided delta time
int free_particle_system(PARTICLE_SYSTEM **psys)
destroy and free a particle system
int manage_particle(PARTICLE_SYSTEM *psys)
update particles positions usting particle system internal timer
#define SINUS_PART
sinus based moving particle
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 a particle system, all in line version (you have to set the PHYSICS object paramete...
int add_particle(PARTICLE_SYSTEM *psys, int spr, int mode, int lifetime, int size, ALLEGRO_COLOR color, PHYSICS object)
add a particle to a particle 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 system.
VECTOR3D speed
vx,vy,vz actual speed
VECTOR3D orientation
ax,ay,az actual rotation position
VECTOR3D position
x,y,z actual position
#define VECTOR3D_SET(VECTOR, X, Y, Z)
helper to set a VECTOR3D position
int update_physics_position(PHYSICS *object, double delta_t)
Update object position, reversed.
structure of the physics of an object