diff --git a/includes/defines.h b/includes/defines.h index 8390c6797..0304d62d2 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -7,10 +7,10 @@ #define PATH_SEP "/" #endif -#define SAVE_VERSION 52 +#define SAVE_VERSION 53 #define MINOR_VERSION 0 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. -//#define BETA +#define BETA #define SERVER "powdertoy.co.uk" diff --git a/src/elements/bcln.c b/src/elements/bcln.c index 6ecacac2f..062c85ff5 100644 --- a/src/elements/bcln.c +++ b/src/elements/bcln.c @@ -9,7 +9,7 @@ int update_BCLN(UPDATE_FUNC_ARGS) { parts[i].vx += advection*vx[y/CELL][x/CELL]; parts[i].vy += advection*vy[y/CELL][x/CELL]; } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { int r, rx, ry; for (rx=-1; rx<2; rx++) @@ -25,11 +25,16 @@ int update_BCLN(UPDATE_FUNC_ARGS) { (r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM && (r&0xFF)!=PT_STKM2 && (r&0xFF)!=PT_PBCN && (r&0xFF)>8].ctype; + } } } else { - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + if (parts[i].ctype==PT_LIFE) create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype|(parts[i].tmp<<8)); + else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } return 0; } diff --git a/src/elements/clne.c b/src/elements/clne.c index 850a3ae75..41f27e3bc 100644 --- a/src/elements/clne.c +++ b/src/elements/clne.c @@ -1,7 +1,7 @@ #include int update_CLNE(UPDATE_FUNC_ARGS) { - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) { int r, rx, ry; for (rx=-1; rx<2; rx++) @@ -17,11 +17,16 @@ int update_CLNE(UPDATE_FUNC_ARGS) { (r&0xFF)!=PT_BCLN && (r&0xFF)!=PT_STKM && (r&0xFF)!=PT_PBCN && (r&0xFF)!=PT_STKM2 && (r&0xFF)>8].ctype; + } } } else { - create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); + if (parts[i].ctype==PT_LIFE) create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype|(parts[i].tmp<<8)); + else create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); } return 0; } diff --git a/src/elements/pbcn.c b/src/elements/pbcn.c index 3c41820d0..3f40628be 100644 --- a/src/elements/pbcn.c +++ b/src/elements/pbcn.c @@ -4,20 +4,20 @@ int update_PBCN(UPDATE_FUNC_ARGS) { int r, rx, ry; if (parts[i].life>0 && parts[i].life!=10) parts[i].life--; - if (!parts[i].tmp && pv[y/CELL][x/CELL]>4.0f) - parts[i].tmp = rand()%40+80; - if (parts[i].tmp) + if (!parts[i].tmp2 && pv[y/CELL][x/CELL]>4.0f) + parts[i].tmp2 = rand()%40+80; + if (parts[i].tmp2) { float advection = 0.1f; parts[i].vx += advection*vx[y/CELL][x/CELL]; parts[i].vy += advection*vy[y/CELL][x/CELL]; - parts[i].tmp--; - if(!parts[i].tmp){ + parts[i].tmp2--; + if(!parts[i].tmp2){ kill_part(i); return 1; } } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx>8].ctype; + } } if (parts[i].life==10) { @@ -65,10 +69,10 @@ int update_PBCN(UPDATE_FUNC_ARGS) { } } } - else if (ptypes[parts[i].ctype].properties&PROP_LIFE) {//create life a different way + else if (parts[i].ctype==PT_LIFE) {//create life a different way for (rx=-1; rx<2; rx++) { for (ry=-1; ry<2; ry++) { - create_part(-1, x+rx, y+ry, parts[i].ctype); + create_part(-1, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8)); } } } else { diff --git a/src/elements/pcln.c b/src/elements/pcln.c index 3f785bb83..45cfc7996 100644 --- a/src/elements/pcln.c +++ b/src/elements/pcln.c @@ -26,7 +26,7 @@ int update_PCLN(UPDATE_FUNC_ARGS) { parts[i].life = 10; } } - if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM) + if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOLALT))) for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>=0 && x+rx>8].ctype; + } } if (parts[i].ctype>0 && parts[i].ctype=51 && ver<53 && parts[i-1].type==PT_PBCN) + { + parts[i-1].tmp2 = parts[i-1].tmp; + parts[i-1].tmp = 0; + } } else { p+=2; } } } } + if (ver>=53) { + for (j=0; j= size) + goto corrupt; + if (i <= NPART) + parts[i-1].tmp2 = d[p++]; + else + p++; + } + } + } //Read ALPHA component for (j=0; j>8].ctype = t; + if (t==PT_LIFE && v>8].tmp = v; } return -1; }