Make default DCEL exactly reverse the effect of default ACEL

This commit is contained in:
jacksonmj
2013-02-25 01:05:12 +00:00
parent 27ac5ab75d
commit 5c2f310577
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 Element_ACEL::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; 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; parts[i].tmp = 0;
for (rx=-1; rx<2; rx++) for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++) for (ry=-1; ry<2; ry++)
@@ -63,16 +72,8 @@ int Element_ACEL::update(UPDATE_FUNC_ARGS)
continue; continue;
if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
{ {
if (parts[i].life) parts[r>>8].vx *= multiplier;
{ parts[r>>8].vy *= multiplier;
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[i].tmp = 1; 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 Element_DCEL::update(UPDATE_FUNC_ARGS)
{ {
int r, rx, ry; 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; parts[i].tmp = 0;
for (rx=-1; rx<2; rx++) for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++) for (ry=-1; ry<2; ry++)
@@ -63,16 +72,8 @@ int Element_DCEL::update(UPDATE_FUNC_ARGS)
continue; continue;
if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY)) if(sim->elements[r&0xFF].Properties & (TYPE_PART | TYPE_LIQUID | TYPE_GAS | TYPE_ENERGY))
{ {
if (parts[i].life) parts[r>>8].vx *= multiplier;
{ parts[r>>8].vy *= multiplier;
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[i].tmp = 1; parts[i].tmp = 1;
} }
} }
@@ -91,4 +92,4 @@ int Element_DCEL::graphics(GRAPHICS_FUNC_ARGS)
} }
Element_DCEL::~Element_DCEL() {} Element_DCEL::~Element_DCEL() {}