Merge branch 'upstream' into dev

This commit is contained in:
jacksonmj 2011-01-11 13:44:52 +00:00
commit 4006bdf4c2
12 changed files with 120 additions and 29 deletions

View File

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

View File

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

View File

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

43
src/elements/boyl.c Normal file
View File

@ -0,0 +1,43 @@
#include <powder.h>
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+CELL<YRES && 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<XRES)
{
pv[y/CELL][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL][x/CELL+1]);
if (y+CELL<YRES)
pv[y/CELL+1][x/CELL+1] += 0.001f*((parts[i].temp/100)-pv[y/CELL+1][x/CELL+1]);
}
if (y+CELL>0 && 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<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
if ((r>>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;
}

View File

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

View File

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

View File

@ -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;
}
}

View File

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

View File

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

View File

@ -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;
}

View File

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

View File

@ -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;
}
@ -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)