From 46940a8e4f25b31bfd422c7096042f6c595a05e6 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 7 Dec 2010 16:26:53 +0000 Subject: [PATCH] Added saving of pause state and particle tmp value, removed INST from the menu --- includes/defines.h | 2 +- includes/powder.h | 2 +- src/main.c | 48 +++++++++++++++++++++++++++++++++++++++------- src/powder.c | 4 ++-- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index 18c98691b..ed3eb00e6 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -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 diff --git a/includes/powder.h b/includes/powder.h index 6bed6df6c..c983df8d7 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -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}, diff --git a/src/main.c b/src/main.c index fc9208272..64cd55a89 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; @@ -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>8); + d[p++] = (tttmp&0x00FF); + } } for(j=0; j=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= 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=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 34a073fe7..00179cc23 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 {