From 45078b5933921cc25166c39a16207c7b18a66527 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 5 Jan 2011 18:34:39 -0500 Subject: [PATCH 01/10] update, and another small ARAY feature, goes through SWCH. --- includes/powder.h | 2 +- src/powder.c | 37 ++++++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 501c066bd..5c3218e19 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -390,7 +390,7 @@ static const part_type ptypes[PT_NUM] = {"BIZR", 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, "Bizarre... contradicts the normal state changes.", TYPE_LIQUID, NULL}, {"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_CRACKER2, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS, 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|PROP_CONDUCTS, 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, 0, 1, 24, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE, NULL}, {"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, NULL}, {"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, NULL}, diff --git a/src/powder.c b/src/powder.c index b21e113ae..26ddff709 100644 --- a/src/powder.c +++ b/src/powder.c @@ -564,11 +564,17 @@ inline int create_part(int p, int x, int y, int t) return -1; if(p==-1)//creating from anything but brush { - if(pmap[y][x]) - if((pmap[y][x]&0xFF)!=PT_SPAWN&&(pmap[y][x]&0xFF)!=PT_SPAWN2) - if(t!=PT_STKM&&t!=PT_STKM2) - return -1; - if(pfree == -1) + if(pmap[y][x]) + { + if((pmap[y][x]&0xFF)!=PT_SPAWN&&(pmap[y][x]&0xFF)!=PT_SPAWN2) + { + if(t!=PT_STKM&&t!=PT_STKM2) + { + return -1; + } + } + } + if(pfree == -1) return -1; i = pfree; pfree = parts[i].life; @@ -576,11 +582,11 @@ inline int create_part(int p, int x, int y, int t) else if(p==-2)//creating from brush { if(pmap[y][x]) - { - if(((pmap[y][x]&0xFF)==PT_CLNE||(pmap[y][x]&0xFF)==PT_BCLN||(pmap[y][x]&0xFF)==PT_PCLN)&&(t!=PT_CLNE&&t!=PT_PCLN&&t!=PT_BCLN&&t!=PT_STKM&&t!=PT_STKM2)) { - parts[pmap[y][x]>>8].ctype = t; - } + if(((pmap[y][x]&0xFF)==PT_CLNE||(pmap[y][x]&0xFF)==PT_BCLN||(pmap[y][x]&0xFF)==PT_PCLN)&&(t!=PT_CLNE&&t!=PT_PCLN&&t!=PT_BCLN&&t!=PT_STKM&&t!=PT_STKM2)) + { + parts[pmap[y][x]>>8].ctype = t; + } return -1; } if(pfree == -1) @@ -685,7 +691,7 @@ inline int create_part(int p, int x, int y, int t) } 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 + 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) { @@ -2097,6 +2103,7 @@ void update_particles_i(pixel *vid, int start, int inc) continue; if((r&0xFF)==PT_SPRK){ int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0; + int nostop = (parts[r>>8].ctype==PT_INST)?1:0; for (docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) { if(!(x+nxi+nxx= 0 && y+nyi+nyy >= 0)){ break; @@ -2128,17 +2135,21 @@ void update_particles_i(pixel *vid, int start, int inc) } else if(parts[r>>8].type==PT_FILT){ colored = parts[r>>8].ctype; - }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_SWCH && parts[r>>8].life>=10)) { if(nyy!=0 || nxx!=0){ create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK); } - docontinue = 0; + if(!(nostop && (ptypes[parts[r>>8].ctype].properties&PROP_CONDUCTS))){ + docontinue = 0; + } else { + docontinue = 1; + } } } else if(destroy) { 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; From 52573e94f9dcde2cc2a43061b5bcb77c724bb3c5 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Fri, 7 Jan 2011 13:07:46 -0500 Subject: [PATCH 02/10] two red BRAYS will toggle SWCH, could be used for something... --- src/powder.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/powder.c b/src/powder.c index 26ddff709..404d4ac5c 100644 --- a/src/powder.c +++ b/src/powder.c @@ -3818,6 +3818,7 @@ void update_particles_i(pixel *vid, int start, int inc) if((r>>8)>=NPART || !r) continue; rt = parts[r>>8].type; + if(parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL) { if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0) @@ -3835,6 +3836,14 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].life = 9; } } + 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; + } } if(t==PT_SWCH) if((parts[i].life>0&&parts[i].life<10)|| parts[i].life > 10) From b83b2f1d270662ab28e4ea65d63f023f922bcc8f Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 8 Jan 2011 17:38:36 +0000 Subject: [PATCH 03/10] Convection --- src/powder.c | 266 +++++++++++++++++++++++++++------------------------ 1 file changed, 139 insertions(+), 127 deletions(-) diff --git a/src/powder.c b/src/powder.c index ec6ac3374..196f76de5 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1621,10 +1621,10 @@ void update_particles_i(pixel *vid, int start, int inc) if(t==PT_GAS && pv[y/CELL][x/CELL]<-6.0f) t = parts[i].type = PT_OIL; if(t==PT_DESL && pv[y/CELL][x/CELL]>5.0f) - { // Only way I know to make it - t = parts[i].type = PT_FIRE; // combust under pressure. - parts[i].life = rand()%50+120; - } + { + t = parts[i].type = PT_FIRE; + parts[i].life = rand()%50+120; + } if(t==PT_GAS && pv[y/CELL][x/CELL]>6.0f) t = parts[i].type = PT_OIL; if(t==PT_BMTL && pv[y/CELL][x/CELL]>2.5f) @@ -1633,21 +1633,21 @@ void update_particles_i(pixel *vid, int start, int inc) t = parts[i].type = PT_BRMT; if(t==PT_BRCK && pv[y/CELL][x/CELL]>8.8f) t = parts[i].type = PT_STNE; - if(t==PT_PIPE && pv[y/CELL][x/CELL]>10.0f) + if(t==PT_PIPE && pv[y/CELL][x/CELL]>10.0f) t = parts[i].type = PT_BRMT; - if(t==PT_PSTE && pv[y/CELL][x/CELL]>0.5f) + if(t==PT_PSTE && pv[y/CELL][x/CELL]>0.5f) t = parts[i].type = PT_PSTS; - if(t==PT_PSTS && pv[y/CELL][x/CELL]<0.5f) + if(t==PT_PSTS && pv[y/CELL][x/CELL]<0.5f) t = parts[i].type = PT_PSTE; - if(t==PT_SHLD1 && pv[y/CELL][x/CELL]>7.0f) + if(t==PT_SHLD1 && pv[y/CELL][x/CELL]>7.0f) t = parts[i].type = PT_NONE; - if(t==PT_SHLD2 && pv[y/CELL][x/CELL]>15.0f) + if(t==PT_SHLD2 && pv[y/CELL][x/CELL]>15.0f) t = parts[i].type = PT_NONE; - if(t==PT_SHLD3 && pv[y/CELL][x/CELL]>25.0f) + if(t==PT_SHLD3 && pv[y/CELL][x/CELL]>25.0f) t = parts[i].type = PT_NONE; - if(t==PT_SHLD4 && pv[y/CELL][x/CELL]>40.0f) + if(t==PT_SHLD4 && pv[y/CELL][x/CELL]>40.0f) t = parts[i].type = PT_NONE; - if(t==PT_WIFI && pv[y/CELL][x/CELL]>15.0f) + if(t==PT_WIFI && pv[y/CELL][x/CELL]>15.0f) t = parts[i].type = PT_BRMT; //if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f) // t = parts[i].type = PT_BGLA; @@ -1660,7 +1660,7 @@ void update_particles_i(pixel *vid, int start, int inc) parts[i].type = PT_BGLA; } } - if(t==PT_QRTZ) + if(t==PT_QRTZ) { parts[i].pavg[0] = parts[i].pavg[1]; parts[i].pavg[1] = pv[y/CELL][x/CELL]; @@ -1676,20 +1676,20 @@ void update_particles_i(pixel *vid, int start, int inc) t = PT_NEUT; create_part(i, x, y, t); } - if((t==PT_ISOZ||t==PT_ISZS) && 1>rand()%200 && ((int)(-4.0f*(pv[y/CELL][x/CELL])))>(rand()%1000)) + if((t==PT_ISOZ||t==PT_ISZS) && 1>rand()%200 && ((int)(-4.0f*(pv[y/CELL][x/CELL])))>(rand()%1000)) { t = PT_PHOT; - rr = (rand()%228+128)/127.0f; - rrr = (rand()%360)*3.14159f/180.0f; - parts[i].life = 680; - parts[i].ctype = 0x3FFFFFFF; - parts[i].vx = rr*cosf(rrr); - parts[i].vy = rr*sinf(rrr); + rr = (rand()%228+128)/127.0f; + rrr = (rand()%360)*3.14159f/180.0f; + parts[i].life = 680; + parts[i].ctype = 0x3FFFFFFF; + parts[i].vx = rr*cosf(rrr); + parts[i].vy = rr*sinf(rrr); create_part(i, x, y, t); } - if(t==PT_PSTE) - if(parts[i].temp>747.0f) - t = parts[i].type = PT_BRCK; + if(t==PT_PSTE) + if(parts[i].temp>747.0f) + t = parts[i].type = PT_BRCK; if(t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1) { nearp = nearest_part(i, PT_ETRD); @@ -1748,110 +1748,122 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - if(pt>=pstates[t].btemp&&pstates[t].burn) - { - t = parts[i].type = pstates[t].burn; - if(t==PT_FIRE||t==PT_PLSM) - parts[i].life = rand()%50+120; - } - else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) - { - if(t==PT_LAVA&&parts[i].ctype) - { - parts[i].life = 0; - if(parts[i].ctype==PT_THRM) - { - parts[i].tmp = 0; - parts[i].ctype = PT_BMTL; - } - if(parts[i].ctype==PT_PLUT) - { - parts[i].tmp = 0; - parts[i].ctype = PT_LAVA; - } - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) - { - parts[i].ctype = parts[i].type; - t = parts[i].type = PT_ICEI; - } - else - { - parts[i].life = 0; - t = parts[i].type = pstates[t].solid; - } - } - else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) - { - if(pstates[t].liquid==PT_LAVA) - { - parts[i].life = rand()%120+240; - parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; - parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; - parts[i].ctype = (parts[i].ctype==PT_PQRT)?PT_QRTZ:parts[i].ctype; - t = parts[i].type = pstates[t].liquid; - } - else if(t==PT_ICEI&&parts[i].ctype) - { - t = parts[i].type = parts[i].ctype; - parts[i].ctype = PT_NONE; - } - else - { - t = parts[i].type = pstates[t].liquid; - } - } - else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) - { - t = parts[i].type = pstates[t].liquid; - } - else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) - { - if(t==PT_SLTW&&1>rand()%6) - { - t = parts[i].type = PT_SALT; - } - else - { - if((t==PT_BIZR||t==PT_BIZRG||t==PT_BIZRS)&&pt>=pstates[t].gtemp) - { - t = parts[i].type = pstates[t].gas; - } - else{ - t = parts[i].type = pstates[t].gas; - pv[y/CELL][x/CELL] += 0.50f; - } - - if(t==PT_FIRE) - parts[i].life = rand()%50+120; - if(t==PT_HFLM) - parts[i].life = rand()%50+120; - } - } - if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) - { - float atemp = parts[i].temp + (-MIN_TEMP); - pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; - } - if(t==PT_LAVA) - { - parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); - if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) - { - parts[i].tmp--; - parts[i].temp = 3500; - } - if(parts[i].ctype==PT_PLUT&&parts[i].tmp>0) - { - parts[i].tmp--; - parts[i].temp = MAX_TEMP; - } - } - pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); - } + 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; + } + } + } + + if(pt>=pstates[t].btemp&&pstates[t].burn) + { + t = parts[i].type = pstates[t].burn; + if(t==PT_FIRE||t==PT_PLSM) + parts[i].life = rand()%50+120; + } + else if((pt<=pstates[t].stemp||(t==PT_LAVA&&(pt<=pstates[parts[i].ctype].ltemp)))&&pstates[t].solid) + { + if(t==PT_LAVA&&parts[i].ctype) + { + parts[i].life = 0; + if(parts[i].ctype==PT_THRM) + { + parts[i].tmp = 0; + parts[i].ctype = PT_BMTL; + } + if(parts[i].ctype==PT_PLUT) + { + parts[i].tmp = 0; + parts[i].ctype = PT_LAVA; + } + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else if(pstates[t].solid==PT_ICEI&&pt<=pstates[t].stemp) + { + parts[i].ctype = parts[i].type; + t = parts[i].type = PT_ICEI; + } + else + { + parts[i].life = 0; + t = parts[i].type = pstates[t].solid; + } + } + else if((pt>=pstates[t].ltemp&&(pt<=pstates[t].gtemp||!pstates[t].gas)&&pstates[t].state==ST_SOLID&&pstates[t].liquid)||(t==PT_ICEI&&pt>pstates[parts[i].ctype].stemp)) + { + if(pstates[t].liquid==PT_LAVA) + { + parts[i].life = rand()%120+240; + parts[i].ctype = (parts[i].type==PT_BRMT)?PT_BMTL:parts[i].type; + parts[i].ctype = (parts[i].ctype==PT_SAND)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_BGLA)?PT_GLAS:parts[i].ctype; + parts[i].ctype = (parts[i].ctype==PT_PQRT)?PT_QRTZ:parts[i].ctype; + t = parts[i].type = pstates[t].liquid; + } + else if(t==PT_ICEI&&parts[i].ctype) + { + t = parts[i].type = parts[i].ctype; + parts[i].ctype = PT_NONE; + } + else + { + t = parts[i].type = pstates[t].liquid; + } + } + else if(pt-ctemp<=pstates[t].ltemp&&pstates[t].liquid&&pstates[t].state==ST_GAS) + { + t = parts[i].type = pstates[t].liquid; + } + else if(pt-ctemp>=pstates[t].gtemp&&(pstates[t].gas||parts[i].type==PT_LNTG)&&(pstates[t].state==ST_LIQUID||pstates[t].state==ST_SOLID)) + { + if(t==PT_SLTW&&1>rand()%6) + { + t = parts[i].type = PT_SALT; + } + else + { + if((t==PT_BIZR||t==PT_BIZRG||t==PT_BIZRS)&&pt>=pstates[t].gtemp) + { + t = parts[i].type = pstates[t].gas; + } + else{ + t = parts[i].type = pstates[t].gas; + pv[y/CELL][x/CELL] += 0.50f; + } + + if(t==PT_FIRE) + parts[i].life = rand()%50+120; + if(t==PT_HFLM) + parts[i].life = rand()%50+120; + } + } + if(t==PT_URAN && pv[y/CELL][x/CELL]>0.0f) + { + float atemp = parts[i].temp + (-MIN_TEMP); + pt = parts[i].temp = (atemp*(1+(pv[y/CELL][x/CELL]/2000)))+MIN_TEMP; + } + if(t==PT_LAVA) + { + parts[i].life = restrict_flt((pt-700)/7, 0.0f, 400.0f); + if(parts[i].ctype==PT_THRM&&parts[i].tmp>0) + { + parts[i].tmp--; + parts[i].temp = 3500; + } + if(parts[i].ctype==PT_PLUT&&parts[i].tmp>0) + { + parts[i].tmp--; + parts[i].temp = MAX_TEMP; + } + } + pt = parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP); + } } if(t==PT_PTCT&&parts[i].temp>295.0f) { From 76304bac8d90370aeed1635352cbaf2cf80573d8 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sat, 8 Jan 2011 13:16:14 -0500 Subject: [PATCH 04/10] BOYL, a gas that evens out pressure related to its temp, kind of a gas PUMP, but not really, BOYL+WATR=FOG BOYL+O2=WATR, possibly hydrogen in the future? --- includes/powder.h | 5 ++++- src/powder.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/includes/powder.h b/includes/powder.h index 5c3218e19..123ca455e 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -189,7 +189,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 @@ -425,6 +426,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, "Rawr", TYPE_GAS, NULL}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description }; @@ -572,6 +574,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}, }; static int grule[NGOL][9] = diff --git a/src/powder.c b/src/powder.c index 404d4ac5c..303ed5892 100644 --- a/src/powder.c +++ b/src/powder.c @@ -1442,6 +1442,27 @@ void update_particles_i(pixel *vid, int start, int inc) pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+1]); } } + else if(t==PT_BOYL) + { + 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]); + } + } else if(t==PT_SING) { int singularity = -parts[i].life; @@ -3722,6 +3743,28 @@ void update_particles_i(pixel *vid, int start, int inc) } } } + else if(t==PT_BOYL) + { + for(nx=-1; nx<2; nx++) + for(ny=-1; ny<2; ny++) + if(x+nx>=0 && y+ny>0 && + x+nx>8)>=NPART || !r) + continue; + if(parts[r>>8].type==PT_WATR && 1>rand()%30) + { + parts[r>>8].type = PT_FOG; + } + if(parts[r>>8].type==PT_O2 && 1>rand()%9) + { + parts[r>>8].type = PT_NONE; + t = parts[i].type = PT_WATR; + pv[y/CELL][x/CELL] += 4.0; + } + } + } else if(t==PT_FIRW) { if(parts[i].tmp==0) { for(nx=-1; nx<2; nx++) From b4fb2bf20a807f4371a6848b3470baf2d5638ccb Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sat, 8 Jan 2011 13:21:09 -0500 Subject: [PATCH 05/10] forgot BOYL description --- includes/powder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/powder.h b/includes/powder.h index 123ca455e..2f68526e9 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -426,7 +426,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, "Rawr", TYPE_GAS, 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, NULL}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description }; From ad7dc345d265d7d6182246c04f95960c7b54d302 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 8 Jan 2011 18:30:29 +0000 Subject: [PATCH 06/10] Fix 2 stickman bug --- src/powder.c | 149 ++++++++++++++++++++++++++++----------------------- 1 file changed, 82 insertions(+), 67 deletions(-) diff --git a/src/powder.c b/src/powder.c index 26edb0ca6..c6c90c157 100644 --- a/src/powder.c +++ b/src/powder.c @@ -689,118 +689,126 @@ 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) { - if(pmap[y][x]&0xFF==PT_SPAWN) - { - parts[pmap[y][x]>>8].type = PT_STKM; - parts[pmap[y][x]>>8].vx = 0; - parts[pmap[y][x]>>8].vy = 0; - parts[pmap[y][x]>>8].life = 100; - parts[pmap[y][x]>>8].ctype = 0; - parts[pmap[y][x]>>8].temp = ptypes[t].heat; - - } - else - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - - - + if(pmap[y][x]&0xFF==PT_SPAWN) + { + parts[pmap[y][x]>>8].type = PT_STKM; + parts[pmap[y][x]>>8].vx = 0; + parts[pmap[y][x]>>8].vy = 0; + parts[pmap[y][x]>>8].life = 100; + parts[pmap[y][x]>>8].ctype = 0; + parts[pmap[y][x]>>8].temp = ptypes[t].heat; + + } + else + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + + + player[3] = x-1; //Setting legs positions player[4] = y+6; player[5] = x-1; player[6] = y+6; - + player[7] = x-3; player[8] = y+12; player[9] = x-3; player[10] = y+12; - + player[11] = x+1; player[12] = y+6; player[13] = x+1; player[14] = y+6; - + player[15] = x+3; player[16] = y+12; player[17] = x+3; player[18] = y+12; - + 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) { - if(pmap[y][x]&0xFF==PT_SPAWN2) - { - parts[pmap[y][x]>>8].type = PT_STKM2; - parts[pmap[y][x]>>8].vx = 0; - parts[pmap[y][x]>>8].vy = 0; - parts[pmap[y][x]>>8].life = 100; - parts[pmap[y][x]>>8].ctype = 0; - parts[pmap[y][x]>>8].temp = ptypes[t].heat; - - } - else - { - parts[i].x = (float)x; - parts[i].y = (float)y; - parts[i].type = PT_STKM2; - parts[i].vx = 0; - parts[i].vy = 0; - parts[i].life = 100; - parts[i].ctype = 0; - parts[i].temp = ptypes[t].heat; - } - - - + if(pmap[y][x]&0xFF==PT_SPAWN2) + { + parts[pmap[y][x]>>8].type = PT_STKM2; + parts[pmap[y][x]>>8].vx = 0; + parts[pmap[y][x]>>8].vy = 0; + parts[pmap[y][x]>>8].life = 100; + parts[pmap[y][x]>>8].ctype = 0; + parts[pmap[y][x]>>8].temp = ptypes[t].heat; + + } + else + { + parts[i].x = (float)x; + parts[i].y = (float)y; + parts[i].type = PT_STKM2; + parts[i].vx = 0; + parts[i].vy = 0; + parts[i].life = 100; + parts[i].ctype = 0; + parts[i].temp = ptypes[t].heat; + } + + + player2[3] = x-1; //Setting legs positions player2[4] = y+6; player2[5] = x-1; player2[6] = y+6; - + player2[7] = x-3; player2[8] = y+12; player2[9] = x-3; player2[10] = y+12; - + player2[11] = x+1; player2[12] = y+6; player2[13] = x+1; player2[14] = y+6; - + player2[15] = x+3; player2[16] = y+12; player2[17] = x+3; player2[18] = y+12; - + 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; } @@ -2581,10 +2589,7 @@ void update_particles_i(pixel *vid, int start, int inc) if((r&0xFF)==PT_DYST && 15>(rand()%1000)) parts[r>>8].type = PT_YEST; if((r&0xFF)==PT_YEST) { - if(15>(rand()%100000)&&isplayer==0) - parts[r>>8].type = PT_STKM; - else - parts[r>>8].type = PT_DYST; + parts[r>>8].type = PT_DYST; } if((r&0xFF)==PT_WATR && 15>(rand()%100)) @@ -4083,6 +4088,11 @@ killed: 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 == 1 || (pv[y/CELL][x/CELL]>=4.5f && player[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { @@ -4473,6 +4483,11 @@ killed: 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 == 1 || (pv[y/CELL][x/CELL]>=4.5f && player2[2] != SPC_AIR) ) //If his HP is less that 0 or there is very big wind... { @@ -4484,7 +4499,7 @@ killed: create_part(-1, x+2, y+r, player2[2]); } kill_part(i); //Kill him - goto killed; + continue; } parts[i].vy += -0.7*dt; //Head up! From 4a046e77c2ad4b9e2c2ac27416bacff53a150687 Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 8 Jan 2011 19:01:43 +0000 Subject: [PATCH 07/10] Verson --- includes/defines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/defines.h b/includes/defines.h index 1f134a6ea..cd4893922 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -10,7 +10,7 @@ #define SAVE_VERSION 45 #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" From 0958a6e6da7ffd8c93779bfeb4552e18f593a090 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Sat, 8 Jan 2011 15:33:54 -0500 Subject: [PATCH 08/10] add ctype transfer to portal --- includes/powder.h | 1 + src/powder.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/includes/powder.h b/includes/powder.h index 2f68526e9..2d14f9c14 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -649,6 +649,7 @@ static int lolzrule[9][9] = }; int portal[MAX_TEMP/100][8][80]; float portaltemp[MAX_TEMP/100][8][80]; +int portalctype[MAX_TEMP/100][8][80]; int wireless[MAX_TEMP/100][2]; extern int isplayer; diff --git a/src/powder.c b/src/powder.c index 303ed5892..b999b3690 100644 --- a/src/powder.c +++ b/src/powder.c @@ -3321,6 +3321,7 @@ void update_particles_i(pixel *vid, int start, int inc) { 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) parts[r>>8].type = parts[r>>8].ctype; else @@ -3372,8 +3373,10 @@ void update_particles_i(pixel *vid, int start, int inc) { create_part(-1,x+nx,y+ny,portal[parts[i].tmp][randomness-1][nnx]); parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[parts[i].tmp][randomness-1][nnx]; + parts[pmap[y+ny][x+nx]>>8].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; } } From 764e3966bb1294fcb2d42812ad0f8d49747aebca Mon Sep 17 00:00:00 2001 From: Simon Date: Sat, 8 Jan 2011 21:03:43 +0000 Subject: [PATCH 09/10] Improvements to fancy display --- includes/defines.h | 2 +- src/graphics.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index cd4893922..9f12cb930 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -8,7 +8,7 @@ #endif #define SAVE_VERSION 45 -#define MINOR_VERSION 0 +#define MINOR_VERSION 1 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. //#define BETA diff --git a/src/graphics.c b/src/graphics.c index 4f65ef414..013046531 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) { From b3735bb84b5d53014e7e20085007ef380cc7a3c1 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 9 Jan 2011 12:20:15 +0000 Subject: [PATCH 10/10] Version change --- includes/defines.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/defines.h b/includes/defines.h index 9f12cb930..af414718a 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -8,7 +8,7 @@ #endif #define SAVE_VERSION 45 -#define MINOR_VERSION 1 +#define MINOR_VERSION 2 #define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter. //#define BETA