1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-28 15:55:51 +00:00

Fixes to element interaction.

It now works with multiple entities doing interaction, and the correct
update list is used, which should save a bit more CPU.
This commit is contained in:
fgenesis 2014-09-13 16:33:32 +02:00
parent e8ff469205
commit d82553d6a7
4 changed files with 4 additions and 6 deletions

View file

@ -7127,7 +7127,7 @@ void Avatar::onUpdate(float dt)
if(!core->particlesPaused && elementEffectMult > 0)
{
ElementUpdateList& elems = dsq->game->elementUpdateList;
ElementUpdateList& elems = dsq->game->elementInteractionList;
for (ElementUpdateList::iterator it = elems.begin(); it != elems.end(); ++it)
{
(*it)->doInteraction(this, elementEffectMult, 16);

View file

@ -84,12 +84,8 @@ void Element::doInteraction(Entity *ent, float mult, float touchWidth)
eff->hitPerc = hitPerc;
eff->touchVel = ent->vel;
eff->effectMult = mult;
return;
}
}
//eff->touchVel = Vector(0, 0);
//eff->hitPerc = 0;
eff->touching = false;
}
void Element::updateEffects(float dt)
@ -110,6 +106,7 @@ void Element::updateEffects(float dt)
if (eff->touching)
{
eff->touching = false;
float ramp = eff->touchVel.getLength2D()/800.0f;
if (ramp < 0) ramp = 0;
if (ramp > 1) ramp = 1;

View file

@ -10824,6 +10824,7 @@ void Game::removeState()
core->particlesPaused = false;
elementUpdateList.clear();
elementInteractionList.clear();
dsq->setCursor(CURSOR_NORMAL);
dsq->darkLayer.toggle(0);

View file

@ -5525,7 +5525,7 @@ luaFunc(entity_doElementInteraction)
if (!touchWidth)
touchWidth = 16;
ElementUpdateList& elems = dsq->game->elementUpdateList;
ElementUpdateList& elems = dsq->game->elementInteractionList;
for (ElementUpdateList::iterator it = elems.begin(); it != elems.end(); ++it)
{
(*it)->doInteraction(e, mult, touchWidth);