diff --git a/includes/defines.h b/includes/defines.h index d35888f27..1c502fe97 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -8,9 +8,9 @@ #endif #define SAVE_VERSION 45 -#define MINOR_VERSION 0 +#define MINOR_VERSION 2 #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/includes/powder.h b/includes/powder.h index 50bf882d1..d3255eff4 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -190,7 +190,8 @@ #define PT_GNAR 138 #define PT_REPL 139 #define PT_MYST 140 -#define PT_NUM 141 +#define PT_BOYL 141 +#define PT_NUM 142 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -232,6 +233,7 @@ int update_BCLN(UPDATE_FUNC_ARGS); int update_BCOL(UPDATE_FUNC_ARGS); int update_BMTL(UPDATE_FUNC_ARGS); int update_BOMB(UPDATE_FUNC_ARGS); +int update_BOYL(UPDATE_FUNC_ARGS); int update_BTRY(UPDATE_FUNC_ARGS); int update_C5(UPDATE_FUNC_ARGS); int update_CLNE(UPDATE_FUNC_ARGS); @@ -475,10 +477,10 @@ static const part_type ptypes[PT_NUM] = {"BIZG", 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, 1, 1, SC_CRACKER2, R_TEMP-200.0f+273.15f, 42, "Bizarre gas", TYPE_GAS, NULL}, {"BIZS", 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, 1, 100, SC_CRACKER2, R_TEMP+300.0f+273.15f, 251, "Bizarre solid", TYPE_SOLID, NULL}, {"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, PSCN to charge, NSCN to take.", TYPE_SOLID, NULL}, - {"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, &update_ISZ}, + {"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, 0, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE, &update_ISZ}, {"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, &update_ISZ}, - {"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, 0, "Portal IN. Things go in here. Alter temperature for channels", TYPE_SOLID, &update_PRTI}, - {"PRTO", PIXPACK(0x0020EB), 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, 0, "Portal OUT. Things come out here. Alter temperature for channels", TYPE_SOLID, &update_PRTO}, + {"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, 0, "Portal IN. Things go in here, now with channels (same as WIFI)", TYPE_SOLID, &update_PRTI}, + {"PRTO", PIXPACK(0x0020EB), 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, 0, "Portal OUT. Things come out here, now with channels (same as WIFI)", TYPE_SOLID, &update_PRTO}, {"PSTE", PIXPACK(0xAA99AA), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 31, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Colloid, Hardens under pressure", TYPE_LIQUID, NULL}, {"PSTS", PIXPACK(0x776677), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 20, 0, 100, SC_CRACKER, R_TEMP-2.0f +273.15f, 29, "Solid form of PSTE, temporary", TYPE_SOLID, NULL}, {"ANAR", PIXPACK(0xFFFFEE), -0.7f, -0.02f * CFDS, 0.96f, 0.80f, 0.1f, -0.1f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite gravity", TYPE_PART, NULL}, @@ -509,6 +511,7 @@ static const part_type ptypes[PT_NUM] = {"GNAR", PIXPACK(0xE5B73B), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1/S1", TYPE_SOLID|PROP_LIFE, NULL}, {"REPL", PIXPACK(0x259588), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B1357/S1357", TYPE_SOLID|PROP_LIFE, NULL}, {"MYST", PIXPACK(0x0C3C00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "B3458/S05678", TYPE_SOLID|PROP_LIFE, NULL}, + {"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", TYPE_GAS, &update_BOYL}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description }; @@ -656,6 +659,7 @@ static part_state pstates[PT_NUM] = /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* BOYL */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_NONE, 0.0f}, }; // temporarily define abbreviations for impossible p/t values @@ -812,6 +816,7 @@ static part_transition ptransitions[PT_NUM] = /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, /* GOL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, + /* BOYL */ {IPL, NT, IPH, NT, ITL, NT, ITH, NT}, }; #undef IPL #undef IPH @@ -893,6 +898,7 @@ static int lolzrule[9][9] = }; int portal[(int)(MAX_TEMP-73.15f)/100+2][8][80]; float portaltemp[(int)(MAX_TEMP-73.15f)/100+2][8][80]; +int portalctype[(int)(MAX_TEMP-73.15f)/100+2][8][80]; int wireless[(int)(MAX_TEMP-73.15f)/100+2][2]; extern int isplayer; diff --git a/src/elements/aray.c b/src/elements/aray.c index 136158ae9..a931b1ae1 100644 --- a/src/elements/aray.c +++ b/src/elements/aray.c @@ -44,7 +44,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) { } else if ((r&0xFF)==PT_FILT) { colored = parts[r>>8].ctype; - } else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI) { + } else if ((r&0xFF)!=PT_INWR && (r&0xFF)!=PT_ARAY && (r&0xFF)!=PT_WIFI && !((r&0xFF)==PT_SWCH && parts[r>>8].life>=10)) { if (nyy!=0 || nxx!=0) { create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK); } @@ -58,7 +58,7 @@ int update_ARAY(UPDATE_FUNC_ARGS) { if (parts[r>>8].type==PT_BRAY) { parts[r>>8].life = 1; docontinue = 1; - } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI) { + } else if (parts[r>>8].type==PT_INWR || parts[r>>8].type==PT_ARAY || parts[r>>8].type==PT_WIFI || parts[r>>8].type==PT_FILT || (parts[r>>8].type==PT_SWCH && parts[r>>8].life>=10)) { docontinue = 1; } else { docontinue = 0; diff --git a/src/elements/boyl.c b/src/elements/boyl.c new file mode 100644 index 000000000..7486d2eb6 --- /dev/null +++ b/src/elements/boyl.c @@ -0,0 +1,43 @@ +#include + +int update_BOYL(UPDATE_FUNC_ARGS) { + int r, rx, ry; + if (pv[y/CELL][x/CELL]<(parts[i].temp/100)) + pv[y/CELL][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL]); + if (y+CELL0 && pv[y/CELL-1][x/CELL]<(parts[i].temp/100)) + pv[y/CELL-1][x/CELL] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL]); + if (x+CELL>0) + { + pv[y/CELL][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL-1]); + if (y+CELL>0) + pv[y/CELL-1][x/CELL-1] += 0.001f*((parts[i].temp/100)-pv[y/CELL-1][x/CELL-1]); + } + for (rx=-1; rx<2; rx++) + for (ry=-1; ry<2; ry++) + if (x+rx>=0 && y+ry>0 && + x+rx>8)>=NPART || !r) + continue; + if ((r&0xFF)==PT_WATR && 1>rand()%30) + { + part_change_type(r>>8,x+rx,y+ry,PT_FOG); + } + else if ((r&0xFF)==PT_O2 && 1>rand()%9) + { + kill_part(r>>8); + part_change_type(i,x,y,PT_WATR); + pv[y/CELL][x/CELL] += 4.0; + } + } + return 0; +} diff --git a/src/elements/neut.c b/src/elements/neut.c index 61511d146..564b74ca7 100644 --- a/src/elements/neut.c +++ b/src/elements/neut.c @@ -57,12 +57,8 @@ int update_NEUT(UPDATE_FUNC_ARGS) { part_change_type(i,x,y,PT_DUST); else if ((r&0xFF)==PT_DYST && 15>(rand()%1000)) part_change_type(i,x,y,PT_YEST); - else if ((r&0xFF)==PT_YEST) { - if (15>(rand()%100000)&&isplayer==0) - create_part(r>>8, x+rx, y+ry, PT_STKM); - else - part_change_type(i,x,y,PT_DYST); - } + else if ((r&0xFF)==PT_YEST) + part_change_type(i,x,y,PT_DYST); else if ((r&0xFF)==PT_WATR && 15>(rand()%100)) part_change_type(r>>8,x+rx,y+ry,PT_DSTW); else if ((r&0xFF)==PT_PLEX && 15>(rand()%1000)) diff --git a/src/elements/prti.c b/src/elements/prti.c index 4d3a4bef9..a7e2013cb 100644 --- a/src/elements/prti.c +++ b/src/elements/prti.c @@ -18,6 +18,7 @@ int update_PRTI(UPDATE_FUNC_ARGS) { { portal[parts[i].tmp][count-1][nnx] = parts[r>>8].type; portaltemp[parts[i].tmp][count-1][nnx] = parts[r>>8].temp; + portalctype[parts[i].tmp][count-1][nnx] = parts[r>>8].ctype; if (parts[r>>8].type==PT_SPRK) part_change_type(r>>8,x+rx,y+ry,parts[r>>8].ctype); else diff --git a/src/elements/prto.c b/src/elements/prto.c index a5d2c7ec9..4889e89e2 100644 --- a/src/elements/prto.c +++ b/src/elements/prto.c @@ -40,8 +40,10 @@ int update_PRTO(UPDATE_FUNC_ARGS) { np = create_part(-1,x+rx,y+ry,portal[parts[i].tmp][randomness-1][nnx]); if (np<0) continue; parts[np].temp = portaltemp[parts[i].tmp][randomness-1][nnx]; + parts[np].ctype = portalctype[parts[i].tmp][randomness-1][nnx]; portal[parts[i].tmp][randomness-1][nnx] = 0; portaltemp[parts[i].tmp][randomness-1][nnx] = 0; + portalctype[parts[i].tmp][randomness-1][nnx] = 0; break; } } diff --git a/src/elements/stkm.c b/src/elements/stkm.c index 2403bc2da..66f9b2e87 100644 --- a/src/elements/stkm.c +++ b/src/elements/stkm.c @@ -20,6 +20,11 @@ int update_STKM(UPDATE_FUNC_ARGS) { if ((parts[i].temp<309.6f) && (parts[i].temp>=243)) parts[i].temp += 1; + if (isplayer) { //Already a stickman in the simulation + death = 1; + parts[i].type = PT_NONE; + } + //Death if (parts[i].life<1 || death || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { diff --git a/src/elements/stkm2.c b/src/elements/stkm2.c index b0a2be395..7c0204357 100644 --- a/src/elements/stkm2.c +++ b/src/elements/stkm2.c @@ -20,6 +20,11 @@ int update_STKM2(UPDATE_FUNC_ARGS) { if ((parts[i].temp<309.6f) && (parts[i].temp>=243)) parts[i].temp += 1; + if (isplayer2) { //Already a stickman2 in the simulation + death2 = 1; + parts[i].type = PT_NONE; + } + //Death if (parts[i].life<1 || death2 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { diff --git a/src/elements/swch.c b/src/elements/swch.c index 2c538ccda..5d623cd59 100644 --- a/src/elements/swch.c +++ b/src/elements/swch.c @@ -25,5 +25,13 @@ int update_SWCH(UPDATE_FUNC_ARGS) { } } } + if (parts[i].life==10 && (!(pmap[y-1][x-1]&0xFF) && ((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) && !(pmap[y-1][x+1]&0xFF) && ((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2))) + { + parts[i].life = 9; + } + else if (parts[i].life<=5 && (!(pmap[y-1][x-1]&0xFF) && (((pmap[y-1][x]&0xFF)==PT_BRAY&&parts[pmap[y-1][x]>>8].tmp==2) || ((pmap[y+1][x]&0xFF)==PT_BRAY&&parts[pmap[y+1][x]>>8].tmp==2)) && !(pmap[y-1][x+1]&0xFF) && (((pmap[y][x+1]&0xFF)==PT_BRAY&&parts[pmap[y][x+1]>>8].tmp==2) || ((pmap[y][x-1]&0xFF)==PT_BRAY&&parts[pmap[y][x-1]>>8].tmp==2)))) + { + parts[i].life = 14; + } return 0; } diff --git a/src/graphics.c b/src/graphics.c index ab7cc31bc..6c0123f93 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1478,7 +1478,12 @@ void draw_parts(pixel *vid) cb = 0; blendpixel(vid, nx, ny, cr, cg, cb, 255); } - else if (cmode==CM_FANCY) + else if (cmode==CM_FANCY && + t!=PT_FIRE && t!=PT_PLSM && t!=PT_WTRV && + t!=PT_HFLM && t!=PT_SPRK && t!=PT_FIRW && + t!=PT_DUST && t!=PT_FIRW && t!=PT_FWRK && + t!=PT_NEUT && t!=PT_LAVA && t!=PT_BOMB && + t!=PT_PHOT && t!=PT_THDR && t!=PT_SMKE) { if (ptypes[parts[i].type].properties&TYPE_LIQUID) { diff --git a/src/powder.c b/src/powder.c index ccca0c22b..e59fd89aa 100644 --- a/src/powder.c +++ b/src/powder.c @@ -701,11 +701,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].vx = 3.0f*cosf(a); parts[i].vy = 3.0f*sinf(a); } - if (t==PT_BIZR||t==PT_BIZRG) - parts[i].ctype = 0x47FFFF; - if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP - pmap[y][x] = t|(i<<8); - else if (t==PT_STKM) + if (t==PT_STKM) { if (isplayer==0) { @@ -755,11 +751,15 @@ inline int create_part(int p, int x, int y, int t) isplayer = 1; } + else + { + return -1; + } //kill_part(playerspawn); create_part(-1,x,y,PT_SPAWN); ISSPAWN1 = 1; } - else if (t==PT_STKM2) + if (t==PT_STKM2) { if (isplayer2==0) { @@ -809,10 +809,18 @@ inline int create_part(int p, int x, int y, int t) isplayer2 = 1; } + else + { + return -1; + } //kill_part(player2spawn); create_part(-1,x,y,PT_SPAWN2); ISSPAWN2 = 1; } + if (t==PT_BIZR||t==PT_BIZRG) + parts[i].ctype = 0x47FFFF; + if (t!=PT_STKM&&t!=PT_STKM2 && t!=PT_PHOT)// && t!=PT_NEUT) is this needed? it breaks floodfill, Yes photons should not be placed in the PMAP + pmap[y][x] = t|(i<<8); return i; } @@ -1425,16 +1433,16 @@ void update_particles_i(pixel *vid, int start, int inc) j = a = nt = 0; for (nx=-1; nx<2; nx++) for (ny=-1; ny<2; ny++) { - if (nx||ny){ + if (nx||ny) { surround[j] = r = pmap[y+ny][x+nx]; j++; - if (!bmap[(y+ny)/CELL][(x+nx)/CELL] || bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_STREAM) - { - if (!(r&0xFF)) - a = 1; - if ((r&0xFF)!=t) - nt = 1; - } + if (!bmap[(y+ny)/CELL][(x+nx)/CELL] || bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_STREAM) + { + if (!(r&0xFF)) + a = 1; + if ((r&0xFF)!=t) + nt = 1; + } } } @@ -1468,6 +1476,18 @@ void update_particles_i(pixel *vid, int start, int inc) parts[surround_hconduct[j]].temp = pt; } + if (y-2 >= 0 && y-2 < YRES && ptypes[t].properties&TYPE_LIQUID) { + float swappage; + r = pmap[y-2][x]; + if (!((r>>8)>=NPART || !r || parts[i].type != (r&0xFF))) { + if (parts[i].temp>parts[r>>8].temp) { + swappage = parts[i].temp; + parts[i].temp = parts[r>>8].temp; + parts[r>>8].temp = swappage; + } + } + } + s = 1; if (pt>ptransitions[t].thv&&ptransitions[t].tht>-1) { if (ptransitions[t].tht!=PT_NUM)