Merge remote-tracking branch 'origin/master'

This commit is contained in:
jacob1 2013-02-24 22:10:31 -05:00
commit e700ff2988
2 changed files with 26 additions and 24 deletions

View File

@ -50,7 +50,16 @@ Element_ACEL::Element_ACEL()
int Element_ACEL::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
float change = parts[i].life > 1000 ? 1000 : (parts[i].life < 0 ? 0 : parts[i].life);
float multiplier;
if (parts[i].life!=0)
{
float change = parts[i].life > 1000 ? 1000 : (parts[i].life < 0 ? 0 : parts[i].life);
multiplier = 1.0f+(change/100.0f);
}
else
{
multiplier = 1.1f;
}
parts[i].tmp = 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
@ -63,16 +72,8 @@ int Element_ACEL::update(UPDATE_FUNC_ARGS)
continue;
if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
{
if (parts[i].life)
{
parts[r>>8].vx *= 1.0f+(change/100.0f);
parts[r>>8].vy *= 1.0f+(change/100.0f);
}
else
{
parts[r>>8].vx *= 1.1f;
parts[r>>8].vy *= 1.1f;
}
parts[r>>8].vx *= multiplier;
parts[r>>8].vy *= multiplier;
parts[i].tmp = 1;
}
}
@ -91,4 +92,4 @@ int Element_ACEL::graphics(GRAPHICS_FUNC_ARGS)
}
Element_ACEL::~Element_ACEL() {}
Element_ACEL::~Element_ACEL() {}

View File

@ -50,7 +50,16 @@ Element_DCEL::Element_DCEL()
int Element_DCEL::update(UPDATE_FUNC_ARGS)
{
int r, rx, ry;
float change = parts[i].life > 100 ? 100 : (parts[i].life < 0 ? 0 : parts[i].life);
float multiplier;
if (parts[i].life!=0)
{
float change = parts[i].life > 100 ? 100 : (parts[i].life < 0 ? 0 : parts[i].life);
multiplier = 1.0f-(change/100.0f);
}
else
{
multiplier = 1.0f/1.1f;
}
parts[i].tmp = 0;
for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++)
@ -63,16 +72,8 @@ int Element_DCEL::update(UPDATE_FUNC_ARGS)
continue;
if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
{
if (parts[i].life)
{
parts[r>>8].vx *= 1.0f-(change/100.0f);
parts[r>>8].vy *= 1.0f-(change/100.0f);
}
else
{
parts[r>>8].vx *= 0.9f;
parts[r>>8].vy *= 0.9f;
}
parts[r>>8].vx *= multiplier;
parts[r>>8].vy *= multiplier;
parts[i].tmp = 1;
}
}
@ -91,4 +92,4 @@ int Element_DCEL::graphics(GRAPHICS_FUNC_ARGS)
}
Element_DCEL::~Element_DCEL() {}
Element_DCEL::~Element_DCEL() {}