From 1eeda3f5cce7cd5f0867ae8945ae49479a43aeef Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Thu, 25 Nov 2010 01:01:28 -0500 Subject: [PATCH] ANAR, behaves opposite of dust. fix fuse loading, floodfilling of neut/photons. --- includes/powder.h | 11 +++++++---- src/graphics.c | 2 +- src/main.c | 6 ++++-- src/powder.c | 34 +++++++++++++++++++++++++--------- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 0cf3bca52..268dcf70e 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -141,7 +141,7 @@ #define PT_FOG 92 #define PT_BCLN 93 #define PT_LOVE 94 -#define PT_WTF 95 +#define PT_DEUT 95 #define PT_WARP 96 #define PT_PUMP 97 #define PT_FWRK 98 @@ -159,7 +159,8 @@ #define PT_PRTO 110 #define PT_PSTE 111 #define PT_PSTS 112 -#define PT_NUM 113 +#define PT_ANAR 113 +#define PT_NUM 114 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -345,7 +346,7 @@ static const part_type ptypes[PT_NUM] = {"FOG", PIXPACK(0xAAAAAA), 0.8f, 0.00f * CFDS, 0.4f, 0.70f, -0.1f, 0.0f, 0.99f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_GAS, 243.15f, 100, "Not quite Steam",TYPE_GAS}, {"BCLN", PIXPACK(0xFFD040), 0.1f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", TYPE_SOLID}, {"LOVE", PIXPACK(0xFF30FF), 0.0f, 0.00f * CFDS, 0.00f, 0.00f, 0.0f, 0.0f, 0.0f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 373.0f, 40, "Love...", TYPE_SOLID}, - {"WTF", PIXPACK(0x00153F), 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_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Volume changes with temp, radioactive with neutrons.", TYPE_LIQUID|PROP_NEUTPENETRATE}, + {"DEUT", PIXPACK(0x00153F), 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_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", TYPE_LIQUID|PROP_NEUTPENETRATE}, {"WARP", PIXPACK(0x000000), 0.8f, 0.00f * CFDS, 0.9f, 0.70f, -0.1f, 0.0f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 1, SC_GAS, R_TEMP +273.15f, 100, "This is what happens to your mind when catelite descibes an element.",TYPE_GAS}, {"PUMP", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.1f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, 273.15f, 0, "Changes pressure to its temp (use HEAT/COOL).", TYPE_SOLID}, {"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f+273.15f, 100, "First fireworks made, activated by heat/neutrons."}, @@ -363,7 +364,7 @@ static const part_type ptypes[PT_NUM] = {"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_CRACKER, R_TEMP+0.0f +273.15f, 40, "Portal OUT. Things come out here", TYPE_SOLID}, {"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_CRACKER, R_TEMP-2.0f +273.15f, 29, "Colloid", TYPE_LIQUID}, {"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, "blah blah solid not in the menu", TYPE_SOLID}, - + {"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", TYPE_PART}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description }; @@ -483,6 +484,8 @@ static part_state pstates[PT_NUM] = /* PRTO */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PSTE */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* PSTS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* ANAR */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + }; static int grule[NGOL][9] = { diff --git a/src/graphics.c b/src/graphics.c index 03ff5e94f..b63ea7bec 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1428,7 +1428,7 @@ void draw_parts(pixel *vid) blendpixel(vid, nx, ny, cr, cg, cb, 255); } - else if(t==PT_WTF) + else if(t==PT_DEUT) { if(parts[i].life>=700&&(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)) diff --git a/src/main.c b/src/main.c index 3020cbf1f..b12dc253f 100644 --- a/src/main.c +++ b/src/main.c @@ -559,8 +559,10 @@ int parse_save(void *save, int size, int replace, int x0, int y0) else if(i < nf) { parts[fp[i]].type = j; - if(j == PT_COAL) - parts[fp[i]].tmp = 50; + if(j == PT_COAL) + parts[fp[i]].tmp = 50; + if(j == PT_FUSE) + parts[fp[i]].tmp = 50; if(j == PT_PHOT) parts[fp[i]].ctype = 0x3fffffff; parts[fp[i]].x = (float)x; diff --git a/src/powder.c b/src/powder.c index 0582f8fec..59ef37ff1 100644 --- a/src/powder.c +++ b/src/powder.c @@ -545,7 +545,7 @@ inline int create_part(int p, int x, int y, int t) parts[i].vy = 3.0f*sinf(a); } - if(t!=PT_STKM && t!=PT_PHOT && t!=PT_NEUT) + if(t!=PT_STKM)// && t!=PT_PHOT && t!=PT_NEUT) is this needed? it breaks floodfill pmap[y][x] = t|(i<<8); else if(t==PT_STKM) { @@ -1041,7 +1041,7 @@ void update_particles_i(pixel *vid, int start, int inc) ly = parts[i].y; t = parts[i].type; - if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_CRAC && t!=PT_WTF) + if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_CRAC && t!=PT_DEUT) { if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC))) parts[i].life--; @@ -1093,8 +1093,16 @@ void update_particles_i(pixel *vid, int start, int inc) vx[y/CELL][x/CELL] *= ptypes[t].airloss; vy[y/CELL][x/CELL] *= ptypes[t].airloss; - vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; - vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + if(t==PT_ANAR) + { + vx[y/CELL][x/CELL] -= ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] -= ptypes[t].airdrag*parts[i].vy; + } + else + { + vx[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vx; + vy[y/CELL][x/CELL] += ptypes[t].airdrag*parts[i].vy; + } if(t==PT_GAS||t==PT_NBLE||t==PT_PUMP) { if(t==PT_PUMP) @@ -1166,8 +1174,16 @@ 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; + + } } if(ptypes[t].diffusion) @@ -2034,7 +2050,7 @@ void update_particles_i(pixel *vid, int start, int inc) pv[y/CELL][x/CELL] += 10.0f * CFDS; //Used to be 2, some people said nukes weren't powerful enough fe ++; } - if((r&0xFF)==PT_WTF && (rt+1)>(rand()%1000)) + if((r&0xFF)==PT_DEUT && (rt+1)>(rand()%1000)) { create_part(r>>8, x+nx, y+ny, PT_NEUT); @@ -2292,7 +2308,7 @@ void update_particles_i(pixel *vid, int start, int inc) } } } - else if(t==PT_WTF) + else if(t==PT_DEUT) { int maxlife = ((10000/(parts[i].temp + 1))-1); if((10000%((int)parts[i].temp+1))>rand()%((int)parts[i].temp+1)) @@ -2306,7 +2322,7 @@ void update_particles_i(pixel *vid, int start, int inc) r = pmap[y+ny][x+nx]; if((r>>8)>=NPART || !r || (parts[i].life >=maxlife)) continue; - if(parts[r>>8].type==PT_WTF&&33>=rand()/(RAND_MAX/100)+1) + if(parts[r>>8].type==PT_DEUT&&33>=rand()/(RAND_MAX/100)+1) { if((parts[i].life + parts[r>>8].life + 1) <= maxlife) { @@ -2327,9 +2343,9 @@ void update_particles_i(pixel *vid, int start, int inc) if((bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALLELEC||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_EWALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_DESTROYALL||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_WALL|| bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWAIR||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWSOLID||bmap[(y+ny)/CELL][(x+nx)/CELL]==WL_ALLOWGAS)) continue; - if((!r)&&parts[i].life>=1)//if nothing then create wtf + if((!r)&&parts[i].life>=1)//if nothing then create deut { - create_part(-1,x+nx,y+ny,PT_WTF); + create_part(-1,x+nx,y+ny,PT_DEUT); parts[i].life--; parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp; }