Change STOR, PIPE, DUST to make correct use of .flags field.

This commit is contained in:
Simon Robertshaw 2012-04-19 16:37:53 +01:00
parent f93a829672
commit b5a52838c7
6 changed files with 18 additions and 16 deletions

View File

@ -63,7 +63,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) {
if (np!=-1)
{
parts[np].temp = parts[r>>8].temp;
parts[np].life = parts[r>>8].flags;
parts[np].life = parts[r>>8].tmp2;
parts[np].tmp = parts[r>>8].pavg[0];
parts[np].ctype = parts[r>>8].pavg[1];
parts[r>>8].tmp = 0;

View File

@ -23,7 +23,7 @@ int update_FIRW(UPDATE_FUNC_ARGS) {
parts[i].tmp=2;
} else {
float newVel = parts[i].life/25;
parts[i].flags = parts[i].flags&0xFFFFFFFE;
parts[i].flags &= ~FLAG_STAGNANT;
/* TODO:
if ((pmap[(int)(ly-newVel)][(int)lx]&0xFF)==PT_NONE && ly-newVel>0) {
parts[i].vy = -newVel;

View File

@ -38,7 +38,7 @@ int update_FWRK(UPDATE_FUNC_ARGS) {
parts[np].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
parts[np].life= rand()%37+18;
parts[np].tmp=q;
parts[np].flags=w;
parts[np].tmp2=w;
parts[np].ctype=e;
parts[np].temp= rand()%20+6000;
parts[np].dcolour = parts[i].dcolour;

View File

@ -107,7 +107,7 @@ int graphics_DUST(GRAPHICS_FUNC_ARGS)
if(cpart->life >= 1)
{
*firea = 120;
*firer = *colr = cpart->flags;
*firer = *colr = cpart->tmp2;
*fireg = *colg = cpart->tmp;
*fireb = *colb = cpart->ctype;
if (decorations_enable && cpart->dcolour)

View File

@ -1,5 +1,7 @@
#include <element.h>
#define PFLAG_NORMALSPEED 0x00010000
signed char pos_1_rx[] = {-1,-1,-1, 0, 0, 1, 1, 1};
signed char pos_1_ry[] = {-1, 0, 1,-1, 1,-1, 0, 1};
@ -31,11 +33,11 @@ void pushParticle(int i, int count, int original)
{
parts[r>>8].tmp = (parts[r>>8].tmp&~0xFF) | (parts[i].tmp&0xFF);
parts[r>>8].temp = parts[i].temp;
parts[r>>8].flags = parts[i].flags;
parts[r>>8].tmp2 = parts[i].tmp2;
parts[r>>8].pavg[0] = parts[i].pavg[0];
parts[r>>8].pavg[1] = parts[i].pavg[1];
if (r>>8 > original)
parts[r>>8].tmp2 = 1;//skip particle push, normalizes speed
parts[r>>8].flags |= PFLAG_NORMALSPEED;//skip particle push, normalizes speed
parts[i].tmp &= ~0xFF;
count++;
pushParticle(r>>8,count,original);
@ -54,11 +56,11 @@ void pushParticle(int i, int count, int original)
{
parts[r>>8].tmp = (parts[r>>8].tmp&~0xFF) | (parts[i].tmp&0xFF);
parts[r>>8].temp = parts[i].temp;
parts[r>>8].flags = parts[i].flags;
parts[r>>8].tmp2 = parts[i].tmp2;
parts[r>>8].pavg[0] = parts[i].pavg[0];
parts[r>>8].pavg[1] = parts[i].pavg[1];
if (r>>8 > original)
parts[r>>8].tmp2 = 1;//skip particle push, normalizes speed
parts[r>>8].flags |= PFLAG_NORMALSPEED;//skip particle push, normalizes speed
parts[i].tmp &= ~0xFF;
count++;
pushParticle(r>>8,count,original);
@ -111,9 +113,9 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
}
else
{
if (parts[i].tmp2 == 1)//skip particle push to prevent particle number being higher causeing speed up
if (parts[i].flags&PFLAG_NORMALSPEED)//skip particle push to prevent particle number being higher causeing speed up
{
parts[i].tmp2 = 0 ;
parts[i].flags &= ~PFLAG_NORMALSPEED;
}
else
{
@ -138,7 +140,7 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
if (np!=-1)
{
parts[np].temp = parts[i].temp;//pipe saves temp and life now
parts[np].life = parts[i].flags;
parts[np].life = parts[i].tmp2;
parts[np].tmp = parts[i].pavg[0];
parts[np].ctype = parts[i].pavg[1];
parts[i].tmp &= ~0xFF;
@ -151,7 +153,7 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
detach(r>>8);
parts[i].tmp = (parts[i].tmp&~0xFF) | parts[r>>8].type;
parts[i].temp = parts[r>>8].temp;
parts[i].flags = parts[r>>8].life;
parts[i].tmp2 = parts[r>>8].life;
parts[i].pavg[0] = parts[r>>8].tmp;
parts[i].pavg[1] = parts[r>>8].ctype;
kill_part(r>>8);
@ -160,7 +162,7 @@ int update_PIPE(UPDATE_FUNC_ARGS) {
{
parts[i].tmp = parts[r>>8].tmp;
parts[i].temp = parts[r>>8].temp;
parts[i].flags = parts[r>>8].flags;
parts[i].tmp2 = parts[r>>8].tmp2;
parts[i].pavg[0] = parts[r>>8].pavg[0];
parts[i].pavg[1] = parts[r>>8].pavg[1];
parts[r>>8].tmp = 0;
@ -253,7 +255,7 @@ int graphics_PIPE(GRAPHICS_FUNC_ARGS)
memset(&tpart, 0, sizeof(particle));
tpart.type = cpart->tmp&0xFF;
tpart.temp = cpart->temp;
tpart.life = cpart->flags;
tpart.life = cpart->tmp2;
tpart.tmp = cpart->pavg[0];
tpart.ctype = cpart->pavg[1];
t = tpart.type;

View File

@ -15,7 +15,7 @@ int update_STOR(UPDATE_FUNC_ARGS) {
{
parts[i].tmp = parts[r>>8].type;
parts[i].temp = parts[r>>8].temp;
parts[i].flags = parts[r>>8].life;
parts[i].tmp2 = parts[r>>8].life;
parts[i].pavg[0] = parts[r>>8].tmp;
parts[i].pavg[1] = parts[r>>8].ctype;
kill_part(r>>8);
@ -28,7 +28,7 @@ int update_STOR(UPDATE_FUNC_ARGS) {
if (np!=-1)
{
parts[np].temp = parts[i].temp;
parts[np].life = parts[i].flags;
parts[np].life = parts[i].tmp2;
parts[np].tmp = parts[i].pavg[0];
parts[np].ctype = parts[i].pavg[1];
parts[i].tmp = 0;