/* posmod.c Position modulation code Copyright (c) 1998-1999, Mike Oliphant and Rob Clark */ #include "math.h" #ifdef __EMX__ /*os2*/ #include "float.h" #endif #include "pyro.h" /* Normal behavior until dx and dy slow down, then increase air resistance */ void xz_wobble(Particle *part,Firework *work) { double t; double sp=0.05; /* + = faster */ double wfact=0.05; if(part->expvel==0.0 || (fabs(part->dx)<0.001 && fabs(part->dz)<0.001)) { if(part->expvel!=0.0) { /* need to mark a flag in the particle */ part->expvel=0.0; /* this will do as it is not need any longer */ part->airres-=0.01; /* and =! 0.0 under normal circumstances. */ } t=sp*(work->timer*(3*part->rval+1)+part->rval*2*M_PI); part->mx=part->x+wfact*sin(t); part->my=part->y; part->mz=part->z+wfact*cos(t); } else { part->mx=part->x; part->my=part->y; part->mz=part->z; } }