mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-09-02 12:32:40 +02:00
More fixes
Fix PHOT and FWRK. Fix QRTZ conductivity (broken by removing PROP_CONDUCTS) Add some things lost during rewrite: NTCT/PTCT not heated if INSL in the way; boiling point varies with pressure.
This commit is contained in:
@@ -7,9 +7,9 @@ int update_FWRK(UPDATE_FUNC_ARGS) {
|
||||
np = create_part(-1, x , y-1 , PT_FWRK);
|
||||
if (np!=-1)
|
||||
{
|
||||
parts[r>>8].vy = rand()%8-22;
|
||||
parts[r>>8].vx = rand()%20-rand()%20;
|
||||
parts[r>>8].life=rand()%15+25;
|
||||
parts[np].vy = rand()%8-22;
|
||||
parts[np].vx = rand()%20-rand()%20;
|
||||
parts[np].life=rand()%15+25;
|
||||
kill_part(i);
|
||||
return 1;
|
||||
}
|
||||
@@ -33,13 +33,13 @@ int update_FWRK(UPDATE_FUNC_ARGS) {
|
||||
pv[y/CELL][x/CELL] += 2.00f*CFDS;
|
||||
if (np!=-1)
|
||||
{
|
||||
parts[r>>8].vy = -(rand()%10-1);
|
||||
parts[r>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
|
||||
parts[r>>8].life= rand()%37+18;
|
||||
parts[r>>8].tmp=q;
|
||||
parts[r>>8].flags=w;
|
||||
parts[r>>8].ctype=e;
|
||||
parts[r>>8].temp= rand()%20+6000;
|
||||
parts[np].vy = -(rand()%10-1);
|
||||
parts[np].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
|
||||
parts[np].life= rand()%37+18;
|
||||
parts[np].tmp=q;
|
||||
parts[np].flags=w;
|
||||
parts[np].ctype=e;
|
||||
parts[np].temp= rand()%20+6000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ int update_PHOT(UPDATE_FUNC_ARGS) {
|
||||
for (rx=-1; rx<2; rx++)
|
||||
for (ry=-1; ry<2; ry++)
|
||||
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) {
|
||||
r = pmap[x+rx][y+ry];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
if ((r&0xFF)==PT_ISOZ && 5>(rand()%2000))
|
||||
|
@@ -97,12 +97,12 @@ int update_SPRK(UPDATE_FUNC_ARGS) {
|
||||
// ct = spark from material, rt = spark to material. Make conduct_sprk = 0 if conduction not allowed
|
||||
|
||||
if (pavg == PT_INSL) conduct_sprk = 0;
|
||||
if (!(ptypes[rt].properties&PROP_CONDUCTS||rt==PT_INST)) conduct_sprk = 0;
|
||||
if (!(ptypes[rt].properties&PROP_CONDUCTS||rt==PT_INST||rt==PT_QRTZ)) conduct_sprk = 0;
|
||||
if (abs(rx)+abs(ry)>=4 &&ct!=PT_SWCH&&rt!=PT_SWCH)
|
||||
conduct_sprk = 0;
|
||||
|
||||
|
||||
if (ct==PT_METL && (rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR||(rt==PT_SPRK&&(parts[r>>8].ctype==PT_NTCT||parts[r>>8].ctype==PT_PTCT))))
|
||||
if (ct==PT_METL && (rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR||(rt==PT_SPRK&&(parts[r>>8].ctype==PT_NTCT||parts[r>>8].ctype==PT_PTCT))) && pavg!=PT_INSL)
|
||||
{
|
||||
parts[r>>8].temp = 473.0f;
|
||||
if (rt==PT_NTCT||rt==PT_PTCT)
|
||||
|
14
src/powder.c
14
src/powder.c
@@ -1127,7 +1127,7 @@ int nearest_part(int ci, int t)
|
||||
void update_particles_i(pixel *vid, int start, int inc)
|
||||
{
|
||||
int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors;
|
||||
float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp;
|
||||
float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp, ctemph, ctempl;
|
||||
int fin_x, fin_y, clear_x, clear_y;
|
||||
float fin_xf, fin_yf, clear_xf, clear_yf;
|
||||
float nn, ct1, ct2, swappage;
|
||||
@@ -1522,8 +1522,16 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
parts[surround_hconduct[j]].temp = pt;
|
||||
}
|
||||
|
||||
ctemph = ctempl = pt;
|
||||
// change boiling point with pressure
|
||||
if ((ptypes[t].state==ST_LIQUID && ptransitions[t].tht>-1 && ptransitions[t].tht<PT_NUM && ptypes[ptransitions[t].tht].state==ST_GAS)
|
||||
|| t==PT_LNTG || t==PT_SLTW)
|
||||
ctemph -= 2.0f*pv[y/CELL][x/CELL];
|
||||
else if ((ptypes[t].state==ST_GAS && ptransitions[t].tlt>-1 && ptransitions[t].tlt<PT_NUM && ptypes[ptransitions[t].tlt].state==ST_LIQUID)
|
||||
|| t==PT_WTRV)
|
||||
ctempl -= 2.0f*pv[y/CELL][x/CELL];
|
||||
s = 1;
|
||||
if (pt>ptransitions[t].thv&&ptransitions[t].tht>-1) {
|
||||
if (ctemph>ptransitions[t].thv&&ptransitions[t].tht>-1) {
|
||||
// particle type change due to high temperature
|
||||
if (ptransitions[t].tht!=PT_NUM)
|
||||
t = ptransitions[t].tht;
|
||||
@@ -1544,7 +1552,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
else t = PT_WTRV;
|
||||
}
|
||||
else s = 0;
|
||||
} else if (pt<ptransitions[t].tlv&&ptransitions[t].tlt>-1) {
|
||||
} else if (ctempl<ptransitions[t].tlv&&ptransitions[t].tlt>-1) {
|
||||
// particle type change due to low temperature
|
||||
if (ptransitions[t].tlt!=PT_NUM)
|
||||
t = ptransitions[t].tlt;
|
||||
|
Reference in New Issue
Block a user