Merge branch 'master' of git://github.com/cracker64/The-Powder-Toy

This commit is contained in:
Simon 2010-12-29 22:24:29 +00:00
commit c913fd55d3
3 changed files with 54 additions and 7 deletions

View File

@ -1915,11 +1915,49 @@ void draw_parts(pixel *vid)
else if(t==PT_BRAY && parts[i].tmp==0) else if(t==PT_BRAY && parts[i].tmp==0)
{ {
int trans = parts[i].life * 7; int trans = parts[i].life * 7;
if(parts[i].ctype){
cg = 0;
cb = 0;
cr = 0;
for(x=0; x<12; x++) {
cr += (parts[i].ctype >> (x+18)) & 1;
cb += (parts[i].ctype >> x) & 1;
}
for(x=0; x<14; x++)
cg += (parts[i].ctype >> (x+9)) & 1;
x = 624/(cr+cg+cb+1);
cr *= x;
cg *= x;
cb *= x;
cr = cr>255?255:cr;
cg = cg>255?255:cg;
cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, trans);
}else
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
} }
else if(t==PT_BRAY && parts[i].tmp==1) else if(t==PT_BRAY && parts[i].tmp==1)
{ {
int trans = parts[i].life/4; int trans = parts[i].life/4;
if(parts[i].ctype){
cg = 0;
cb = 0;
cr = 0;
for(x=0; x<12; x++) {
cr += (parts[i].ctype >> (x+18)) & 1;
cb += (parts[i].ctype >> x) & 1;
}
for(x=0; x<14; x++)
cg += (parts[i].ctype >> (x+9)) & 1;
x = 624/(cr+cg+cb+1);
cr *= x;
cg *= x;
cb *= x;
cr = cr>255?255:cr;
cg = cg>255?255:cg;
cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, trans);
}else
blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
} }
else if(t==PT_BRAY && parts[i].tmp==2) else if(t==PT_BRAY && parts[i].tmp==2)

View File

@ -67,7 +67,7 @@ static const char *it_msg =
"\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n" "\n\boUse 'Z' for a zoom tool. Click to make the drawable zoom window stay around. Use the wheel to change the zoom strength\n"
"Use 'S' to save parts of the window as 'stamps'.\n" "Use 'S' to save parts of the window as 'stamps'.\n"
"'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n" "'L' will load the most recent stamp, 'K' shows a library of stamps you saved.\n"
"'C' will cycle the display mode (Fire, Blob, Velocity and Pressure). The numbers 1 to 7 will do the same\n" "'C' will cycle the display mode (Fire, Blob, Velocity, ect.). The numbers on the keyboard do the same\n"
"Use the mouse scroll wheel to change the tool size for particles.\n" "Use the mouse scroll wheel to change the tool size for particles.\n"
"The spacebar can be used to pause physics.\n" "The spacebar can be used to pause physics.\n"
"'P' will take a screenshot and save it into the current directory.\n" "'P' will take a screenshot and save it into the current directory.\n"

View File

@ -1614,7 +1614,7 @@ void update_particles_i(pixel *vid, int start, int inc)
r = pmap[y+ny][x+nx]; r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r) if((r>>8)>=NPART || !r)
continue; continue;
if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>8].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZRG&&parts[i].type==PT_FILT)) if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[r>>8].type==PT_BRAY&&parts[i].type==PT_FILT)&&!(parts[i].type==PT_BRAY&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>8].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZRG&&parts[i].type==PT_FILT))
{ {
h_count++; h_count++;
c_heat += parts[r>>8].temp; c_heat += parts[r>>8].temp;
@ -1632,7 +1632,7 @@ void update_particles_i(pixel *vid, int start, int inc)
r = pmap[y+ny][x+nx]; r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r) if((r>>8)>=NPART || !r)
continue; continue;
if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>8].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZRG&&parts[i].type==PT_FILT)) if(parts[r>>8].type!=PT_NONE&&parts[i].type!=PT_NONE&&ptypes[parts[r>>8].type].hconduct>0&&!(parts[r>>8].type==PT_HSWC&&parts[r>>8].life!=10)&&!(parts[r>>8].type==PT_BRAY&&parts[i].type==PT_FILT)&&!(parts[i].type==PT_BRAY&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_PHOT&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZR&&parts[r>>8].type==PT_FILT)&&!(parts[i].type==PT_BIZRG&&parts[r>>8].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZR&&parts[i].type==PT_FILT)&&!(parts[r>>8].type==PT_BIZRG&&parts[i].type==PT_FILT))
{ {
parts[r>>8].temp = parts[i].temp; parts[r>>8].temp = parts[i].temp;
} }
@ -1984,6 +1984,7 @@ void update_particles_i(pixel *vid, int start, int inc)
} }
} }
else if(t==PT_ARAY && parts[i].life==0){ else if(t==PT_ARAY && parts[i].life==0){
int colored =0;
for(nx=-1; nx<2; nx++){ for(nx=-1; nx<2; nx++){
for(ny=-1; ny<2; ny++){ for(ny=-1; ny<2; ny++){
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)){ if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny)){
@ -2000,9 +2001,12 @@ void update_particles_i(pixel *vid, int start, int inc)
if(!((r>>8)>=NPART)) { if(!((r>>8)>=NPART)) {
if(!r){ if(!r){
int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY); int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
if(nr!=-1&&destroy){ if(nr!=-1){
if(destroy){
parts[nr].tmp = 2; parts[nr].tmp = 2;
parts[nr].life = 2; parts[nr].life = 2;
}else
parts[nr].ctype = colored;
} }
} else if(!destroy) { } else if(!destroy) {
if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0){ if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0){
@ -2010,12 +2014,17 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].type = PT_BRAY; parts[r>>8].type = PT_BRAY;
parts[r>>8].life = 1020; parts[r>>8].life = 1020;
parts[r>>8].tmp = 1; parts[r>>8].tmp = 1;
if(!parts[r>>8].ctype)
parts[r>>8].ctype = colored;
} }
docontinue = 0; docontinue = 0;
} else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){ } 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; //docontinue = 1;
} else if(parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY) { }
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) {
if(nyy!=0 || nxx!=0){ if(nyy!=0 || nxx!=0){
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK); create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
} }