SHLD, element that grows from spark and will regrow if damaged. Lots of other small changes and fixes. replace mode ONLY draws on the element to be replaced.

This commit is contained in:
Cracker64 2010-12-01 15:27:13 -05:00
parent 491016eaf4
commit 656b5ff496
5 changed files with 228 additions and 41 deletions

View File

@ -132,6 +132,7 @@ int SEC2;
int REPLACE_MODE;
int CURRENT_BRUSH;
int GRID_MODE;
int VINE_MODE;
extern sign signs[MAXSIGNS];
extern stamp stamps[STAMP_MAX];
extern int stamp_count;

View File

@ -165,7 +165,11 @@
#define PT_EQUALVEL 116//all particles equal their velocities
#define PT_INST2 117
#define PT_INST3 118
#define PT_NUM 119
#define PT_SHLD1 119
#define PT_SHLD2 120
#define PT_SHLD3 121
#define PT_SHLD4 122
#define PT_NUM 123
#define R_TEMP 22
#define MAX_TEMP 9999
@ -346,35 +350,39 @@ static const part_type ptypes[PT_NUM] =
{"34 ", PIXPACK(0x500050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "34! (34/34)", TYPE_SOLID},
{"LLIF", PIXPACK(0x505050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Long Life! (5/345)", TYPE_SOLID},
{"STAN", PIXPACK(0x5000FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_LIFE, 9000.0f, 40, "Stains! (235678/3678)", TYPE_SOLID},
{"CRAC", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "cracker64 - Spongey, Made by himself",TYPE_SOLID},
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_SOLIDS, 243.15f, 100, "Not quite Ice",TYPE_SOLID},
{"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},
{"CRAC", PIXPACK(0xFFBE30), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 1, 30, 1, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 251, "A sponge, absorbs water.",TYPE_SOLID},
{"RIME", PIXPACK(0xCCCCCC), 0.00f, 0.00f * CFDS, 0.00f, 1.00f, 0.00f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 30, 1, 100, SC_CRACKER, 243.15f, 100, "Not quite Ice",TYPE_SOLID},
{"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_CRACKER, 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},
{"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(0x10103B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_SPECIAL, 273.15f, 0, "Changes pressure to its temp (use HEAT/COOL).", TYPE_SOLID},
{"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_CRACKER, R_TEMP +273.15f, 100, "This is what happens to your mind when catelite descibes an element.",TYPE_GAS},
{"PUMP", PIXPACK(0x10103B), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 10, 1, 100, SC_ELEC, 273.15f, 0, "Changes pressure to its temp when activated. (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."},
{"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, 100, SC_SPECIAL, 273.15f, 0, "Moves elements around, read the post on how to use.", TYPE_SOLID},
{"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, 100, SC_CRACKER, 273.15f, 0, "Moves elements around, read the post on how to use.", TYPE_SOLID},
{"FRZZ", 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_CRACKER, 90.0f, 46, "FREEZE", TYPE_PART},
{"FRZW", PIXPACK(0x1020C0), 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_CRACKER, 90.0f, 29, "FREEZE WATER", TYPE_LIQUID},
{"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", TYPE_PART},
{"FRZW", PIXPACK(0x1020C0), 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_CRACKER, 120.0f, 29, "FREEZE WATER", TYPE_LIQUID},
{"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_CRACKER, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", TYPE_PART},
{"@_@", PIXPACK(0x00FF77), 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_CRACKER, R_TEMP+0.0f +273.15f, 29, "@_@, contradicts the normal state changes.", TYPE_LIQUID},
{"@_@G", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_CRACKER, R_TEMP-200.0f +273.15f, 42, "@_@ gas", TYPE_GAS},
{"@_@S", PIXPACK(0x00E455), 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_CRACKER, R_TEMP+300.0f +273.15f, 251, "@_@ solid", TYPE_SOLID},
{"INST", PIXPACK(0x404039), 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_CRACKER, R_TEMP+0.0f +273.15f, 251, "Instantly conducts, like walls, is now also a battery.", TYPE_SOLID|PROP_CONDUCTS},
{"@_@G", PIXPACK(0x00FFBB), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 2.75f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 1, SC_CRACKER, R_TEMP-200.0f +273.15f, 42, "@_@ gas", TYPE_GAS},
{"@_@S", PIXPACK(0x00E455), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_CRACKER, R_TEMP+300.0f +273.15f, 251, "@_@ solid", TYPE_SOLID},
{"INST", PIXPACK(0x404039), 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, "Instantly conducts, like walls, is now also a battery, PSCN to charge, NSCN to take.", TYPE_SOLID|PROP_CONDUCTS},
{"ISOZ", PIXPACK(0xAA30D0), 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, 29, "Radioactive liquid", TYPE_LIQUID|PROP_NEUTPENETRATE},
{"ISZS", PIXPACK(0x662089), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0007f* CFDS, 0, 0, 0, 1, 1, 1, 100, SC_NUCLEAR, 140.00f, 251, "Solid form of ISOZ, slowly decays.", TYPE_SOLID},
{"PRTI", PIXPACK(0xEB5917), 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 IN. Things go in here", TYPE_SOLID},
{"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 opposite", TYPE_PART},
{"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, "Solid form of PSTE, temporary", 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_CRACKER, R_TEMP+0.0f +273.15f, 70, "Very light dust. Behaves opposite", TYPE_PART},
{"VINE", PIXPACK(0x079A00), 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_CRACKER, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID},
{"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID},
{"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 0, 85, SC_CRACKER, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART},
{"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0},
{"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0},
{"SHLD", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 251, "Shield, spark it to grow", 0},
{"SHD2", PIXPACK(0x777777), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 251, "Shield lvl 2", 0},
{"SHD3", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 251, "Shield lvl 3", 0},
{"SHD4", PIXPACK(0x212121), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 251, "Shield lvl 4", 0},
//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
};
@ -501,7 +509,10 @@ static part_state pstates[PT_NUM] =
/* EQVE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* INST3*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD1*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD3*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* SHLD4*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
};
static int grule[NGOL][9] =
{
@ -532,7 +543,7 @@ static int loverule[9][9] =
{0,1,0,0,1,1,0,0,0},
{0,0,1,1,0,0,0,0,0},
};
int portal[8][20];
int portal[8][8];
extern int isplayer;
extern float player[27];

View File

@ -1402,7 +1402,7 @@ void draw_parts(pixel *vid)
isplayer = 1; //It's a secret. Tssss...
}
if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY)//nothing display but show needed color changes
if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP)//nothing display but show needed color changes
{
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);

View File

@ -1395,6 +1395,8 @@ int main(int argc, char *argv[])
REPLACE_MODE = !REPLACE_MODE;
if(sdl_key=='g')
GRID_MODE = (GRID_MODE+1)%10;
if(sdl_key=='t')
VINE_MODE = !VINE_MODE;
if(sdl_key==SDLK_SPACE)
sys_pause = !sys_pause;
if(sdl_key=='h')
@ -1956,7 +1958,7 @@ int main(int argc, char *argv[])
{
if(sdl_mod & (KMOD_CAPS))
c = 0;
if(c!=125&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM)
if(c!=WL_STREAM&&c!=SPC_AIR&&c!=SPC_HEAT&&c!=SPC_COOL&&c!=SPC_VACUUM&&!REPLACE_MODE)
flood_parts(x, y, c, -1, -1);
lx = x;
ly = y;

View File

@ -1066,7 +1066,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP)) && !(parts[i].life%4==0 && parts[i].type==PT_INST))
parts[i].life--;
if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW)&&t!=PT_INST)
if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW)&&t!=PT_INST && t!=PT_SHLD1&& t!=PT_SHLD2&& t!=PT_SHLD3&& t!=PT_SHLD4)
{
kill_part(i);
continue;
@ -1186,7 +1186,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].vx *= ptypes[t].loss;
parts[i].vy *= ptypes[t].loss;
if((t==PT_GOO||t==PT_BCLN) && !parts[i].life)
if((t==PT_GOO) && !parts[i].life)
{
if(pv[y/CELL][x/CELL]>1.0f)
{
@ -1195,6 +1195,15 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].life = rand()%80+300;
}
}
if((t==PT_BCLN) && !parts[i].life)
{
if(pv[y/CELL][x/CELL]>4.0f)
{
parts[i].vx += ptypes[t].advection*vx[y/CELL][x/CELL];
parts[i].vy += ptypes[t].advection*vy[y/CELL][x/CELL];
parts[i].life = rand()%40+80;
}
}
else
{
if(t==PT_ANAR)
@ -1300,6 +1309,14 @@ void update_particles_i(pixel *vid, int start, int inc)
t = parts[i].type = PT_PSTS;
if(t==PT_PSTS && pv[y/CELL][x/CELL]<0.5f)
t = parts[i].type = PT_PSTE;
if(t==PT_SHLD1 && pv[y/CELL][x/CELL]>7.0f)
t = parts[i].type = PT_NONE;
if(t==PT_SHLD2 && pv[y/CELL][x/CELL]>15.0f)
t = parts[i].type = PT_NONE;
if(t==PT_SHLD3 && pv[y/CELL][x/CELL]>25.0f)
t = parts[i].type = PT_NONE;
if(t==PT_SHLD4 && pv[y/CELL][x/CELL]>40.0f)
t = parts[i].type = PT_NONE;
//if(t==PT_GLAS && pv[y/CELL][x/CELL]>4.0f)
// t = parts[i].type = PT_BGLA;
if(t==PT_GLAS)
@ -1845,7 +1862,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].type = PT_NONE;
parts[i].life = rand()%60 + 60;
}
else if((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2)
else if((r&0xFF)==PT_WOOD && (1>rand()%20) && abs(nx+ny)<=2 && VINE_MODE)
{
create_part(-1,(x+nx)+(rand()%3)-1,(y+ny)+(rand()%3)-1,PT_VINE);
}
@ -2257,7 +2274,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==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0&&!((r>>8)>=NPART || !r))//diffusion
if(parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{
int temp = parts[i].life - parts[r>>8].life;
if(temp ==1)
@ -2405,7 +2422,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==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0&&!((r>>8)>=NPART || !r))//diffusion
if(parts[r>>8].type==t&&(parts[i].life>parts[r>>8].life)&&parts[i].life>0)//diffusion
{
int temp = parts[i].life - parts[r>>8].life;
if(temp ==1)
@ -2440,6 +2457,8 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].life = parts[r>>8].life;
parts[i].tmp = parts[r>>8].tmp;
parts[i].temp = parts[r>>8].temp;
parts[i].vx = parts[r>>8].vx;
parts[i].vy = parts[r>>8].vy;
parts[r>>8].type = PT_WARP;
parts[r>>8].life = rand()%90+1;
trade = 5;
@ -2582,12 +2601,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if((r>>8)>=NPART)
continue;
if(!r&&!parts[i].life)
{
parts[i].life=50;
continue;
}
if(!r)
continue;
}
if(parts[i].life==2)
{
@ -2712,23 +2726,21 @@ void update_particles_i(pixel *vid, int start, int inc)
continue;
else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life%4==0)
{
flood_parts(x,y,PT_INST2,PT_INST,-1);
flood_parts(x,y,PT_INST2,PT_INST,-1);//add life
parts[r>>8].type==parts[r>>8].ctype;
}
else if(parts[r>>8].type==PT_NSCN&&parts[r>>8].life==0&&(parts[i].life>=4)&&parts[i].life%4<=1)
{
create_part(-1,x+nx,y+ny,PT_SPRK);
flood_parts(x,y,PT_INST3,PT_INST,-1);
flood_parts(x,y,PT_INST3,PT_INST,-1);//sub life
}
else if(parts[r>>8].type==PT_SWCH&&parts[r>>8].life==10&&(parts[i].life>=4)&&parts[i].life%4<=1)
{
parts[r>>8].type=PT_SPRK;
parts[r>>8].ctype=PT_SWCH;
parts[r>>8].life=4;
flood_parts(x,y,PT_INST3,PT_INST,-1);
flood_parts(x,y,PT_INST3,PT_INST,-1);//sub life
}
//else if(parts[r>>8].type==PT_INST&&parts[r>>8].life%4==0&&parts[r>>8].life>parts[i].life)
//parts[i].life --;
}
}
else if(t==PT_INST2)
@ -2744,8 +2756,8 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(t==PT_PRTI)
{
int count =0;
for(nx=-1; nx<2; nx++)
for(ny=-1; ny<2; ny++)
for(nx=-1; nx<2; nx++)
if(x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
{
@ -2766,8 +2778,8 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(t==PT_PRTO)
{
int count = 0;
for(nx=1; nx>-2; nx--)
for(ny=1; ny>-2; ny--)
for(nx=1; nx>-2; nx--)
if(x+nx>=0 && y+ny>0 &&
x+nx<XRES && y+ny<YRES && (nx || ny))
{
@ -2899,6 +2911,157 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
else if(t==PT_SHLD1)
{
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))
{
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r)
continue;
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for(int nnx=-1;nnx<2;nnx++)
for(int nny=-1;nny<2;nny++)
{
if(parts[i].life==0)
{
t = parts[i].type = PT_SHLD2;
parts[i].life = 7;
}
else if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
else if(parts[r>>8].type==PT_SHLD3&&4>rand()%10)
{
t = parts[i].type=PT_SHLD2;
parts[i].life = 7;
}
}
}
else if(t==PT_SHLD2)
{
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))
{
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART)
continue;
if(!r && parts[i].life>0)
create_part(-1,x+nx,y+ny,PT_SHLD1);
if(!r)
continue;
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for(int nnx=-1;nnx<2;nnx++)
for(int nny=-1;nny<2;nny++)
{
if(3>rand()%200&&parts[i].life==0)
{
t = parts[i].type = PT_SHLD3;
parts[i].life = 7;
}
else if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
else if(parts[r>>8].type==PT_SHLD4&&4>rand()%10)
{
t = parts[i].type=PT_SHLD3;
parts[i].life = 7;
}
}
}
else if(t==PT_SHLD3)
{
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))
{
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART)
continue;
if(!r)
{
if(1>rand()%2500)
{
create_part(-1,x+nx,y+ny,PT_SHLD1);
parts[pmap[y+ny][x+nx]>>8].life=7;
t = parts[i].type = PT_SHLD2;
}
else
continue;
}
if(parts[r>>8].type==PT_SHLD1 && parts[i].life>3)
{
parts[r>>8].type = PT_SHLD2;
parts[r>>8].life=7;
}
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for(int nnx=-1;nnx<2;nnx++)
for(int nny=-1;nny<2;nny++)
{
if(2>rand()%3000&&parts[i].life==0)
{
t = parts[i].type = PT_SHLD4;
parts[i].life = 7;
}
else if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
}
}
else if(t==PT_SHLD4)
{
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))
{
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART)
continue;
if(!r)
{
if(1>rand()%5500)
{
create_part(-1,x+nx,y+ny,PT_SHLD1);
parts[pmap[y+ny][x+nx]>>8].life=7;
t = parts[i].type = PT_SHLD2;
}
else
continue;
}
if(parts[r>>8].type==PT_SHLD2 && parts[i].life>3)
{
parts[r>>8].type = PT_SHLD3;
parts[r>>8].life = 7;
}
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
for(int nnx=-1;nnx<2;nnx++)
for(int nny=-1;nny<2;nny++)
{
if(!pmap[y+ny+nny][x+nx+nnx])
{
create_part(-1,x+nx+nnx,y+ny+nny,PT_SHLD1);
parts[pmap[y+ny+nny][x+nx+nnx]>>8].life=7;
}
}
}
}
else if(t==PT_AMTR)
{
for(nx=-1; nx<2; nx++)
@ -4604,12 +4767,14 @@ int flood_parts(int x, int y, int c, int cm, int bm)
while(x1>=CELL)
{
if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm)
if(cm!=PT_INST&&((pmap[y][x1-1]&0xFF)!=PT_INST2&&(pmap[y][x1-1]&0xFF)!=PT_INST3))
break;
x1--;
}
while(x2<XRES-CELL)
{
if((pmap[y][x2+1]&0xFF)!=cm || bmap[y/CELL][(x2+1)/CELL]!=bm)
if(cm!=PT_INST&&((pmap[y][x2+1]&0xFF)!=PT_INST2&&(pmap[y][x2+1]&0xFF)!=PT_INST3))
break;
x2++;
}
@ -4776,13 +4941,21 @@ int create_parts(int x, int y, float rx, float ry, int c)
SLALT = stemp;
return 1;
}
if(REPLACE_MODE) //&& c!=0)
if(REPLACE_MODE)
{
for(j=-tempry; j<=tempry; j++)
for(i=-temprx; i<=temprx; i++)
if((CURRENT_BRUSH==CIRCLE_BRUSH && (i*i)/(rx*rx)+(j*j)/(ry*ry)<=1)||(CURRENT_BRUSH==SQUARE_BRUSH&&i*j<=ry*rx))
{
if((pmap[y+j][x+i]&0xFF)!=SLALT&&SLALT!=0)
continue;
if((pmap[y+j][x+i]))
{
delete_part(x+i, y+j);
if(c==0)
if(c!=0)
create_part(-1, x+i, y+j, c);
}
}
return 1;
}