Added saving of pause state and particle tmp value, removed INST from the menu

This commit is contained in:
Simon 2010-12-07 16:26:53 +00:00
parent 0dee48278f
commit 46940a8e4f
4 changed files with 45 additions and 11 deletions

View File

@ -8,7 +8,7 @@
#endif
#define SAVE_VERSION 44
#define MINOR_VERSION 2
#define MINOR_VERSION 3
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
#define BETA

View File

@ -372,7 +372,7 @@ static const part_type ptypes[PT_NUM] =
{"@_@", PIXPACK(0x00FF77), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, R_TEMP+0.0f +273.15f, 29, "@_@, contradicts the normal state changes.", TYPE_LIQUID},
{"@_@G", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 1, SC_CRACKER, R_TEMP-200.0f+273.15f, 42, "@_@ gas", TYPE_GAS},
{"@_@S", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_CRACKER, R_TEMP+300.0f+273.15f, 251, "@_@ solid", TYPE_SOLID},
{"INST", PIXPACK(0x404039), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls, is now also a battery, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS},
{"INST", PIXPACK(0x404039), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls, is now also a battery, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS},
{"ISOZ", PIXPACK(0xAA30D0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE},
{"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID},
{"PRTI", PIXPACK(0xEB5917), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.005f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_NUCLEAR, R_TEMP+0.0f +273.15f, 40, "Portal IN. Things go in here", TYPE_SOLID},

View File

@ -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;
@ -314,6 +314,17 @@ void *build_save(int *size, int x0, int y0, int w, int h)
d[p++] = ((ttlife&0xFF00)>>8);
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++)
{
@ -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;

View File

@ -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 {