diff --git a/base_types.h b/base_types.h index a80a638..934856e 100644 --- a/base_types.h +++ b/base_types.h @@ -34,6 +34,46 @@ struct Tower }; +struct srcTrigger +{ + enum triggerType + { + onDestination, + onTimer, + onAlienInRadius + }; + int childId; // =-1 for non birth splash (e.q. only damage) + bool delParent; + float damage; + float radius; + triggerType type; + unsigned int timer; + int count; + float randomPosRadius; +}; + + +struct srcSplash +{ + QString name; + int imgType; + float speed; // in cells + bool autoControl; + QList triggerIndexes; +}; + +struct srcTower +{ + QString name; + int type; + int PlayerId; // tower's owner + float range; // in cells + float reload; // time for reload in ticks + QList triggers; + QList splashes; +}; + + struct Splash { int Id; diff --git a/data.xml b/data.xml index 6d65cc8..bc78134 100644 --- a/data.xml +++ b/data.xml @@ -1,27 +1,44 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/loader.cpp b/loader.cpp index c4b5bf2..a262b11 100644 --- a/loader.cpp +++ b/loader.cpp @@ -24,10 +24,11 @@ void Loader::load() readMaps(); readLevels(); //readMorphs(); - //readSplashes(); - //readTowers(); + readSplashes(); + readTowers(); + readTriggers(); + //readChains(); //readLevTowers(); - //readTriggers(); readWaves(); readWaveParts(); readLevWaves(); @@ -171,8 +172,9 @@ void Loader::readAliens() al.armor = nm.namedItem("armor").nodeValue().toFloat(); al.imgType = nm.namedItem("imageType").nodeValue().toInt(); al.regeneration = nm.namedItem("regeneration").nodeValue().toFloat(); + al.score = nm.namedItem("score").nodeValue().toInt(); aliens.insert(al.id,al); - qDebug() << tr("Alien %1 id=%2 health=%3 speed=%4 prise=%5 imgType=%6 armor=%7 regeneration=%8").arg(al.name).arg(al.id).arg(al.health).arg(al.speed).arg(al.prise).arg(al.imgType).arg(al.armor).arg(al.regeneration); + qDebug() << tr("Alien %1 id=%2 health=%3 speed=%4 prise=%5 imgType=%6 armor=%7 regeneration=%8 score=%10").arg(al.name).arg(al.id).arg(al.health).arg(al.speed).arg(al.prise).arg(al.imgType).arg(al.armor).arg(al.regeneration).arg(al.score); } qDebug("================"); qDebug() << tr("Found %1 aliens").arg(aliens.size()); @@ -294,6 +296,51 @@ void Loader::readLevels() } +void Loader::readTriggers() +{ + QString str; + QDomNodeList trelems = doc->elementsByTagName("trigger"); + for (int i=0; i1)) trig.chance = 100; + str = nm.namedItem("delParent").nodeValue(); + trig.delParent = (str == "true"); + str = nm.namedItem("type").nodeValue(); + if (str == "onDestination") + trig.type = tbTrigger::onDestination; + if (str == "onTimer") + trig.type = tbTrigger::onTimer; + if (str == "onAlienInRadius") + trig.type = tbTrigger::onAlienInRadius; + str = nm.namedItem("childAim").nodeValue(); + trig.childAim = tbTrigger::noAim; + if (str == "allSide") + trig.childAim = tbTrigger::allSide; + if (str == "parentAim") + trig.childAim = tbTrigger::parentAim; + if (str == "nearlestAlien") + trig.childAim = tbTrigger::nearlestAlien; + triggers.insert(trig.id,trig); + qDebug() << tr("Trigger %1 id=%2 damage=%3 radius=%4 delParent=%5 timer=%6").arg(trig.name).arg(trig.id).arg(trig.damage).arg(trig.radius).arg(trig.delParent).arg(trig.timer) + << tr("count=%1 chance=%2 randomPosRadius=%3 type=%4 childAim=%5").arg(trig.count).arg(trig.chance).arg(trig.randomPosRadius).arg(trig.type).arg(trig.childAim); + } + qDebug("================"); + qDebug() << tr("Found %1 triggers").arg(triggers.size()); + qDebug("================"); +} + + void Loader::readSplashes() { QString str; @@ -301,29 +348,17 @@ void Loader::readSplashes() for (int i=0; ielementsByTagName("tower"); for (int i=0; i aliens; QHash maps; QHash levels; - QHash morphs; QHash splashes; QHash towers; - QHash levTowers; QHash triggers; QHash waves; QMultiHash levWaves; QMultiHash waveParts; + QMultiHash chains; + QMultiHash morphs; + QMultiHash levTowers; void readAliens(); void readMaps(); @@ -152,6 +188,7 @@ private: void readTowers(); void readLevTowers(); void readTriggers(); + void readChains(); void readWaves(); void readLevWaves(); void readWaveParts(); diff --git a/schema.xml b/schema.xml index d484e27..bc491c2 100644 --- a/schema.xml +++ b/schema.xml @@ -1,9 +1,9 @@ - + - + @@ -25,6 +25,13 @@ + + + + + + + @@ -39,20 +46,35 @@ - + - + - + + + + + + + + + + + + + + + + @@ -65,41 +87,49 @@ - - - + - - + - - - + + + - + + + + - + + + + + + + + + + - - - + + @@ -116,10 +146,9 @@ - - + @@ -133,7 +162,7 @@ - + @@ -142,10 +171,9 @@ - - +