ACEL and DCEL use life for strength value

This commit is contained in:
Simon Robertshaw 2013-02-24 11:50:10 +00:00
parent 934dbe3518
commit 8dfb1ecf87
3 changed files with 35 additions and 40 deletions

View File

@ -3089,15 +3089,10 @@ int Simulation::create_part(int p, int x, int y, int tv)
break; break;
case PT_DTEC: case PT_DTEC:
parts[i].tmp2 = 2; parts[i].tmp2 = 2;
break;
case PT_TSNS: case PT_TSNS:
parts[i].tmp2 = 2; parts[i].tmp2 = 2;
break; break;
case PT_ACEL:
parts[i].ctype = 10;
break;
case PT_DCEL:
parts[i].ctype = 9;
break;
default: default:
if (t==PT_FIGH) if (t==PT_FIGH)
{ {

View File

@ -50,6 +50,7 @@ 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);
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++)
@ -62,11 +63,10 @@ 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].ctype) if (parts[i].life)
{ {
int change = parts[i].ctype > 1000 ? 1000 : parts[i].ctype < 0 ? 0 : parts[i].ctype; parts[r>>8].vx *= 1.0f+(change/100.0f);
parts[r>>8].vx *= 1+change/100.0f; parts[r>>8].vy *= 1.0f+(change/100.0f);
parts[r>>8].vy *= 1+change/100.0f;
} }
else else
{ {

View File

@ -50,6 +50,7 @@ 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);
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++)
@ -62,11 +63,10 @@ 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].ctype) if (parts[i].life)
{ {
int change = parts[i].ctype > 100 ? 100 : parts[i].ctype < 0 ? 0 : parts[i].ctype; parts[r>>8].vx *= 1.0f-(change/100.0f);
parts[r>>8].vx *= 1-change/100.0f; parts[r>>8].vy *= 1.0f-(change/100.0f);
parts[r>>8].vy *= 1-change/100.0f;
} }
else else
{ {