summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2010-12-07 16:26:53 (GMT)
committer Simon <simon@hardwired.org.uk>2010-12-07 16:26:53 (GMT)
commit46940a8e4f25b31bfd422c7096042f6c595a05e6 (patch)
tree186e719aae62c642852729a89b006a92eaa30617 /src
parent0dee48278f9f1f9ccc5dd7cf1262fd84da29cca2 (diff)
downloadpowder-46940a8e4f25b31bfd422c7096042f6c595a05e6.zip
powder-46940a8e4f25b31bfd422c7096042f6c595a05e6.tar.gz
Added saving of pause state and particle tmp value, removed INST from the menu
Diffstat (limited to 'src')
-rw-r--r--src/main.c48
-rw-r--r--src/powder.c4
2 files changed, 43 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index fc92082..64cd55a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -233,7 +233,7 @@ void *build_thumb(int *size, int bzip2)
void *build_save(int *size, int x0, int y0, int w, int h)
{
- unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*8+MAXSIGNS*262), *c;
+ unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*11+MAXSIGNS*262), *c;
int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int));
int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL;
@@ -315,6 +315,17 @@ void *build_save(int *size, int x0, int y0, int w, int h)
d[p++] = (ttlife&0x00FF);
}
}
+ for(j=0; j<w*h; j++)
+ {
+ i = m[j];
+ if(i){
+ //Now saving tmp!
+ //d[p++] = (parts[i-1].life+3)/4;
+ int tttmp = (int)parts[i-1].tmp;
+ d[p++] = ((tttmp&0xFF00)>>8);
+ d[p++] = (tttmp&0x00FF);
+ }
+ }
for(j=0; j<w*h; j++)
{
i = m[j];
@@ -329,7 +340,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
for(j=0; j<w*h; j++)
{
i = m[j];
- if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE))
+ if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE))
d[p++] = parts[i-1].ctype;
}
@@ -365,7 +376,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
c[0] = 0x50; //0x66;
c[1] = 0x53; //0x75;
c[2] = 0x76; //0x43;
- c[3] = legacy_enable;
+ c[3] = legacy_enable|((sys_pause<<1)&0x02);
c[4] = SAVE_VERSION;
c[5] = CELL;
c[6] = bw;
@@ -416,10 +427,14 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
}
else
{
- if(c[3]==1||c[3]==0)
- legacy_enable = c[3];
- else
+ if(c[3]==1||c[3]==0||c[3]==2||c[3]==3){
+ legacy_enable = c[3]&0x01;
+ if(ver>=44){
+ sys_pause = (c[3]&0x02)>>1;
+ }
+ } else {
legacy_beta = 1;
+ }
}
bw = c[6];
@@ -648,6 +663,25 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
}
}
}
+ if(ver>=44){
+ for(j=0; j<w*h; j++)
+ {
+ i = m[j];
+ if(i)
+ {
+ if(p >= size) {
+ goto corrupt;
+ }
+ if(i <= NPART) {
+ ttv = (d[p++])<<8;
+ ttv |= (d[p++]);
+ parts[i-1].tmp = ttv;
+ } else {
+ p+=2;
+ }
+ }
+ }
+ }
for(j=0; j<w*h; j++)
{
i = m[j];
@@ -692,7 +726,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
i = m[j];
ty = d[pty+j];
- if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43)))
+ if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_BCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43)))
{
if(p >= size)
goto corrupt;
diff --git a/src/powder.c b/src/powder.c
index 34a073f..00179cc 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1853,7 +1853,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
docontinue = 0;
} else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
- //parts[r>>8].life = 1020;
+ parts[r>>8].life = 1020;
//docontinue = 1;
} else {
if(nyy!=0 || nxx!=0){
@@ -1862,7 +1862,7 @@ void update_particles_i(pixel *vid, int start, int inc)
docontinue = 0;
}
} else if(destroy) {
- if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
+ if(parts[r>>8].type==PT_BRAY){
parts[r>>8].life = 1;
docontinue = 1;
} else {