From 5a37f32ca12a48432af5be190245d2a377005e49 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Tue, 4 Jan 2011 13:26:28 -0500 Subject: [PATCH 1/3] update with simon, and shift-v now does every other frame properly --- includes/defines.h | 3 ++ includes/interface.h | 1 + includes/powder.h | 2 ++ src/main.c | 79 ++++++++++++++++++++++++++++++-------------- src/powder.c | 44 ++++++++++++++++++------ 5 files changed, 95 insertions(+), 34 deletions(-) diff --git a/includes/defines.h b/includes/defines.h index bf2e06234..b2bec4e5b 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -28,6 +28,9 @@ #define YRES 384 #define NPART XRES*YRES +#define XCNTR 306 +#define YCNTR 192 + #define MAX_DISTANCE sqrt(pow(XRES, 2)+pow(YRES, 2)) #define MAXSIGNS 16 diff --git a/includes/interface.h b/includes/interface.h index dcbd99704..159e2472f 100644 --- a/includes/interface.h +++ b/includes/interface.h @@ -125,6 +125,7 @@ extern int svf_publish; extern char svf_id[16]; extern char svf_name[64]; extern char svf_tags[256]; +extern char svf_description[255]; extern void *svf_last; extern int svf_lsize; diff --git a/includes/powder.h b/includes/powder.h index 37dce6d8f..0197cc831 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -652,6 +652,8 @@ extern float player[27]; extern float player2[27]; +extern int gravityMode; + extern particle *parts; extern particle *cb_parts; diff --git a/src/main.c b/src/main.c index 59fcea417..c5fc10071 100644 --- a/src/main.c +++ b/src/main.c @@ -477,6 +477,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0) if(replace) { + gravityMode = 1; memset(bmap, 0, sizeof(bmap)); memset(emap, 0, sizeof(emap)); memset(signs, 0, sizeof(signs)); @@ -1515,6 +1516,29 @@ int main(int argc, char *argv[]) else GRID_MODE = (GRID_MODE+1)%10; } + + if(sdl_key=='w') //Gravity, by Moach + { + ++gravityMode; // cycle gravity mode + itc = 51; + + switch (gravityMode) + { + default: + gravityMode = 0; + case 0: + strcpy(itc_msg, "Gravity: Off"); + break; + case 1: + strcpy(itc_msg, "Gravity: Vertical"); + break; + case 2: + strcpy(itc_msg, "Gravity: Radial"); + break; + + } + } + if(sdl_key=='t') VINE_MODE = !VINE_MODE; if(sdl_key==SDLK_SPACE) @@ -1590,32 +1614,33 @@ int main(int argc, char *argv[]) } } #ifdef INTERNAL - int counterthing; - if(sdl_key=='v') - { - if(sdl_mod & (KMOD_SHIFT)){ - if(vs>=1) - vs = 0; - else - vs = 2; + int counterthing; + if(sdl_key=='v'&&!(sdl_mod & (KMOD_LCTRL|KMOD_RCTRL))) + { + if(sdl_mod & (KMOD_SHIFT)){ + if(vs>=1) + vs = 0; + else + vs = 3;//every other frame + } + else + { + if(vs>=1) + vs = 0; + else + vs = 1; + } + counterthing = 0; } - else{ - if(vs>=1) - vs = 0; - else - vs = 1; - } - counterthing = 0; - } if(vs) - { - if(counterthing+1>=vs) - { - dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); - counterthing = 0; - } - counterthing = (counterthing+1)%3; - } + { + if(counterthing+1>=vs) + { + dump_frame(vid_buf, XRES, YRES, XRES+BARSIZE); + counterthing = 0; + } + counterthing = (counterthing+1)%3; + } #endif if(sdl_wheel) @@ -2033,6 +2058,8 @@ int main(int argc, char *argv[]) svf_id[0] = 0; svf_name[0] = 0; svf_tags[0] = 0; + svf_description[0] = 0; + gravityMode = 1; memset(fire_bg, 0, XRES*YRES*PIXELSIZE); memset(fire_r, 0, sizeof(fire_r)); @@ -2386,6 +2413,10 @@ int main(int argc, char *argv[]) strappend(uitext, " [CAP LOCKS]"); if(GRID_MODE) sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE); +#ifdef INTERNAL + if(vs) + strappend(uitext, " [FRAME CAPTURE]"); +#endif if(sdl_zoom_trig||zoom_en) { diff --git a/src/powder.c b/src/powder.c index 5409ee923..908b15eff 100644 --- a/src/powder.c +++ b/src/powder.c @@ -12,6 +12,8 @@ float player2[27]; particle *parts; particle *cb_parts; +int gravityMode = 1; // starts enabled in "vertical" mode... + unsigned char bmap[YRES/CELL][XRES/CELL]; unsigned char emap[YRES/CELL][XRES/CELL]; @@ -1073,6 +1075,8 @@ void update_particles_i(pixel *vid, int start, int inc) float c_heat = 0.0f; int h_count = 0; int starti = (start*-1); + float pGravX, pGravY, pGravD; + if(sys_pause&&!framerender) return; if(ISGRAV==1) @@ -1500,16 +1504,36 @@ void update_particles_i(pixel *vid, int start, int inc) } else { - if(t==PT_ANAR) - { - parts[i].vx -= ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy -= ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - } - else{ - parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL]; - parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + ptypes[t].gravity; - - } + //Gravity mode by Moach + switch (gravityMode) + { + default: + case 0: + pGravX = pGravY = 0.0f; + break; + case 1: + pGravX = 0.0f; + pGravY = ptypes[t].gravity; + break; + case 2: + + pGravD = 0.01f - hypotf((x - XCNTR), (y - YCNTR)); + + pGravX = ptypes[t].gravity * ((float)(x - XCNTR) / pGravD); + pGravY = ptypes[t].gravity * ((float)(y - YCNTR) / pGravD); + + } + + if(t==PT_ANAR) + { + parts[i].vx -= ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; + parts[i].vy -= ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; + } + else{ + parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL] + pGravX; + parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL] + pGravY; + + } } if(ptypes[t].diffusion) From fd2f0c905be873dc3892086850744f18c068e4be Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Tue, 4 Jan 2011 20:53:24 -0500 Subject: [PATCH 2/3] better liquid movement in radial gravity, '=' resets pressure, cannot draw stickman on clone anymore, 'w' does not work when stickman2 is out, use shift-w. --- includes/powder.h | 5 +- src/graphics.c | 355 +++++++++++++++++++++------------------------- src/main.c | 17 ++- src/powder.c | 4 +- 4 files changed, 181 insertions(+), 200 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 0197cc831..501c066bd 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -217,6 +217,7 @@ #define PROP_DEADLY 0x0400 //1024 Is deadly for stickman. #define PROP_HOT_GLOW 0x0800 //2048 Hot Metal Glow #define PROP_LIFE 0x1000 //4096 Is a GoL type +#define PROP_RADIOACTIVE 0x2000 //8192 Radioactive #define FLAG_STAGNANT 1 struct particle @@ -302,7 +303,7 @@ static const part_type ptypes[PT_NUM] = {"SNOW", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, R_TEMP-30.0f+273.15f, 46, "Light particles.", TYPE_PART, NULL}, {"WOOD", PIXPACK(0xC0A040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Solid. Flammable.", TYPE_SOLID, NULL}, {"NEUT", PIXPACK(0x20E0FF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Neutrons. Interact with matter in odd ways.", TYPE_ENERGY, NULL}, - {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", TYPE_PART|PROP_NEUTPENETRATE, NULL}, + {"PLUT", PIXPACK(0x407020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 251, "Heavy particles. Fissile. Generates neutrons under pressure.", TYPE_PART|PROP_NEUTPENETRATE|PROP_RADIOACTIVE, NULL}, {"PLNT", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Plant, drinks water and grows.", TYPE_SOLID, NULL}, {"ACID", PIXPACK(0xED55FF), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 40, 0, 0, 1, 1, 10, SC_LIQUID, R_TEMP+0.0f +273.15f, 34, "Dissolves almost everything.", TYPE_LIQUID, NULL}, {"VOID", PIXPACK(0x790B0B), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0003f* CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Hole, will drain away any particles.", TYPE_SOLID, NULL}, @@ -315,7 +316,7 @@ static const part_type ptypes[PT_NUM] = {"BMTL", PIXPACK(0x505070), 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_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Breakable metal.", TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, NULL}, {"BRMT", PIXPACK(0x705060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Broken metal.", TYPE_PART|PROP_CONDUCTS|PROP_HOT_GLOW, NULL}, {"PHOT", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, -1, SC_ELEC, R_TEMP+900.0f+273.15f, 251, "Photons. Travel in straight lines.", TYPE_ENERGY, NULL}, - {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure.", TYPE_PART, NULL}, + {"URAN", PIXPACK(0x707020), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 90, SC_NUCLEAR, R_TEMP+30.0f+273.15f, 251, "Heavy particles. Generates heat under pressure.", TYPE_PART | PROP_RADIOACTIVE, NULL}, {"WAX", PIXPACK(0xF0F0BB), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 44, "Wax. Melts at moderately high temperatures.", TYPE_SOLID, NULL}, {"MWAX", PIXPACK(0xE0E0AA), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000001f* CFDS,2, 5, 0, 0, 2, 1, 25, SC_LIQUID, R_TEMP+28.0f+273.15f, 44, "Liquid Wax.", TYPE_LIQUID, NULL}, {"PSCN", PIXPACK(0x805050), 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, "P-Type Silicon, Will transfer current to any conductor.", TYPE_SOLID, NULL}, diff --git a/src/graphics.c b/src/graphics.c index 6e503c7d1..e4a4a4cc4 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1478,6 +1478,163 @@ void draw_parts(pixel *vid) cb = 0; blendpixel(vid, nx, ny, cr, cg, cb, 255); } + else if(cmode==CM_FANCY) + { + if(ptypes[parts[i].type].properties&TYPE_LIQUID) + { + if(parts[i].type==PT_DEUT) + { + cr = PIXR(ptypes[t].pcolors) + parts[i].life*1; + cg = PIXG(ptypes[t].pcolors) + parts[i].life*2; + cb = PIXB(ptypes[t].pcolors) + parts[i].life*4; + if(cr>=255) + cr = 255; + if(cg>=255) + cg = 255; + if(cb>=255) + cb = 255; + blendpixel(vid, nx, ny, cr, cg, cb, 255); + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,50); + } + } + } + else if(parts[i].type==PT_LAVA && parts[i].life) + { + cr = parts[i].life * 2 + 0xE0; + cg = parts[i].life * 1 + 0x50; + cb = parts[i].life/2 + 0x10; + if(cr>255) cr = 255; + if(cg>192) cg = 192; + if(cb>128) cb = 128; + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,50); + } + } + } + else if(parts[i].type==PT_GLOW) + { + fg = 0; + fb = 0; + fr = 0; + if(pv[ny/CELL][nx/CELL]>0) { + fg = 6 * pv[ny/CELL][nx/CELL]; + fb = 4 * pv[ny/CELL][nx/CELL]; + fr = 2 * pv[ny/CELL][nx/CELL]; + } + vid[ny*(XRES+BARSIZE)+nx] = PIXRGB((int)restrict_flt(0x44 + fr*8, 0, 255), (int)restrict_flt(0x88 + fg*8, 0, 255), (int)restrict_flt(0x44 + fb*8, 0, 255)); + + /*x = nx/CELL; + y = ny/CELL; + fg += fire_g[y][x]; + if(fg > 255) fg = 255; + fire_g[y][x] = fg; + fb += fire_b[y][x]; + if(fb > 255) fb = 255; + fire_b[y][x] = fb; + fr += fire_r[y][x]; + if(fr > 255) fr = 255; + fire_r[y][x] = fr;*/ + + cr = (int)restrict_flt(0x44 + fr*8, 0, 255); + cg = (int)restrict_flt(0x88 + fg*8, 0, 255); + cb = (int)restrict_flt(0x44 + fb*8, 0, 255); + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,50); + } + } + } + else + { + cr = PIXR(ptypes[t].pcolors); + cg = PIXG(ptypes[t].pcolors); + cb = PIXB(ptypes[t].pcolors); + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); + else if (abs(y) != 0 || abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,50); + } + } + } + } + else if (ptypes[parts[i].type].properties&TYPE_GAS) + { + //if(parts[i].type!=PT_FIRE&&parts[i].type!=PT_SMKE&&parts[i].type!=PT_PLSM&&parts[i].type!=PT_WTRV) + { + cr = PIXR(ptypes[t].pcolors); + cg = PIXG(ptypes[t].pcolors); + cb = PIXB(ptypes[t].pcolors); + for(x=-1; x<=1; x++) + { + for(y=-1; y<=1; y++) + { + if ((abs(x) == 0) && (abs(y) == 0)) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,180); + else if (abs(y) != 0 && abs(x) != 0) + blendpixel(vid,x+nx,y+ny,cr,cg,cb,50); + else + blendpixel(vid,x+nx,y+ny,cr,cg,cb,80); + } + } + } + } + else if(ptypes[parts[i].type].properties&PROP_RADIOACTIVE) + { + int tempx = 0; + int tempy = 0; + cr = PIXR(ptypes[t].pcolors); + cg = PIXG(ptypes[t].pcolors); + cb = PIXB(ptypes[t].pcolors); + //blendpixel(vid, nx, ny, cr, cg, cb, 192); + //blendpixel(vid, nx+1, ny, cr, cg, cb, 96); + //blendpixel(vid, nx-1, ny, cr, cg, cb, 96); + //blendpixel(vid, nx, ny+1, cr, cg, cb, 96); + //blendpixel(vid, nx, ny-1, cr, cg, cb, 96); + addpixel(vid, nx, ny, cr, cg, cb, 192); + addpixel(vid, nx+1, ny, cr, cg, cb, 96); + addpixel(vid, nx-1, ny, cr, cg, cb, 96); + addpixel(vid, nx, ny+1, cr, cg, cb, 96); + addpixel(vid, nx, ny-1, cr, cg, cb, 96); + for(tempx = 2; tempx < 7; tempx++) { + for(tempy = 2; tempy < 7; tempy++) { + addpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + addpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + addpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + addpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + //blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); + //blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); + //blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); + //blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); + } + } + } + else + { + vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors; + } + } else if(cmode==CM_LIFE) { float frequency = 0.4; @@ -1503,22 +1660,6 @@ void draw_parts(pixel *vid) cb = 0; blendpixel(vid, nx, ny, cr, cg, cb, 255); } - else if(t==PT_MWAX&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,224,224,170,255); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,224,224,170,20); - else - blendpixel(vid,x+nx,y+ny,224,224,170,40); - } - } - - } else if(t==PT_QRTZ || t==PT_PQRT) { int z = parts[i].tmp; @@ -1788,7 +1929,9 @@ void draw_parts(pixel *vid) } else if(t==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f)) + { blendpixel(vid, nx, ny, 15, 0, 150, 100); + } else if(t==PT_ACID) { if(parts[i].life>255) parts[i].life = 255; @@ -1798,20 +1941,7 @@ void draw_parts(pixel *vid) cr = PIXR(ptypes[t].pcolors)/s; cg = PIXG(ptypes[t].pcolors)/s; cb = PIXB(ptypes[t].pcolors)/s; - if(cmode==CM_FANCY) { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,cr,cg,cb,40); - } - } - } else { - blendpixel(vid, nx, ny, cr, cg, cb, 255); - } + blendpixel(vid, nx, ny, cr, cg, cb, 255); if(cmode==CM_BLOB) { @@ -1826,19 +1956,6 @@ void draw_parts(pixel *vid) blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112); } } - else if(t==PT_OIL&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,64,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,64,16,40); - } - } - } else if(t==PT_NEUT) { if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) @@ -1870,58 +1987,6 @@ void draw_parts(pixel *vid) blendpixel(vid, nx+1, ny+1, cr, cg, cb, 32); blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32); } - } else if(t==PT_PLUT&&cmode == CM_FANCY) - { - int tempx; - int tempy; - cr = 0x40; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_URAN&&cmode == CM_FANCY) - { - int tempx; - int tempy; - cr = 0x70; - cg = 0x70; - cb = 0x20; - blendpixel(vid, nx, ny, cr, cg, cb, 192); - blendpixel(vid, nx+1, ny, cr, cg, cb, 96); - blendpixel(vid, nx-1, ny, cr, cg, cb, 96); - blendpixel(vid, nx, ny+1, cr, cg, cb, 96); - blendpixel(vid, nx, ny-1, cr, cg, cb, 96); - for(tempx = 2; tempx < 10; tempx++) { - for(tempy = 2; tempy < 10; tempy++) { - blendpixel(vid, nx+tempx, ny-tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx+tempx, ny+tempy, cr, cg, cb, 5); - blendpixel(vid, nx-tempx, ny-tempy, cr, cg, cb, 5); - } - } - } else if(t==PT_SLTW&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,64,80,240,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,64,80,240,50); - } - } } else if(t==PT_FILT) { @@ -2069,19 +2134,6 @@ void draw_parts(pixel *vid) y = ny; blendpixel(vid,x,y,17,217,24,255); } - else if(t==PT_LNTG&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,128,160,223,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,128,160,223,50); - } - } - } else if(t==PT_SMKE) { if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) @@ -2117,93 +2169,6 @@ void draw_parts(pixel *vid) } } } - else if(t==PT_WATR&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - - } else if(t==PT_DSTW&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,48,208,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,48,208,50); - } - } - } - else if(t==PT_NITR&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,32,224,16,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,32,224,16,50); - } - } - - } - else if(t==PT_LRBD&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,170,170,170,100); - else if (abs(y) != 0 || abs(x) != 0) - blendpixel(vid,x+nx,y+ny,170,170,170,50); - } - } - - } - - else if(t==PT_NBLE&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,235,73,23,100); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,235,73,23,30); - else - blendpixel(vid,x+nx,y+ny,235,73,23,50); - } - } - - } - else if(t==PT_GAS&&cmode == CM_FANCY) - { - for(x=-1; x<=1; x++) - { - for(y=-1; y<=1; y++) - { - if ((abs(x) == 0) && (abs(y) == 0)) - blendpixel(vid,x+nx,y+ny,255,255,0,180); - else if (abs(y) != 0 && abs(x) != 0) - blendpixel(vid,x+nx,y+ny,255,255,0,50); - else - blendpixel(vid,x+nx,y+ny,255,255,0,80); - } - } - - } else if(t==PT_WTRV) { if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) diff --git a/src/main.c b/src/main.c index c5fc10071..f89eae1ab 100644 --- a/src/main.c +++ b/src/main.c @@ -1516,8 +1516,19 @@ int main(int argc, char *argv[]) else GRID_MODE = (GRID_MODE+1)%10; } + if(sdl_key=='=') + { + int nx, ny; + for(nx = 0;nx>8].ctype = t; } @@ -5046,7 +5046,7 @@ killed: parts[i].vx *= ptypes[t].collision; parts[i].vy *= ptypes[t].collision; } - else if(ptypes[t].falldown>1 && parts[i].vy>fabs(parts[i].vx)) + else if(ptypes[t].falldown>1 && (parts[i].vy>fabs(parts[i].vx) || gravityMode==2)) { s = 0; if(!rt || nt) //nt is if there is an something else besides the current particle type, around the particle From cf2489916c6055327f9def21ee70088f4023a384 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Wed, 5 Jan 2011 14:12:31 -0500 Subject: [PATCH 3/3] some ARAY changes so that more complex things can be made, http://powdertoy.co.uk/Browse/View.html?ID=103300 --- src/powder.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/powder.c b/src/powder.c index f26db353c..b21e113ae 100644 --- a/src/powder.c +++ b/src/powder.c @@ -2128,7 +2128,7 @@ 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) { + }else if(parts[r>>8].type!=PT_INWR && parts[r>>8].type!=PT_ARAY && parts[r>>8].type!=PT_WIFI) { if(nyy!=0 || nxx!=0){ create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK); } @@ -2138,6 +2138,8 @@ void update_particles_i(pixel *vid, int start, int inc) 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) { + docontinue = 1; } else { docontinue = 0; } @@ -3371,6 +3373,12 @@ void update_particles_i(pixel *vid, int start, int inc) parts[r>>8].type = PT_SPRK; parts[r>>8].ctype = PT_PSCN; parts[r>>8].life = 4; + } + else if(parts[r>>8].type==PT_INWR&&parts[r>>8].life==0 && wireless[parts[i].tmp][0]) + { + parts[r>>8].type = PT_SPRK; + parts[r>>8].ctype = PT_INWR; + parts[r>>8].life = 4; } else if(parts[r>>8].type==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3 && !wireless[parts[i].tmp][0]) {