remove useless and laggy lightning_recreate check

This commit is contained in:
jacob1 2013-09-11 21:41:54 -04:00
parent 332aa25bf6
commit 074a2226e1
2 changed files with 11 additions and 31 deletions

View File

@ -3230,34 +3230,12 @@ void Simulation::update_particles_i(int start, int inc)
int h_count = 0; int h_count = 0;
int surround[8]; int surround[8];
int surround_hconduct[8]; int surround_hconduct[8];
int lighting_ok=1;
unsigned int elem_properties; unsigned int elem_properties;
float pGravX, pGravY, pGravD; float pGravX, pGravY, pGravD;
int excessive_stacking_found = 0; int excessive_stacking_found = 0;
currentTick++; currentTick++;
if (lighting_recreate>0)
{
for (i=0; i<=parts_lastActiveIndex; i++)
{
if (parts[i].type==PT_LIGH && parts[i].tmp2>0)
{
lighting_ok=0;
break;
}
}
}
if (lighting_ok)
lighting_recreate--;
if (lighting_recreate<0)
lighting_recreate=1;
if (lighting_recreate>21)
lighting_recreate=21;
//if (sys_pause&&!framerender)//do nothing if paused //if (sys_pause&&!framerender)//do nothing if paused
// return; // return;
@ -3815,7 +3793,7 @@ void Simulation::update_particles_i(int start, int inc)
if ((t==PT_ICEI || t==PT_SNOW) && (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || parts[i].ctype==PT_ICEI || parts[i].ctype==PT_SNOW || !elements[parts[i].ctype].Enabled)) if ((t==PT_ICEI || t==PT_SNOW) && (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || parts[i].ctype==PT_ICEI || parts[i].ctype==PT_SNOW || !elements[parts[i].ctype].Enabled))
parts[i].ctype = PT_WATR; parts[i].ctype = PT_WATR;
if (ctemph>elements[t].HighTemperature && elements[t].HighTemperatureTransition>-1) if (elements[t].HighTemperatureTransition>-1 && ctemph>elements[t].HighTemperature)
{ {
// particle type change due to high temperature // particle type change due to high temperature
#ifdef REALISTIC #ifdef REALISTIC
@ -3911,7 +3889,7 @@ void Simulation::update_particles_i(int start, int inc)
else else
s = 0; s = 0;
} }
else if (ctempl<elements[t].LowTemperature && elements[t].LowTemperatureTransition > -1) else if (elements[t].LowTemperatureTransition > -1 && ctempl<elements[t].LowTemperature)
{ {
// particle type change due to low temperature // particle type change due to low temperature
#ifdef REALISTIC #ifdef REALISTIC
@ -4095,7 +4073,7 @@ void Simulation::update_particles_i(int start, int inc)
s = 1; s = 1;
gravtot = fabs(gravy[(y/CELL)*(XRES/CELL)+(x/CELL)])+fabs(gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]); gravtot = fabs(gravy[(y/CELL)*(XRES/CELL)+(x/CELL)])+fabs(gravx[(y/CELL)*(XRES/CELL)+(x/CELL)]);
if (pv[y/CELL][x/CELL]>elements[t].HighPressure&&elements[t].HighPressureTransition>-1) { if (elements[t].HighPressureTransition>-1 && pv[y/CELL][x/CELL]>elements[t].HighPressure) {
// particle type change due to high pressure // particle type change due to high pressure
if (elements[t].HighPressureTransition!=PT_NUM) if (elements[t].HighPressureTransition!=PT_NUM)
t = elements[t].HighPressureTransition; t = elements[t].HighPressureTransition;
@ -4107,12 +4085,12 @@ void Simulation::update_particles_i(int start, int inc)
else s = 0; else s = 0;
} }
else s = 0; else s = 0;
} else if (pv[y/CELL][x/CELL]<elements[t].LowPressure&&elements[t].LowPressureTransition>-1) { } else if (elements[t].LowPressureTransition>-1 && pv[y/CELL][x/CELL]<elements[t].LowPressure) {
// particle type change due to low pressure // particle type change due to low pressure
if (elements[t].LowPressureTransition!=PT_NUM) if (elements[t].LowPressureTransition!=PT_NUM)
t = elements[t].LowPressureTransition; t = elements[t].LowPressureTransition;
else s = 0; else s = 0;
} else if (gravtot>(elements[t].HighPressure/4.0f)&&elements[t].HighPressureTransition>-1) { } else if (elements[t].HighPressureTransition>-1 && gravtot>(elements[t].HighPressure/4.0f)) {
// particle type change due to high gravity // particle type change due to high gravity
if (elements[t].HighPressureTransition!=PT_NUM) if (elements[t].HighPressureTransition!=PT_NUM)
t = elements[t].HighPressureTransition; t = elements[t].HighPressureTransition;
@ -4125,12 +4103,16 @@ void Simulation::update_particles_i(int start, int inc)
} }
else s = 0; else s = 0;
} else s = 0; } else s = 0;
if (s) { // particle type change occurred
// particle type change occurred
if (s)
{
parts[i].life = 0; parts[i].life = 0;
part_change_type(i,x,y,t); part_change_type(i,x,y,t);
if (t==PT_FIRE) if (t==PT_FIRE)
parts[i].life = rand()%50+120; parts[i].life = rand()%50+120;
if (t==PT_NONE) { if (t==PT_NONE)
{
kill_part(i); kill_part(i);
goto killed; goto killed;
} }
@ -4781,7 +4763,6 @@ Simulation::Simulation():
pretty_powder(0), pretty_powder(0),
sandcolour_frame(0), sandcolour_frame(0),
emp_decor(0), emp_decor(0),
lighting_recreate(0),
force_stacking_check(0), force_stacking_check(0),
ISWIRE(0), ISWIRE(0),
gravWallChanged(false), gravWallChanged(false),

View File

@ -66,7 +66,6 @@ public:
playerst player2; playerst player2;
playerst fighters[256]; //255 is the maximum number of fighters playerst fighters[256]; //255 is the maximum number of fighters
unsigned char fighcount; //Contains the number of fighters unsigned char fighcount; //Contains the number of fighters
int lighting_recreate;
bool gravWallChanged; bool gravWallChanged;
//Portals and Wifi //Portals and Wifi
Particle portalp[CHANNELS][8][80]; Particle portalp[CHANNELS][8][80];