Some work on DEST, EMP, LIGH
Change indentation to tabs, respect temperature limit (if a hotter reaction is required, should raise temp limit instead of ignoring it). DEST: fix TYPE_SOLID check, and prevent it displacing DMND EMP: randomise DLAY delay instead of heating it (since DLAY does not melt and does not transfer heat) Fix nearest_part so that t=-1 does not include dead particles
This commit is contained in:
parent
107e77a1a1
commit
2f46dca7c1
@ -465,7 +465,7 @@ static const part_type ptypes[PT_NUM] =
|
|||||||
{"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 100C)", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, &update_NPTCT},
|
{"PTCT", PIXPACK(0x405050), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Semi-conductor. Only conducts electricity when cold (Less than 100C)", ST_SOLID, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, &update_NPTCT},
|
||||||
{"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", ST_SOLID, TYPE_PART | PROP_HOT_GLOW, NULL},
|
{"BGLA", PIXPACK(0x606060), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 5, 2, 1, 1, 90, SC_POWDERS, R_TEMP+0.0f +273.15f, 150, "Broken Glass, Heavy particles. Meltable. Bagels.", ST_SOLID, TYPE_PART | PROP_HOT_GLOW, NULL},
|
||||||
{"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 1, SC_EXPLOSIVE, 9000.0f +273.15f, 1, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", ST_NONE, TYPE_ENERGY, &update_THDR},
|
{"THDR", PIXPACK(0xFFFFA0), 0.0f, 0.00f * CFDS, 1.0f, 0.30f, -0.99f, 0.6f, 0.62f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 1, 1, SC_EXPLOSIVE, 9000.0f +273.15f, 1, "Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", ST_NONE, TYPE_ENERGY, &update_THDR},
|
||||||
{"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, 1, SC_GAS, 10000.0f +273.15f, 5, "Plasma, extremely hot.", ST_NONE, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_PYRO},
|
{"PLSM", PIXPACK(0xBB99FF), 0.9f, 0.04f * CFDS, 0.97f, 0.20f, 0.0f, -0.1f, 0.30f, 0.001f * CFDS, 0, 0, 0, 0, 0, 1, 1, 1, SC_GAS, 9999.0f, 5, "Plasma, extremely hot.", ST_NONE, TYPE_GAS|PROP_LIFE_DEC|PROP_LIFE_KILL, &update_PYRO},
|
||||||
{"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", ST_NONE, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
|
{"ETRD", PIXPACK(0x404040), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", ST_NONE, TYPE_SOLID|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
|
||||||
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", ST_SOLID, TYPE_SOLID, NULL},
|
{"NICE", PIXPACK(0xC0E0FF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, -0.0005f* CFDS, 0, 0, 0, 0, 20, 1, 1, 100, SC_SOLIDS, 35.0f, 46, "Nitrogen Ice.", ST_SOLID, TYPE_SOLID, NULL},
|
||||||
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
|
{"NBLE", PIXPACK(0xEB4917), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.75f, 0.001f * CFDS, 0, 0, 0, 0, 1, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 106, "Noble Gas. Diffuses. Conductive. Ionizes into plasma when introduced to electricity", ST_GAS, TYPE_GAS|PROP_CONDUCTS|PROP_LIFE_DEC, NULL},
|
||||||
|
@ -6,10 +6,9 @@ int update_DEST(UPDATE_FUNC_ARGS) {
|
|||||||
ry=rand()%5-2;
|
ry=rand()%5-2;
|
||||||
|
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if ((r>>8)>=NPART || !r)
|
if (!r || (r&0xFF)==PT_DEST || (r&0xFF)==PT_DMND)
|
||||||
return 0;
|
return 0;
|
||||||
if ((r&0xFF)!=PT_DEST && (r&0xFF)!=PT_DMND)
|
|
||||||
{
|
|
||||||
if (parts[i].life<=0 || parts[i].life>37)
|
if (parts[i].life<=0 || parts[i].life>37)
|
||||||
{
|
{
|
||||||
parts[i].life=30+rand()%20;
|
parts[i].life=30+rand()%20;
|
||||||
@ -23,37 +22,33 @@ int update_DEST(UPDATE_FUNC_ARGS) {
|
|||||||
parts[i].temp+=18000;
|
parts[i].temp+=18000;
|
||||||
if (rand()%2==0)
|
if (rand()%2==0)
|
||||||
{
|
{
|
||||||
part_change_type(r>>8, x+rx, y+ry, PT_NEUT);
|
float orig_temp = parts[r>>8].temp;
|
||||||
float rad = (rand()%128+128)/127.0f;
|
create_part(r>>8, x+rx, y+ry, PT_NEUT);
|
||||||
float a = (rand()%360)*M_PI/180.0f;
|
parts[r>>8].temp = restrict_flt(orig_temp+40000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
parts[r>>8].vx = rad*cosf(a);
|
|
||||||
parts[r>>8].vy = rad*sinf(a);
|
|
||||||
parts[r>>8].temp+=40000;
|
|
||||||
pv[y/CELL][x/CELL] += 10.0f;
|
pv[y/CELL][x/CELL] += 10.0f;
|
||||||
parts[i].life-=4;
|
parts[i].life-=4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((r&0xFF)==PT_INSL)
|
else if ((r&0xFF)==PT_INSL)
|
||||||
{
|
{
|
||||||
create_part(r>>8, x+rx, y+ry, PT_FIRE);
|
create_part(r>>8, x+rx, y+ry, PT_PLSM);
|
||||||
parts[r>>8].temp=10000;
|
|
||||||
}
|
}
|
||||||
else if (rand()%3==0)
|
else if (rand()%3==0)
|
||||||
{
|
{
|
||||||
kill_part(r>>8);
|
kill_part(r>>8);
|
||||||
parts[i].life-=4*(ptypes[r&0xFF].properties==TYPE_SOLID?3:1);
|
parts[i].life -= 4*((ptypes[r&0xFF].properties&TYPE_SOLID)?3:1);
|
||||||
if (parts[i].life<=0)
|
if (parts[i].life<=0)
|
||||||
parts[i].life=1;
|
parts[i].life=1;
|
||||||
parts[i].temp+=10000;
|
parts[i].temp+=10000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
parts[r>>8].temp+=10000;
|
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+10000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
}
|
}
|
||||||
int topv=pv[y/CELL][x/CELL]/9+parts[r>>8].temp/900;
|
int topv=pv[y/CELL][x/CELL]/9+parts[r>>8].temp/900;
|
||||||
if (topv>40.0f)
|
if (topv>40.0f)
|
||||||
topv=40.0f;
|
topv=40.0f;
|
||||||
pv[y/CELL][x/CELL]+=40.0f+topv;
|
pv[y/CELL][x/CELL]+=40.0f+topv;
|
||||||
}
|
parts[i].temp = restrict_flt(parts[i].temp, MIN_TEMP, MAX_TEMP);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,10 @@ int update_EMP(UPDATE_FUNC_ARGS) {
|
|||||||
return 0;
|
return 0;
|
||||||
for (rx=-2; rx<3; rx++)
|
for (rx=-2; rx<3; rx++)
|
||||||
for (ry=-2; ry<3; ry++)
|
for (ry=-2; ry<3; ry++)
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if ((r>>8)>=NPART || !r)
|
if (!r)
|
||||||
continue;
|
continue;
|
||||||
if ((r&0xFF)==PT_SPRK)
|
if ((r&0xFF)==PT_SPRK)
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ int update_EMP(UPDATE_FUNC_ARGS) {
|
|||||||
{
|
{
|
||||||
is_elec=1;
|
is_elec=1;
|
||||||
if (rand()%100==0)
|
if (rand()%100==0)
|
||||||
parts[r].temp+=3000;
|
parts[r].temp = restrict_flt(parts[r].temp+3000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
if (rand()%80==0)
|
if (rand()%80==0)
|
||||||
part_change_type(r, rx, ry, PT_BREC);
|
part_change_type(r, rx, ry, PT_BREC);
|
||||||
else if (rand()%120==0)
|
else if (rand()%120==0)
|
||||||
@ -45,10 +45,10 @@ int update_EMP(UPDATE_FUNC_ARGS) {
|
|||||||
int n,nx,ny;
|
int n,nx,ny;
|
||||||
for (nx=-2; nx<3; nx++)
|
for (nx=-2; nx<3; nx++)
|
||||||
for (ny=-2; ny<3; ny++)
|
for (ny=-2; ny<3; ny++)
|
||||||
if (rx+nx>=0 && ry+ny>0 && rx+nx<XRES && ry+ny<YRES && (rx || ry))
|
if (rx+nx>=0 && ry+ny>=0 && rx+nx<XRES && ry+ny<YRES && (rx || ry))
|
||||||
{
|
{
|
||||||
n = pmap[ry+ny][rx+nx];
|
n = pmap[ry+ny][rx+nx];
|
||||||
if ((n>>8)>=NPART || !n)
|
if (!n)
|
||||||
continue;
|
continue;
|
||||||
/*if ((n&0xFF)==PT_BTRY && rand()%60==0)
|
/*if ((n&0xFF)==PT_BTRY && rand()%60==0)
|
||||||
{
|
{
|
||||||
@ -56,44 +56,52 @@ int update_EMP(UPDATE_FUNC_ARGS) {
|
|||||||
parts[n>>8].life=rand()%100+70;
|
parts[n>>8].life=rand()%100+70;
|
||||||
parts[n>>8].temp+=3000;
|
parts[n>>8].temp+=3000;
|
||||||
}*/
|
}*/
|
||||||
if (is_elec && ((n&0xFF)==PT_METL || (n&0xFF)==PT_BMTL) && rand()%280==0)
|
|
||||||
|
//Some elements should only be affected by wire/swch, or by a spark on inst/semiconductor
|
||||||
|
//So not affected by spark on metl, watr etc
|
||||||
|
if (is_elec)
|
||||||
{
|
{
|
||||||
parts[n>>8].temp+=3000;
|
if (((n&0xFF)==PT_METL || (n&0xFF)==PT_BMTL) && rand()%280==0)
|
||||||
}
|
|
||||||
if (is_elec && (n&0xFF)==PT_BMTL && rand()%160==0)
|
|
||||||
{
|
{
|
||||||
part_change_type(n>>8, rx+nx, ry+ny, PT_BMTL);
|
parts[n>>8].temp = restrict_flt(parts[n>>8].temp+3000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
parts[n>>8].temp+=1000;
|
|
||||||
}
|
}
|
||||||
if (is_elec && (n&0xFF)==PT_METL && rand()%300==0)
|
if ((n&0xFF)==PT_BMTL && rand()%160==0)
|
||||||
|
{
|
||||||
|
part_change_type(n>>8, rx+nx, ry+ny, PT_BMTL);//TODO: Redundant, was this meant to be BRMT or something?
|
||||||
|
parts[n>>8].temp = restrict_flt(parts[n>>8].temp+1000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
|
}
|
||||||
|
if ((n&0xFF)==PT_METL && rand()%300==0)
|
||||||
{
|
{
|
||||||
part_change_type(n>>8, rx+nx, ry+ny, PT_BMTL);
|
part_change_type(n>>8, rx+nx, ry+ny, PT_BMTL);
|
||||||
}
|
}
|
||||||
if ((t==PT_PSCN || t==PT_NSCN) && (n&0xFF)==PT_SWCH && rand()%100==0)
|
if ((n&0xFF)==PT_WIFI && rand()%8==0)
|
||||||
|
{
|
||||||
|
//Randomise channel
|
||||||
|
parts[n>>8].temp = rand()%MAX_TEMP;
|
||||||
|
}
|
||||||
|
if ((n&0xFF)==PT_WIFI && rand()%16==0)
|
||||||
|
{
|
||||||
|
create_part(n>>8, rx+nx, ry+ny, PT_BREC);
|
||||||
|
parts[n>>8].temp = restrict_flt(parts[n>>8].temp+1000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((n&0xFF)==PT_SWCH && rand()%100==0)
|
||||||
{
|
{
|
||||||
part_change_type(n>>8, rx+nx, ry+ny, PT_BREC);
|
part_change_type(n>>8, rx+nx, ry+ny, PT_BREC);
|
||||||
}
|
}
|
||||||
if ((t==PT_PSCN || t==PT_NSCN) && (n&0xFF)==PT_SWCH && rand()%100==0)
|
if ((n&0xFF)==PT_SWCH && rand()%100==0)
|
||||||
{
|
{
|
||||||
parts[n>>8].temp+=2000;
|
parts[n>>8].temp = restrict_flt(parts[n>>8].temp+2000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
}
|
|
||||||
if (is_elec && (n&0xFF)==PT_WIFI && rand()%8==0)
|
|
||||||
{
|
|
||||||
parts[n>>8].temp=rand()%10000;
|
|
||||||
}
|
|
||||||
if (is_elec && (n&0xFF)==PT_WIFI && rand()%16==0)
|
|
||||||
{
|
|
||||||
create_part(n>>8, rx+nx, ry+ny, PT_BREC);
|
|
||||||
parts[n>>8].temp+=1000;
|
|
||||||
}
|
}
|
||||||
if ((n&0xFF)==PT_ARAY && rand()%60==0)
|
if ((n&0xFF)==PT_ARAY && rand()%60==0)
|
||||||
{
|
{
|
||||||
create_part(n>>8, rx+nx, ry+ny, PT_BREC);
|
create_part(n>>8, rx+nx, ry+ny, PT_BREC);
|
||||||
parts[n>>8].temp+=1000;
|
parts[n>>8].temp = restrict_flt(parts[n>>8].temp+1000.0f, MIN_TEMP, MAX_TEMP);
|
||||||
}
|
}
|
||||||
if (t==PT_DLAY && rand()%70==0)
|
if (t==PT_DLAY && rand()%70==0)
|
||||||
{
|
{
|
||||||
parts[n>>8].temp+=2000;
|
//Randomise delay
|
||||||
|
parts[n>>8].temp = (rand()%256) + 273.15f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,10 +8,10 @@ int contact_part(int i, int tp)
|
|||||||
int r,rx,ry;
|
int r,rx,ry;
|
||||||
for (rx=-2; rx<3; rx++)
|
for (rx=-2; rx<3; rx++)
|
||||||
for (ry=-2; ry<3; ry++)
|
for (ry=-2; ry<3; ry++)
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if ((r>>8)>=NPART || !r)
|
if (!r)
|
||||||
continue;
|
continue;
|
||||||
if ((r&0xFF)==tp)
|
if ((r&0xFF)==tp)
|
||||||
return r>>8;
|
return r>>8;
|
||||||
@ -98,45 +98,46 @@ int update_LIGH(UPDATE_FUNC_ARGS)
|
|||||||
hv[y/CELL][x/CELL]=MAX_TEMP;
|
hv[y/CELL][x/CELL]=MAX_TEMP;
|
||||||
for (rx=-2; rx<3; rx++) // destruction
|
for (rx=-2; rx<3; rx++) // destruction
|
||||||
for (ry=-2; ry<3; ry++)
|
for (ry=-2; ry<3; ry++)
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if ((r>>8)>=NPART || !r)
|
if (!r)
|
||||||
continue;
|
continue;
|
||||||
if ((r&0xFF)!=PT_LIGH && (r&0xFF)!=PT_TESC)
|
if ((r&0xFF)!=PT_LIGH && (r&0xFF)!=PT_TESC)
|
||||||
{
|
{
|
||||||
if (parts[i].tmp2==3)
|
if (parts[i].tmp2==3)
|
||||||
{
|
{
|
||||||
if ((ptypes[r&0xFF].properties&PROP_CONDUCTS) && parts[r>>8].life==0 && parts[r>>8].ctype!=PT_SPRK)
|
if ((ptypes[r&0xFF].properties&PROP_CONDUCTS) && parts[r>>8].life==0)
|
||||||
{
|
{
|
||||||
parts[r>>8].ctype = parts[r>>8].type;
|
parts[r>>8].ctype = parts[r>>8].type;
|
||||||
part_change_type(r>>8,x+rx,y+ry,PT_SPRK);
|
create_part(r>>8,x+rx,y+ry,PT_SPRK);
|
||||||
parts[r>>8].life = 4;
|
parts[r>>8].life = 4;
|
||||||
|
|
||||||
pv[y/CELL][x/CELL] += powderful/1200;
|
pv[y/CELL][x/CELL] += powderful/1200;
|
||||||
parts[r>>8].temp+=powderful/20;
|
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/20, MIN_TEMP, MAX_TEMP);
|
||||||
}
|
}
|
||||||
else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT)
|
else if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT)
|
||||||
{
|
{
|
||||||
pv[y/CELL][x/CELL] += powderful/110;
|
pv[y/CELL][x/CELL] += powderful/110;
|
||||||
parts[r>>8].temp+=powderful/1.5;
|
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/1.5, MIN_TEMP, MAX_TEMP);
|
||||||
}
|
}
|
||||||
if ((r&0xFF)==PT_DEUT || (r&0xFF)==PT_PLUT)
|
if ((r&0xFF)==PT_DEUT || (r&0xFF)==PT_PLUT)
|
||||||
{
|
{
|
||||||
parts[r>>8].temp+=powderful;
|
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful, MIN_TEMP, MAX_TEMP);
|
||||||
pv[y/CELL][x/CELL] +=powderful/35;
|
pv[y/CELL][x/CELL] +=powderful/35;
|
||||||
if (rand()%3==0)
|
if (rand()%3==0)
|
||||||
{
|
{
|
||||||
part_change_type(r>>8,x+rx,y+ry,PT_NEUT);
|
part_change_type(r>>8,x+rx,y+ry,PT_NEUT);
|
||||||
|
parts[r>>8].life = rand()%480+480;
|
||||||
parts[r>>8].vx=rand()%10-5;
|
parts[r>>8].vx=rand()%10-5;
|
||||||
parts[r>>8].vy=rand()%10-5;
|
parts[r>>8].vy=rand()%10-5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT)
|
if ((r&0xFF)!=PT_CLNE&&(r&0xFF)!=PT_THDR&&(r&0xFF)!=PT_SPRK&&(r&0xFF)!=PT_DMND&&(r&0xFF)!=PT_FIRE&&(r&0xFF)!=PT_NEUT&&(r&0xFF)!=PT_PHOT)
|
||||||
parts[r>>8].temp+=powderful/16;
|
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/16, MIN_TEMP, MAX_TEMP);
|
||||||
else
|
else
|
||||||
parts[r>>8].temp+=powderful/70;
|
parts[r>>8].temp = restrict_flt(parts[r>>8].temp+powderful/70, MIN_TEMP, MAX_TEMP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parts[i].tmp2==3)
|
if (parts[i].tmp2==3)
|
||||||
@ -151,7 +152,7 @@ int update_LIGH(UPDATE_FUNC_ARGS)
|
|||||||
if (parts[i].tmp2==-1)
|
if (parts[i].tmp2==-1)
|
||||||
{
|
{
|
||||||
kill_part(i);
|
kill_part(i);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
if (parts[i].tmp2<=0 || parts[i].life<=1)
|
if (parts[i].tmp2<=0 || parts[i].life<=1)
|
||||||
{
|
{
|
||||||
@ -168,7 +169,7 @@ int update_LIGH(UPDATE_FUNC_ARGS)
|
|||||||
if (parts[i].tmp2<=-2)
|
if (parts[i].tmp2<=-2)
|
||||||
{
|
{
|
||||||
kill_part(i);
|
kill_part(i);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float angle, angle2=-1;
|
float angle, angle2=-1;
|
||||||
@ -246,12 +247,12 @@ int update_LIGH(UPDATE_FUNC_ARGS)
|
|||||||
ry=-sin(angle*M_PI/180)*multipler;
|
ry=-sin(angle*M_PI/180)*multipler;
|
||||||
create_line_par(x, y, x+rx, y+ry, PT_LIGH, parts[i].temp, parts[i].life, angle, 0);
|
create_line_par(x, y, x+rx, y+ry, PT_LIGH, parts[i].temp, parts[i].life, angle, 0);
|
||||||
|
|
||||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES && (rx || ry))
|
||||||
{
|
{
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
/*if ((r&0xFF)!=PT_LIGH && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_UDMT && (r&0xFF)!=PT_TESC)
|
/*if ((r&0xFF)!=PT_LIGH && (r&0xFF)!=PT_DMND && (r&0xFF)!=PT_UDMT && (r&0xFF)!=PT_TESC)
|
||||||
part_change_type(r>>8, x+rx, y+ry, PT_LIGH);*/
|
part_change_type(r>>8, x+rx, y+ry, PT_LIGH);*/
|
||||||
if ((r&0xFF)==PT_LIGH && !((r>>8)>=NPART || !r))
|
if ((r&0xFF)==PT_LIGH)
|
||||||
{
|
{
|
||||||
parts[r>>8].tmp2=1+(rand()%200>parts[i].tmp2*parts[i].tmp2/10+60);
|
parts[r>>8].tmp2=1+(rand()%200>parts[i].tmp2*parts[i].tmp2/10+60);
|
||||||
parts[r>>8].life=(int)(1.0*parts[i].life/1.5-rand()%2);
|
parts[r>>8].life=(int)(1.0*parts[i].life/1.5-rand()%2);
|
||||||
|
@ -98,6 +98,7 @@ void init_can_move()
|
|||||||
can_move[t][rt] = 2;
|
can_move[t][rt] = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
can_move[PT_DEST][PT_DMND] = 0;
|
||||||
can_move[PT_BIZR][PT_FILT] = 2;
|
can_move[PT_BIZR][PT_FILT] = 2;
|
||||||
can_move[PT_BIZRG][PT_FILT] = 2;
|
can_move[PT_BIZRG][PT_FILT] = 2;
|
||||||
for (t=0;t<PT_NUM;t++)
|
for (t=0;t<PT_NUM;t++)
|
||||||
@ -1276,7 +1277,7 @@ int nearest_part(int ci, int t, int max_d)
|
|||||||
int cy = (int)parts[ci].y;
|
int cy = (int)parts[ci].y;
|
||||||
for (i=0; i<=parts_lastActiveIndex; i++)
|
for (i=0; i<=parts_lastActiveIndex; i++)
|
||||||
{
|
{
|
||||||
if ((parts[i].type==t||t==-1)&&!parts[i].life&&i!=ci)
|
if ((parts[i].type==t||(t==-1&&parts[i].type))&&!parts[i].life&&i!=ci)
|
||||||
{
|
{
|
||||||
ndistance = abs(cx-parts[i].x)+abs(cy-parts[i].y);// Faster but less accurate Older: sqrt(pow(cx-parts[i].x, 2)+pow(cy-parts[i].y, 2));
|
ndistance = abs(cx-parts[i].x)+abs(cy-parts[i].y);// Faster but less accurate Older: sqrt(pow(cx-parts[i].x, 2)+pow(cy-parts[i].y, 2));
|
||||||
if (ndistance<distance)
|
if (ndistance<distance)
|
||||||
|
Loading…
Reference in New Issue
Block a user