added triggers onTimer
added map view in ADeditor
This commit is contained in:
34
splashes.cpp
34
splashes.cpp
@@ -48,7 +48,7 @@ void Splashes::addSplash(int player, int srcTower, int srcId, QPointF pos, QPoin
|
||||
break;
|
||||
case srcTriggerType::onTimer :
|
||||
tot.src = src.triggerIndexes.at(i);
|
||||
tot.timer = trig.timer;
|
||||
tot.timer = 0;
|
||||
spl.trigsOnTimer.append(tot);
|
||||
break;
|
||||
}
|
||||
@@ -72,6 +72,7 @@ void Splashes::addSplash(QPoint curTowerId)
|
||||
void Splashes::update()
|
||||
{
|
||||
QList <int> deadIndexes;
|
||||
// FIXME : rewrite loop with iterators, and correct onTrigTimer()
|
||||
for (int i=0; i<gameData->curSplashes.size(); i++)
|
||||
{
|
||||
float arctg,angl;
|
||||
@@ -82,6 +83,10 @@ void Splashes::update()
|
||||
spl.life++;
|
||||
if (spl.life > src.lifetime)
|
||||
deadIndexes.append(spl.id);
|
||||
if (!spl.trigsOnTimer.isEmpty())
|
||||
{
|
||||
doTriggerOnTimer(&spl,&deadIndexes);
|
||||
}
|
||||
if (src.autoControl)
|
||||
{
|
||||
bool badAl = false;
|
||||
@@ -133,6 +138,33 @@ void Splashes::delSplash(int Id)
|
||||
}
|
||||
|
||||
|
||||
void Splashes::doTriggerOnTimer(SplashType *spl, QList<int> *deadIndexes)
|
||||
{
|
||||
for (int k=0; k<spl->trigsOnTimer.size(); k++)
|
||||
{
|
||||
srcTriggerType strig = gameData->players.
|
||||
at(spl->PlayerId)->srcTowers.
|
||||
at(spl->srcTower).triggers.
|
||||
at(spl->trigsOnTimer.at(k).src);
|
||||
spl->trigsOnTimer[k].timer++;
|
||||
if (spl->trigsOnTimer.at(k).timer >= strig.timer)
|
||||
{
|
||||
spl->trigsOnTimer[k].timer = 0;
|
||||
if (strig.delParent) deadIndexes->append(spl->id);
|
||||
if (strig.count > 0 && strig.childId > 0)
|
||||
{
|
||||
for (int j=0; j<strig.count; ++j)
|
||||
{
|
||||
// TODO: randomRadiusPos
|
||||
addSplash(spl->PlayerId,spl->srcTower,strig.childId,
|
||||
spl->pos,spl->destination,-1,spl->TowerId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Splashes::doTriggerOnDest(const SplashType &spl, QList<int> *deadIndexes,
|
||||
bool badAl)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user