summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-29 22:22:18 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-29 22:22:18 (GMT)
commit8df470662fc687cedeac97fac2c4d8afe4ccedd0 (patch)
tree0d27ecea2b65430214c6e6e727437b2fb0907ac8 /src
parent5766f9aa7ee0f78adea5799322dce67506d9247d (diff)
downloadpowder-8df470662fc687cedeac97fac2c4d8afe4ccedd0.zip
powder-8df470662fc687cedeac97fac2c4d8afe4ccedd0.tar.gz
ARAY gets colored by FILT, woo
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c42
-rw-r--r--src/main.c2
-rw-r--r--src/powder.c17
3 files changed, 54 insertions, 7 deletions
diff --git a/src/graphics.c b/src/graphics.c
index a22cf58..adc0c18 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1915,12 +1915,50 @@ void draw_parts(pixel *vid)
else if(t==PT_BRAY && parts[i].tmp==0)
{
int trans = parts[i].life * 7;
- blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
+ 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);
}
else if(t==PT_BRAY && parts[i].tmp==1)
{
int trans = parts[i].life/4;
- blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
+ 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);
}
else if(t==PT_BRAY && parts[i].tmp==2)
{
diff --git a/src/main.c b/src/main.c
index 8a0cf0e..7acc85d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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"
"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"
- "'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"
"The spacebar can be used to pause physics.\n"
"'P' will take a screenshot and save it into the current directory.\n"
diff --git a/src/powder.c b/src/powder.c
index 8e7a4ea..84d129b 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1614,7 +1614,7 @@ void update_particles_i(pixel *vid, int start, int inc)
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r)
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++;
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];
if((r>>8)>=NPART || !r)
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;
}
@@ -1984,6 +1984,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
else if(t==PT_ARAY && parts[i].life==0){
+ int colored =0;
for(nx=-1; nx<2; nx++){
for(ny=-1; ny<2; 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){
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].life = 2;
+ }else
+ parts[nr].ctype = colored;
}
} else if(!destroy) {
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].life = 1020;
parts[r>>8].tmp = 1;
+ if(!parts[r>>8].ctype)
+ parts[r>>8].ctype = colored;
}
docontinue = 0;
} else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
parts[r>>8].life = 1020;
//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){
create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
}