From c07afe4c892711b58061e5c0a3180ea3865f9452 Mon Sep 17 00:00:00 2001 From: Catelite Date: Wed, 6 Jun 2012 09:41:56 -0400 Subject: [PATCH] Ton of changes to make EXOT work as expected. Added graphics to WARP to make it actually invisible besides BLOB mode, EXOT now makes rainbows and explodes with too many electrons o__o --- includes/powder.h | 1 + src/elementdata.c | 4 +-- src/elements/brel.c | 1 + src/elements/elec.c | 2 ++ src/elements/exot.c | 65 ++++++++++++++++++++++++++++++++++++++------- src/elements/warp.c | 18 ++++++++++++- src/powder.c | 3 ++- 7 files changed, 80 insertions(+), 14 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 1ba63d5e5..fc767dd60 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -352,6 +352,7 @@ int graphics_GEL(GRAPHICS_FUNC_ARGS); int graphics_TRON(GRAPHICS_FUNC_ARGS); int graphics_SOAP(GRAPHICS_FUNC_ARGS); int graphics_EXOT(GRAPHICS_FUNC_ARGS); +int graphics_WARP(GRAPHICS_FUNC_ARGS); int graphics_stickmen(GRAPHICS_FUNC_ARGS); void TRON_init_graphics(); diff --git a/src/elementdata.c b/src/elementdata.c index 0d6890068..68fa3e3c4 100644 --- a/src/elementdata.c +++ b/src/elementdata.c @@ -127,7 +127,7 @@ part_type ptypes[PT_NUM] = {"BCLN", PIXPACK(0xFFD040), 0.0f, 0.00f * CFDS, 0.97f, 0.50f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 12, 1, 1, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "Breakable Clone.", ST_NONE, TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL_DEC, &update_BCLN, NULL}, {"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, 1, 100, SC_CRACKER2, 373.0f, 40, "Love...", ST_GAS, TYPE_SOLID, &update_MISC, NULL}, {"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, 1, 31, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 251, "Deuterium oxide. Volume changes with temp, radioactive with neutrons.", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE, &update_DEUT, &graphics_DEUT}, - {"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, 1, SC_NUCLEAR, R_TEMP +273.15f, 100, "Displaces other elements.", ST_GAS, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_WARP, NULL}, + {"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, 1, SC_NUCLEAR, R_TEMP +273.15f, 100, "Displaces other elements.", ST_GAS, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_WARP, &graphics_WARP}, {"PUMP", PIXPACK(0x0A0A3B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 1, 100, SC_POWERED, 273.15f, 0, "Changes pressure to its temp when activated. (use HEAT/COOL).", ST_SOLID, TYPE_SOLID, &update_PUMP, &graphics_PUMP}, {"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, 1, 1, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 100, "First fireworks made, activated by heat/neutrons.", ST_SOLID, TYPE_PART|PROP_LIFE_DEC, &update_FWRK, NULL}, {"PIPE", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, 273.15f, 0, "Moves elements around, read FAQ on website for help.", ST_SOLID, TYPE_SOLID|PROP_LIFE_DEC, &update_PIPE, &graphics_PIPE}, @@ -176,7 +176,7 @@ part_type ptypes[PT_NUM] = {"GEL", PIXPACK(0xFF9900), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 1, 35, SC_LIQUID, R_TEMP-2.0f +273.15f, 29, "Gel. A liquid with variable viscosity and heat conductivity", ST_LIQUID, TYPE_LIQUID|PROP_LIFE_DEC|PROP_NEUTPENETRATE, &update_GEL, &graphics_GEL}, {"TRON", PIXPACK(0x000000), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 100, SC_SPECIAL, 0.0f, 40, "Smart particles, Travels in straight lines and avoids obstacles. Grows with time.", ST_NONE, TYPE_SOLID|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_TRON, &graphics_TRON}, {"TTAN", PIXPACK(0x909090), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Titanium, Higher melting temperature than other metals, blocks all air pressure", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW|PROP_LIFE_DEC, &update_TTAN, NULL}, - {"EXOT", PIXPACK(0x808080), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 1, 45, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 29, "Radioactive liquid", ST_LIQUID, TYPE_LIQUID|PROP_NEUTPENETRATE, &update_EXOT, &graphics_EXOT}, + {"EXOT", PIXPACK(0x404040), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.0003f * CFDS, 2, 0, 0, 0, 2, 1, 1, 46, SC_NUCLEAR, R_TEMP-2.0f +273.15f, 250, "Exotic matter. Explodes with excess exposure to electrons.", ST_LIQUID, TYPE_LIQUID, &update_EXOT, &graphics_EXOT}, /*FREE*/{"BRAN", PIXPACK(0xCCCC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_LIFE, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL, NULL}, /*FREE*/{"WIND", PIXPACK(0x101010), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 0, 0, 100, SC_SPECIAL, 0.0f, 40, "", ST_NONE, ST_NONE, NULL, NULL}, {"HYGN", PIXPACK(0x5070FF), 2.0f, 0.00f * CFDS, 0.99f, 0.30f, -0.10f, 0.00f, 3.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+0.0f +273.15f, 251, "Combines with O2 to make WATR", ST_GAS, TYPE_GAS, &update_H2, NULL}, diff --git a/src/elements/brel.c b/src/elements/brel.c index 06ea3633d..c97118bfd 100644 --- a/src/elements/brel.c +++ b/src/elements/brel.c @@ -20,6 +20,7 @@ int update_BREL(UPDATE_FUNC_ARGS) { if (1>rand()%200 && (pv[y/CELL][x/CELL] > 30.0f) && parts[i].temp>9000 && parts[i].life>0) { part_change_type(i, x ,y ,PT_EXOT); + parts[i].life = 1000; } if ((pv[y/CELL][x/CELL] > 10.0f) && (parts[i].life>0)) { parts[i].temp = parts[i].temp + (pv[y/CELL][x/CELL])/8; diff --git a/src/elements/elec.c b/src/elements/elec.c index 919ee87c9..12f9fac7c 100644 --- a/src/elements/elec.c +++ b/src/elements/elec.c @@ -94,6 +94,8 @@ int update_ELEC(UPDATE_FUNC_ARGS) { kill_part(i); return 1; } + if ((r&0xFF)==PT_EXOT) + parts[r>>8].tmp2 += 5; if (ptypes[r&0xFF].properties & PROP_CONDUCTS && ((r&0xFF)!=PT_NBLE||parts[i].temp<2273.15)) { create_part(-1, x+rx, y+ry, PT_SPRK); diff --git a/src/elements/exot.c b/src/elements/exot.c index 234ab9ee5..81f7c7db6 100644 --- a/src/elements/exot.c +++ b/src/elements/exot.c @@ -16,20 +16,67 @@ #include int update_EXOT(UPDATE_FUNC_ARGS) { - - + int r, rt, rx, ry, nb, rrx, rry; + for (rx=-2; rx<=2; rx++) + for (ry=-2; ry<=2; ry++) + if (x+rx>=0 && y+ry>=0 && x+rx>8].tmp2>2000) + if (1>rand()%100) + { + parts[i].tmp2 += 50; + } + } + } parts[i].tmp--; - if (parts[i].tmp<1) { + parts[i].tmp2--; + if (parts[i].tmp<1 || parts[i].tmp>250) parts[i].tmp = 250; + if (parts[i].tmp2<1) + parts[i].tmp2 = 1; + else if (parts[i].tmp2>2500) + { + parts[i].tmp2 = 2500; + part_change_type(i, x, y, PT_WARP); + parts[i].temp = 10000; } - + else + pv[y/CELL][x/CELL] += (parts[i].tmp2/2000) * CFDS; + if (pv[y/CELL][x/CELL]>200 && parts[i].temp>9000 && parts[i].tmp2>200) + { + part_change_type(i, x, y, PT_WARP); + parts[i].tmp2 = 2500; + } return 0; } int graphics_EXOT(GRAPHICS_FUNC_ARGS) { - *colr = cpart->tmp / 2 + 0x08; - *colg = cpart->tmp * 2 + 0x28; - *colb = cpart->tmp / 2 + 0x08; + int q = cpart->temp; + int b = cpart->tmp; + if ((cpart->tmp2 - 1)>rand()%1000) + { + float frequency = 0.90045; + *colr = (sin(frequency*q + 0) * 127 + 255); + *colg = (sin(frequency*q + 2) * 127 + 255); + *colb = (sin(frequency*q + 4) * 127 + 255); + *firea = 100; + *firer = 0; + *fireg = 0; + *fireb = 0; + *pixel_mode |= PMODE_FLAT; +// *pixel_mode |= FIRE_ADD; + *pixel_mode |= PMODE_FLARE; + } + else + { + float frequency = 0.00045; + *colr = (sin(frequency*q + 0) * 127 + (b/1.7)); + *colg = (sin(frequency*q + 2) * 127 + (b/1.7)); + *colb = (sin(frequency*q + 4) * 127 + (b/1.7)); *cola = cpart->tmp / 6; *firea = *cola; *firer = *colr; @@ -37,8 +84,6 @@ int graphics_EXOT(GRAPHICS_FUNC_ARGS) *fireb = *colb; *pixel_mode |= FIRE_ADD; *pixel_mode |= PMODE_BLUR; - - - + } return 0; } diff --git a/src/elements/warp.c b/src/elements/warp.c index 27352fd6f..0108bb972 100644 --- a/src/elements/warp.c +++ b/src/elements/warp.c @@ -17,6 +17,14 @@ int update_WARP(UPDATE_FUNC_ARGS) { int trade, r, rx, ry; + + if (parts[i].tmp2>2000) + { + parts[i].temp = 10000; + pv[y/CELL][x/CELL] += (parts[i].tmp2/2000) * CFDS; + if (2>rand()%1000) + create_part(-3, x, y, PT_ELEC); + } for ( trade = 0; trade<5; trade ++) { rx = rand()%3-1; @@ -26,12 +34,14 @@ int update_WARP(UPDATE_FUNC_ARGS) { r = pmap[y+ry][x+rx]; if (!r) continue; - if ((r&0xFF)!=PT_WARP&&(r&0xFF)!=PT_STKM&&(r&0xFF)!=PT_STKM2&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_BCLN&&(r&0xFF)!=PT_PCLN&&(10>=rand()%200)) + if ((r&0xFF)!=PT_WARP&&(r&0xFF)!=PT_STKM&&(r&0xFF)!=PT_STKM2&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_BCLN&&(r&0xFF)!=PT_PCLN) { parts[i].x = parts[r>>8].x; parts[i].y = parts[r>>8].y; parts[r>>8].x = x; parts[r>>8].y = y; + parts[r>>8].vx = (rand()%4)-1.5; + parts[r>>8].vy = (rand()%4)-2; parts[i].life += 4; pmap[y][x] = r; pmap[y+ry][x+rx] = (i<<8)|parts[i].type; @@ -41,3 +51,9 @@ int update_WARP(UPDATE_FUNC_ARGS) { } return 0; } +int graphics_WARP(GRAPHICS_FUNC_ARGS) +{ + *cola = 0; + *pixel_mode &= ~PMODE; + return 0; +} diff --git a/src/powder.c b/src/powder.c index f9545255c..ecd34181b 100644 --- a/src/powder.c +++ b/src/powder.c @@ -163,6 +163,7 @@ void init_can_move() can_move[PT_PHOT][t] = 2; } can_move[PT_ELEC][PT_LCRY] = 2; + can_move[PT_ELEC][PT_EXOT] = 2; can_move[PT_PHOT][PT_LCRY] = 3;//varies according to LCRY life can_move[PT_PHOT][PT_BIZR] = 2; @@ -1023,7 +1024,7 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a parts[i].vx = 2; break; case PT_EXOT: - parts[i].life = 250; + parts[i].life = 1000; break; case PT_STKM: if (player.spwn==0)