Permalink
Browse files

fixes suggested by jacksonmj in -dev

fixes bugs in DMG, LIGH, PHOT, and QRTZ, also makes deut explosions less laggy when they hit the particle limit
  • Loading branch information...
jacob1 committed Nov 14, 2014
1 parent 1289465 commit c673f30e14043d0391168247133567d616110173
@@ -93,7 +93,10 @@ int Element_DMG::update(UPDATE_FUNC_ARGS)
else if(t == PT_QRTZ)
sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_PQRT);
else if(t == PT_TUNG)
{
sim->part_change_type(rr>>8, x+nxi, y+nxj, PT_BRMT);
parts[rr>>8].ctype = PT_TUNG;
}
}
}
}
@@ -78,8 +78,8 @@ int Element_GOLD::update(UPDATE_FUNC_ARGS)
if(!r) continue;
if((r&0xFF)==PT_SPRK && parts[r>>8].life && parts[r>>8].life<4)
{
sim->part_change_type(i, x, y, PT_SPRK);
parts[i].life = 4;
parts[i].type = PT_SPRK;
parts[i].ctype = PT_GOLD;
}
}
@@ -204,13 +204,13 @@ int Element_LIGH::update(UPDATE_FUNC_ARGS)
multipler=parts[i].life*1.5+rand()%((int)(parts[i].life+1));
rx=cos(angle*M_PI/180)*multipler;
ry=-sin(angle*M_PI/180)*multipler;
create_line_par(sim, x, y, x+rx, y+ry, PT_LIGH, parts[i].temp, parts[i].life, angle, 0);
create_line_par(sim, x, y, x+rx, y+ry, PT_LIGH, parts[i].temp, parts[i].life, angle, parts[i].tmp2);
if (parts[i].tmp2==2)// && pNear==-1)
{
angle2= ((int)angle+100-rand()%200)%360;
rx=cos(angle2*M_PI/180)*multipler;
ry=-sin(angle2*M_PI/180)*multipler;
create_line_par(sim, x, y, x+rx, y+ry, PT_LIGH, parts[i].temp, parts[i].life, angle2, 0);
create_line_par(sim, x, y, x+rx, y+ry, PT_LIGH, parts[i].temp, parts[i].life, angle2, parts[i].tmp2);
}
parts[i].tmp2=-1;
@@ -275,7 +275,7 @@ bool Element_LIGH::create_LIGH(Simulation * sim, int x, int y, int c, int temp,
else
{
sim->parts[p].life = life;
sim->parts[p].tmp2 = tmp2;
sim->parts[p].tmp2 = 0;
}
}
else if (x >= 0 && x < XRES && y >= 0 && y < YRES)
@@ -190,22 +190,22 @@ int Element_NEUT::graphics(GRAPHICS_FUNC_ARGS)
//#TPT-Directive ElementHeader Element_NEUT static int DeutExplosion(Simulation * sim, int n, int x, int y, float temp, int t)
int Element_NEUT::DeutExplosion(Simulation * sim, int n, int x, int y, float temp, int t)//testing a new deut create part
{
int i, c;
int i;
n = (n/50);
if (n<1) {
if (n < 1)
n = 1;
}
if (n>340) {
else if (n > 340)
n = 340;
}
for (c=0; c<n; c++) {
for (int c = 0; c < n; c++)
{
i = sim->create_part(-3, x, y, t);
if (i > -1)
if (i >= 0)
sim->parts[i].temp = temp;
sim->pv[y/CELL][x/CELL] += 6.0f * CFDS;
else if (sim->pfree < 0)
break;
}
sim->pv[y/CELL][x/CELL] += (6.0f * CFDS)*n;
return 0;
}
@@ -71,7 +71,10 @@ int Element_PHOT::update(UPDATE_FUNC_ARGS)
parts[i].vy *= 0.90;
sim->create_part(r>>8, x+rx, y+ry, PT_PHOT);
rrr = (rand()%360)*3.14159f/180.0f;
rr = (rand()%128+128)/127.0f;
if ((r&0xFF) == PT_ISOZ)
rr = (rand()%128+128)/127.0f;
else
rr = (rand()%228+128)/127.0f;
parts[r>>8].vx = rr*cosf(rrr);
parts[r>>8].vy = rr*sinf(rrr);
sim->pv[y/CELL][x/CELL] -= 15.0f * CFDS;
@@ -162,19 +162,20 @@ int Element_PROT::DeutImplosion(Simulation * sim, int n, int x, int y, float tem
{
int i;
n = (n/50);
if (n<1)
if (n < 1)
n = 1;
else if (n>340)
else if (n > 340)
n = 340;
for (int c=0; c<n; c++)
for (int c = 0; c < n; c++)
{
i = sim->create_part(-3, x, y, t);
if (i >= 0)
sim->parts[i].temp = temp;
sim->pv[y/CELL][x/CELL] -= 6.0f * CFDS;
else if (sim->pfree < 0)
break;
}
sim->pv[y/CELL][x/CELL] -= (6.0f * CFDS)*n;
return 0;
}
@@ -246,7 +246,7 @@ int Element_SPRK::update(UPDATE_FUNC_ARGS)
if (pavg == PT_INSL) continue; //Insulation blocks everything past here
if (!((sim->elements[receiver].Properties&PROP_CONDUCTS)||receiver==PT_INST||receiver==PT_QRTZ)) continue; //Stop non-conducting recievers, allow INST and QRTZ as special cases
if (abs(rx)+abs(ry)>=4 &&sender!=PT_SWCH&&receiver!=PT_SWCH) continue; //Only switch conducts really far
if (receiver==sender && receiver!=PT_INST) goto conduct; //Everything conducts to itself, except INST.
if (receiver==sender && receiver!=PT_INST && receiver!=PT_QRTZ) goto conduct; //Everything conducts to itself, except INST.
//Sender cases, where elements can have specific outputs
switch (sender)

0 comments on commit c673f30

Please sign in to comment.