fixed few critical bugs

This commit is contained in:
2011-08-20 10:12:16 +04:00
committed by unknown
parent f3d0ca7101
commit fa68b5a120
9 changed files with 1027 additions and 907 deletions

View File

@@ -6,65 +6,65 @@
AD_Graphics::AD_Graphics(AD_Core *adcore, QWidget *parent) : QGraphicsView(parent)
{
data = adcore->addata;
core = adcore;
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
setAlignment(Qt::AlignLeft | Qt::AlignTop);
scene = new QGraphicsScene();
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
core->setScene(scene);
setScene(scene);
//setCacheMode();
//setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
mapimg = new QImage(data->map->rect().size()*cellSize,QImage::Format_ARGB32);
//setDragMode(RubberBandDrag);
QPainter p(mapimg);
for (int i=0; i<data->map->cells().size(); i++) {
for (int j=0; j<data->map->cells().at(i).size(); j++) {
QPen pen;
QBrush brush;
pen.setColor(Qt::white);
brush.setColor(Qt::white);
brush.setStyle(Qt::SolidPattern);
int cel = data->map->cells().at(i).at(j);
if (cel == Map::Wall)
{
pen.setColor(Qt::black);
brush.setColor(Qt::black);
}
if (cel >= Map::Free || (cel <= Map::PlayerTower && cel !=Map::Wall))
{
pen.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,150));
brush.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,80));
}
p.setPen(pen);
p.setBrush(brush);
p.drawRect(i*cellSize,j*cellSize,cellSize,cellSize);
}
}
p.end();
scene->setSceneRect(mapimg->rect());
data = adcore->addata;
core = adcore;
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
setAlignment(Qt::AlignLeft | Qt::AlignTop);
scene = new QGraphicsScene();
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
core->setScene(scene);
setScene(scene);
//setCacheMode();
//setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
mapimg = new QImage(data->map->rect().size()*cellSize,QImage::Format_ARGB32);
//setDragMode(RubberBandDrag);
QPainter p(mapimg);
for (int i=0; i<data->map->cells().size(); i++) {
for (int j=0; j<data->map->cells().at(i).size(); j++) {
QPen pen;
QBrush brush;
pen.setColor(Qt::white);
brush.setColor(Qt::white);
brush.setStyle(Qt::SolidPattern);
int cel = data->map->cells().at(i).at(j);
if (cel == Map::Wall)
{
pen.setColor(Qt::black);
brush.setColor(Qt::black);
}
if (cel >= Map::Free || (cel <= Map::PlayerTower && cel !=Map::Wall))
{
pen.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,150));
brush.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,80));
}
p.setPen(pen);
p.setBrush(brush);
p.drawRect(i*cellSize,j*cellSize,cellSize,cellSize);
}
}
p.end();
scene->setSceneRect(mapimg->rect());
scene->setBackgroundBrush(*mapimg);
setCacheMode(QGraphicsView::CacheBackground);
setCacheMode(QGraphicsView::CacheBackground);
resize(mapimg->size());
// startTimer(50);
startTimer(50);
}
AD_Graphics::~AD_Graphics()
{
delete scene;
delete scene;
}
void AD_Graphics::mousePressEvent(QMouseEvent *event)
{
scene->clearSelection();
if (event->button() == Qt::LeftButton)
{
scene->clearSelection();
if (event->button() == Qt::LeftButton)
{
if (m_building) emit add_tow((QPointF(event->pos())/cellSize).toPoint());
else
{
else
{
QList<QGraphicsItem*> list = scene->items(event->pos(), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder);
ADItem * al = 0;
foreach(QGraphicsItem* x, list)
@@ -87,17 +87,18 @@ void AD_Graphics::mousePressEvent(QMouseEvent *event)
emit alien_select(al->id());
return;
}
}
}
if (event->button() == Qt::RightButton)
emit cancel();
}
}
if (event->button() == Qt::RightButton)
emit cancel();
}
//void AD_Graphics::timerEvent(QTimerEvent * )
//{
// scene->update();
//}
void AD_Graphics::timerEvent(QTimerEvent * )
{
if (!core->isWaveEnd())
scene->update();
}
void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
@@ -108,16 +109,16 @@ void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
void AD_Graphics::drawForeground(QPainter *p, const QRectF &rect)
{
QList <QGraphicsItem *> l = scene->items();
foreach(QGraphicsItem * g,l)
{
ADItem * i = qgraphicsitem_cast<ADItem *>(g);
if (i->isBarVisible())
{
p->setPen(Qt::black);
p->setBrush(QBrush(QColor(qRound(255*(1-i->value())),qRound(255*i->value()),0)));
p->drawRect(i->pos().x()-cellSize,i->pos().y()-cellSize*1.25,cellSize*2*i->value(),cellSize/4);
}
}
QList <QGraphicsItem *> l = scene->items();
foreach(QGraphicsItem * g,l)
{
ADItem * i = qgraphicsitem_cast<ADItem *>(g);
if (i->isBarVisible())
{
p->setPen(Qt::black);
p->setBrush(QBrush(QColor(qRound(255*(1-i->value())),qRound(255*i->value()),0)));
p->drawRect(i->pos().x()-cellSize,i->pos().y()-cellSize*1.25,cellSize*2*i->value(),cellSize/4);
}
}
}

View File

@@ -10,44 +10,44 @@
class AD_Graphics: public QGraphicsView
{
Q_OBJECT
Q_PROPERTY(bool building READ building WRITE setBuilding)
Q_OBJECT
Q_PROPERTY(bool building READ building WRITE setBuilding)
public:
explicit AD_Graphics(AD_Core * core, QWidget * parent = 0);
~AD_Graphics();
explicit AD_Graphics(AD_Core * core, QWidget * parent = 0);
~AD_Graphics();
bool building() const
{
return m_building;
}
bool building() const
{
return m_building;
}
public slots:
void setBuilding(bool arg)
{
m_building = arg;
}
void setBuilding(bool arg)
{
m_building = arg;
}
private:
void drawBackground(QPainter * p, const QRectF &);
void drawForeground(QPainter *painter, const QRectF &rect);
void mousePressEvent(QMouseEvent *event);
void drawForeground(QPainter *painter, const QRectF &rect);
void mousePressEvent(QMouseEvent *event);
QGraphicsScene * scene;
AD_Core * core;
QImage * mapimg;
Game_Data * data;
QGraphicsScene * scene;
AD_Core * core;
QImage * mapimg;
Game_Data * data;
bool m_building;
bool m_building;
private slots:
protected:
// void timerEvent(QTimerEvent * );
void timerEvent(QTimerEvent * );
signals:
void cancel();
void add_tow(QPoint pnt);
void cancel();
void add_tow(QPoint pnt);
void tower_select(QPoint id);
void alien_select(int id);
};

View File

@@ -1,93 +1,94 @@
#include "adcore.h"
AD_Core::AD_Core(QObject *parent) :
QThread(parent)
QThread(parent)
{
step = 0;
Loader * adloader = new Loader();
adloader->load("data2.xml");
addata = adloader->loadlevel(1);
delete adloader;
if (addata != 0) qDebug("Sucsess");
else qFatal("Error");
adtowers = new Towers(addata);
adsplashes = new Splashes(addata);
connect(addata->map,SIGNAL(recreateAlienPath(bool*)),addata->aliens,SLOT(retrace(bool*)));
connect(adtowers,SIGNAL(shot(TowerType)),adsplashes,SLOT(addSplash(TowerType)));
connect(adsplashes,SIGNAL(killAlien(int,int)),this,SLOT(killAlien(int,int)));
waveInProgress = false;
waveEnd = false;
step = 0;
Loader * adloader = new Loader();
adloader->load("data2.xml");
addata = adloader->loadlevel(1);
delete adloader;
if (addata != 0) qDebug("Sucsess");
else qFatal("Error");
adtowers = new Towers(addata);
adsplashes = new Splashes(addata);
connect(addata->map,SIGNAL(recreateAlienPath(bool*)),addata->aliens,SLOT(retrace(bool*)));
connect(adtowers,SIGNAL(shot(TowerType)),adsplashes,SLOT(addSplash(TowerType)));
connect(adsplashes,SIGNAL(killAlien(int,int)),this,SLOT(killAlien(int,int)));
waveInProgress = false;
waveEnd = false;
startTimer(50);
}
void AD_Core::next()
{
adtowers->update();
adsplashes->update();
addata->aliens->update();
waveProcessing();
step++;
adtowers->update();
adsplashes->update();
addata->aliens->update();
waveProcessing();
step++;
}
void AD_Core::timerEvent(QTimerEvent * )
{
next();
next();
}
void AD_Core::nextWave()
{
if (waveInProgress) return;
if (addata->curWave >= addata->waves.size()) {
qDebug("level finished");
waveEnd = false;
return;
}
//wavetime = addata->waves.at(addata->curWave).timeout;
qDebug() << tr("Next wave %1").arg(addata->curWave+1);
wavetime = 0;
waveInProgress = true;
if (waveInProgress) return;
if (addata->curWave >= addata->waves.size()) {
qDebug("level finished");
waveEnd = false;
return;
}
//wavetime = addata->waves.at(addata->curWave).timeout;
qDebug() << tr("Next wave %1").arg(addata->curWave+1);
wavetime = 0;
waveInProgress = true;
}
void AD_Core::waveProcessing()
{
if (addata->aliens->curAliens.isEmpty() && waveEnd)
{
addata->players.at(0)->money += addata->waves.at(addata->curWave-1).prise;
waveEnd = false;
}
if (!waveInProgress) return;
if (wavetime <= 0) {
for (int i=0; i<addata->waves.at(addata->curWave).counts.size(); i++) {
if (addata->waves.at(addata->curWave).counts.at(i) > 0) {
addata->aliens->addAlien(addata->waves.at(addata->curWave).types.at(i));
addata->waves[addata->curWave].counts[i]--;
wavetime = addata->waves.at(addata->curWave).timeout;
waveEnd = true;
return;
}
}
addata->curWave++;
waveInProgress = false;
} else {
wavetime--;
}
/// FIXME : resolve problem with prise for finish wave, it is calculated wrong!
if (addata->aliens->curAliens.isEmpty() && waveEnd)
{
if(addata->curWave > 0) addata->players.at(0)->money += addata->waves.at(addata->curWave-1).prise;
waveEnd = false;
}
if (!waveInProgress) return;
if (wavetime <= 0) {
for (int i=0; i<addata->waves.at(addata->curWave).counts.size(); i++) {
if (addata->waves.at(addata->curWave).counts.at(i) > 0) {
addata->aliens->addAlien(addata->waves.at(addata->curWave).types.at(i));
addata->waves[addata->curWave].counts[i]--;
wavetime = addata->waves.at(addata->curWave).timeout;
waveEnd = true;
return;
}
}
addata->curWave++;
waveInProgress = false;
} else {
wavetime--;
}
}
void AD_Core::killAlien(int playerId, int alienId)
{
addata->players.at(playerId)->money += addata->aliens->curAliens[alienId].src->prise;
addata->aliens->delAlien(alienId);
addata->players.at(playerId)->money += addata->aliens->curAliens[alienId].src->prise;
addata->aliens->delAlien(alienId);
}
void AD_Core::setScene(QGraphicsScene *scene)
{
addata->aliens->setScene(scene);
adtowers->setScene(scene);
adsplashes->setScene(scene);
addata->aliens->setScene(scene);
adtowers->setScene(scene);
adsplashes->setScene(scene);
}

View File

@@ -12,28 +12,29 @@ class AD_Core : public QThread
{
Q_OBJECT
public:
explicit AD_Core(QObject *parent = 0);
Game_Data * addata;
Towers * adtowers;
Splashes * adsplashes;
long int step;
explicit AD_Core(QObject *parent = 0);
Game_Data * addata;
Towers * adtowers;
Splashes * adsplashes;
long int step;
void setScene(QGraphicsScene * scene);
void setScene(QGraphicsScene * scene);
bool isWaveEnd() {return waveEnd;}
public slots:
void next();
void nextWave();
void next();
void nextWave();
private:
void timerEvent(QTimerEvent * );
void waveProcessing();
void timerEvent(QTimerEvent * );
void waveProcessing();
bool waveInProgress;
bool waveEnd;
int wavetime;
bool waveInProgress;
bool waveEnd;
int wavetime;
private slots:
void killAlien(int playerId, int alienId);
void killAlien(int playerId, int alienId);
signals:
};

View File

@@ -1,4 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by Qt Creator 2.2.84, 2011-08-20T10:11:41. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -7,166 +9,280 @@
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value key="EditorConfiguration.AutoIndent" type="bool">true</value>
<value key="EditorConfiguration.AutoSpacesForTabs" type="bool">false</value>
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
<value key="EditorConfiguration.DoubleIndentBlocks" type="bool">false</value>
<value key="EditorConfiguration.IndentBraces" type="bool">false</value>
<value key="EditorConfiguration.IndentSize" type="int">4</value>
<value key="EditorConfiguration.MouseNavigation" type="bool">true</value>
<value key="EditorConfiguration.PaddingMode" type="int">1</value>
<value key="EditorConfiguration.ScrollWheelZooming" type="bool">true</value>
<value key="EditorConfiguration.SmartBackspace" type="bool">false</value>
<value key="EditorConfiguration.SpacesForTabs" type="bool">false</value>
<value key="EditorConfiguration.TabKeyBehavior" type="int">0</value>
<value key="EditorConfiguration.TabSize" type="int">4</value>
<value key="EditorConfiguration.UseGlobal" type="bool">true</value>
<value key="EditorConfiguration.Utf8BomBehavior" type="int">1</value>
<value key="EditorConfiguration.addFinalNewLine" type="bool">true</value>
<value key="EditorConfiguration.cleanIndentation" type="bool">true</value>
<value key="EditorConfiguration.cleanWhitespace" type="bool">true</value>
<value key="EditorConfiguration.inEntireDocument" type="bool">false</value>
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="bool" key="AlignAssignments">true</value>
<value type="QString" key="CurrentFallback">CppProject</value>
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">false</value>
<value type="bool" key="IndentAccessSpecifiers">false</value>
<value type="bool" key="IndentBlockBody">true</value>
<value type="bool" key="IndentBlockBraces">false</value>
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentClassBraces">false</value>
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">false</value>
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
<value type="bool" key="IndentEnumBraces">false</value>
<value type="bool" key="IndentFunctionBody">true</value>
<value type="bool" key="IndentFunctionBraces">false</value>
<value type="bool" key="IndentNamespaceBody">false</value>
<value type="bool" key="IndentNamespaceBraces">false</value>
<value type="bool" key="IndentStatementsRelativeToSwitchLabels">true</value>
<value type="bool" key="IndentSwitchLabels">false</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">1</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="QString" key="EditorConfiguration.CurrentFallback">Project</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.SmartBackspace">false</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.Tab.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="bool" key="AutoIndent">true</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="QString" key="CurrentFallback">CppGlobal</value>
<value type="int" key="IndentSize">4</value>
<value type="int" key="PaddingMode">1</value>
<value type="bool" key="SmartBackspace">false</value>
<value type="bool" key="SpacesForTabs">true</value>
<value type="int" key="TabKeyBehavior">0</value>
<value type="int" key="TabSize">8</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.Tab.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="bool" key="AutoIndent">true</value>
<value type="bool" key="AutoSpacesForTabs">false</value>
<value type="QString" key="CurrentFallback">QmlJSGlobal</value>
<value type="int" key="IndentSize">4</value>
<value type="int" key="PaddingMode">1</value>
<value type="bool" key="SmartBackspace">false</value>
<value type="bool" key="SpacesForTabs">true</value>
<value type="int" key="TabKeyBehavior">0</value>
<value type="int" key="TabSize">8</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.Tab.Count">2</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">4</value>
<value type="bool" key="EditorConfiguration.UseGlobal">false</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">true</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveDeployConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Mingw:D:/Qt/2010.04/mingw/bin/g++.exe.x86-windows-msys-pe-32bit.C:/Qt/qtcreator-2.2.0/pythongdb/gdb-i686-pc-mingw32.exe</value>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">ProjectExplorer.ToolChain.Mingw:D:/Qt/qtcreator-2.2.84/mingw/bin/gcc.exe.x86-windows-msys-pe-32bit.D:/Qt/qtcreator-2.2.84/pythongdb/gdb-i686-pc-mingw32.exe</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">7</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Mingw:D:/Qt/2010.04/mingw/bin/g++.exe.x86-windows-msys-pe-32bit.C:/Qt/qtcreator-2.2.0/pythongdb/gdb-i686-pc-mingw32.exe</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">7</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Mingw:C:/Qt/qtcreator-2.2.0/mingw/bin/gcc.exe.x86-windows-msys-pe-32bit.C:/Qt/qtcreator-2.2.0/pythongdb/gdb-i686-pc-mingw32.exe</value>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Release</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Mingw:C:/Qt/qtcreator-2.2.0/mingw/bin/gcc.exe.x86-windows-msys-pe-32bit.C:/Qt/qtcreator-2.2.0/pythongdb/gdb-i686-pc-mingw32.exe</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">-1</value>
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.DeployConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">0</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Установка</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Deploy</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Deploy</value>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Установка</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Без установки</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Без установки</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.DefaultDeployConfiguration</value>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Без установки</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Без установки</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value key="ProjectExplorer.Target.DeployConfigurationCount" type="int">1</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Конфигурация запуска Qt4</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">aliendefender</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QString"></value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">aliendefender.pro</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
<value key="RunConfiguration.QmlDebugServerPort" type="uint">3768</value>
<value key="RunConfiguration.UseCppDebugger" type="bool">true</value>
<value key="RunConfiguration.UseQmlDebugger" type="bool">false</value>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Конфигурация запуска Qt4</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">aliendefender</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration</value>
<value type="int" key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase">2</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">aliendefender.pro</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
<valuelist type="QVariantList" key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges"/>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">false</value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
@@ -175,10 +291,10 @@
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QString">{00000000-0000-0000-0000-000000000000}</value>
<value type="QString">{6c550070-c96c-41ad-865e-c5b9b5c3b79f}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">9</value>
<value type="int">10</value>
</data>
</qtcreator>

View File

@@ -4,67 +4,67 @@
Aliens::Aliens(Map * map_, QObject *parent) :
QObject(parent)
{
map = map_;
nextId = 1;
m_missingAliens = 0;
map = map_;
nextId = 1;
m_missingAliens = 0;
}
void Aliens::addAlien(int srcId)
{
if (srcId < 0 || srcId >= srcAliens.size())
{
qCritical("ERROR out of aliens range");
return;
}
if (srcId < 0 || srcId >= srcAliens.size())
{
qCritical("ERROR out of aliens range");
return;
}
AlienType al;
al.id = nextId;
al.src = &(srcAliens[srcId]);
al.finish = map->finishs().at(qrand()%map->finishs().size());
al.pos = QPointF(map->starts().at(qrand()%map->starts().size()));
al.path = map->createPath(al.pos.toPoint(),al.finish);
al.pathIndex = 1;
al.angle = 180.0f*(- std::atan2( al.pos.x() - al.path.at(al.pathIndex).x(),al.pos.y() - al.path.at(al.pathIndex).y()))/M_PI;
if (al.path.isEmpty())
{
qCritical("ERROR create path");
return; // FIXME: this
}
//qDebug() << al.path;
al.health = al.src->health;
al.speed = al.src->speed;
al.item = new ADItem(al.id,ADItem::Alien,al.src->images,QRectF(-cellSize,-cellSize,cellSize*2,cellSize*2));
al.item->setPos(al.pos*cellSize+QPointF(cellSize/2,cellSize/2));
al.item->setRotation(al.angle);
curAliens.insert(al.id,al);
scene->addItem(al.item);
nextId++;
al.id = nextId;
al.src = &(srcAliens[srcId]);
al.finish = map->finishs().at(qrand()%map->finishs().size());
al.pos = QPointF(map->starts().at(qrand()%map->starts().size()));
al.path = map->createPath(al.pos.toPoint(),al.finish);
al.pathIndex = 1;
al.angle = 180.0f*(- std::atan2( al.pos.x() - al.path.at(al.pathIndex).x(),al.pos.y() - al.path.at(al.pathIndex).y()))/M_PI;
if (al.path.isEmpty())
{
qCritical("ERROR create path");
return; // FIXME: this
}
//qDebug() << al.path;
al.health = al.src->health;
al.speed = al.src->speed;
al.item = new ADItem(al.id,ADItem::Alien,al.src->images,QRectF(-cellSize,-cellSize,cellSize*2,cellSize*2));
al.item->setPos(al.pos*cellSize+QPointF(cellSize/2,cellSize/2));
al.item->setRotation(al.angle);
curAliens.insert(al.id,al);
scene->addItem(al.item);
nextId++;
}
void Aliens::retrace(bool * OK)
{
map->removeAliensPath();
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
{
i->path = map->createPath(i->pos.toPoint(),i->finish);
i->pathIndex = 1;
if (i->path.isEmpty())
{
*OK = false;
qDebug("Aliens retrace = false");
}
}
map->removeAliensPath();
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
{
i->path = map->createPath(i->pos.toPoint(),i->finish);
i->pathIndex = 1;
if (i->path.isEmpty())
{
*OK = false;
qDebug("Aliens retrace = false");
}
}
}
void Aliens::delAlien(int id, bool missed)
{
if (missed)
{
m_missingAliens++;
qDebug() << tr("Missing aliens = %1!").arg(m_missingAliens);
}
if (missed)
{
m_missingAliens++;
qDebug() << tr("Missing aliens = %1!").arg(m_missingAliens);
}
scene->removeItem(curAliens[id].item);
delete curAliens[id].item;
curAliens.remove(id);
@@ -73,37 +73,37 @@ void Aliens::delAlien(int id, bool missed)
void Aliens::update()
{
QList <int> missIndex;
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
{
float angl,arctg = 0;
int curMiss = -1;
while (distance2(i->pos, i->path.at(i->pathIndex)) < i->speed * i->speed)
{
i->pathIndex++;
if (i->pathIndex >= i->path.size())
{
missIndex.push_back(i->id);
curMiss = i->id;
break;
}
}
if (curMiss < 0)
{
// TODO: smooth rotate (how???)
arctg = std::atan2(i->pos.x() - i->path.at(i->pathIndex).x(),i->pos.y() - i->path.at(i->pathIndex).y());
angl = 180.0f*(-arctg)/M_PI;
i->angle = angl;
i->pos.rx() -= i->speed*std::sin(arctg);
i->pos.ry() -= i->speed*std::cos(arctg);
}
i->item->setPos(i->pos*cellSize+QPointF(cellSize/2,cellSize/2));
i->item->setRotation(i->angle);
i->item->setBarValue(i->health/i->src->health);
i->item->next(i->speed*cellSize);
}
for (int j=0; j<missIndex.size(); j++)
{
delAlien(missIndex.at(j),true);
}
QList <int> missIndex;
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
{
float angl,arctg = 0;
int curMiss = -1;
while (distance2(i->pos, i->path.at(i->pathIndex)) < i->speed * i->speed)
{
i->pathIndex++;
if (i->pathIndex >= i->path.size())
{
missIndex.push_back(i->id);
curMiss = i->id;
break;
}
}
if (curMiss < 0)
{
// TODO: smooth rotate (how???)
arctg = std::atan2(i->pos.x() - i->path.at(i->pathIndex).x(),i->pos.y() - i->path.at(i->pathIndex).y());
angl = 180.0f*(-arctg)/M_PI;
i->angle = angl;
i->pos.rx() -= i->speed*std::sin(arctg);
i->pos.ry() -= i->speed*std::cos(arctg);
}
i->item->setPos(i->pos*cellSize+QPointF(cellSize/2,cellSize/2));
i->item->setRotation(i->angle);
i->item->setBarValue(i->health/i->src->health);
i->item->next(i->speed*cellSize);
}
for (int j=0; j<missIndex.size(); j++)
{
delAlien(missIndex.at(j),true);
}
}

636
map.cpp
View File

@@ -1,382 +1,382 @@
#include "map.h"
Map::Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, QObject *parent) :
QObject(parent)
QObject(parent)
{
QByteArray ba = QByteArray::fromBase64(data);
ba = qUncompress(ba);
QDataStream s(ba);
mapName = name;
s >> Cells;
int chei;
if (Cells.size() <= 0)
qFatal("Map has invalid width");
if (Cells.size() != size.width())
qCritical("Map has wrong width");
mapSize.setWidth(Cells.size());
chei = Cells.at(0).size();
for (int i=0; i<Cells.size(); i++)
{
if (Cells[i].size() <= 0)
qFatal("Map has invalid height");
if (Cells[i].size() != size.height())
{
qCritical("Map has wrong height");
if (Cells[i].size() != chei)
qFatal("Corrupted map data");
}
for (int j=0; j<Cells[i].size(); j++)
{
if (Cells[i][j]==Start) Starts.push_back(QPoint(i,j));
if (Cells[i][j]==Finish) Finishs.push_back(QPoint(i,j));
}
}
mapSize.setHeight(chei);
if (Starts.isEmpty() || Finishs.isEmpty()) qFatal("invalid map, not found start/finish");
// TODO: check for maxPlayers
players = maxPlayers;
imageType = image;
QByteArray ba = QByteArray::fromBase64(data);
ba = qUncompress(ba);
QDataStream s(ba);
mapName = name;
s >> Cells;
int chei;
if (Cells.size() <= 0)
qFatal("Map has invalid width");
if (Cells.size() != size.width())
qCritical("Map has wrong width");
mapSize.setWidth(Cells.size());
chei = Cells.at(0).size();
for (int i=0; i<Cells.size(); i++)
{
if (Cells[i].size() <= 0)
qFatal("Map has invalid height");
if (Cells[i].size() != size.height())
{
qCritical("Map has wrong height");
if (Cells[i].size() != chei)
qFatal("Corrupted map data");
}
for (int j=0; j<Cells[i].size(); j++)
{
if (Cells[i][j]==Start) Starts.push_back(QPoint(i,j));
if (Cells[i][j]==Finish) Finishs.push_back(QPoint(i,j));
}
}
mapSize.setHeight(chei);
if (Starts.isEmpty() || Finishs.isEmpty()) qFatal("invalid map, not found start/finish");
// TODO: check for maxPlayers
players = maxPlayers;
imageType = image;
}
void Map::printMap()
{
for (int i=0; i<Cells.size(); i++) qDebug()<<Cells.at(i);
for (int i=0; i<Cells.size(); i++) qDebug()<<Cells.at(i);
}
void Map::removeAliensPath()
{
for (int i=0; i<Cells.size(); i++)
{
for (int j=0; j<Cells[i].size(); j++)
{
if (Cells[i][j] > 1000 && Cells[i][j] < 2000) Cells[i][j]=Cells[i][j]-1000;
}
}
for (int i=0; i<Cells.size(); i++)
{
for (int j=0; j<Cells[i].size(); j++)
{
if (Cells[i][j] > 1000 && Cells[i][j] < 2000) Cells[i][j]=Cells[i][j]-1000;
}
}
}
void Map::delTowerOnMap(int playerId, QPoint pos)
{
Cells[pos.x()][pos.y()]=Player+playerId;
Cells[pos.x()][pos.y()]=Player+playerId;
Cells[pos.x()-1][pos.y()]=Player+playerId;
Cells[pos.x()][pos.y()-1]=Player+playerId;
Cells[pos.x()-1][pos.y()-1]=Player+playerId;
emit recreateAlienPath(new bool());
emit recreateAlienPath(new bool());
}
bool Map::isReachable(int playerId, QPoint pos)
{
Cells[pos.x()][pos.y()]=PlayerTower-Player-playerId;
Cells[pos.x()][pos.y()]=PlayerTower-Player-playerId;
Cells[pos.x()-1][pos.y()]=PlayerTower-Player-playerId;
Cells[pos.x()][pos.y()-1]=PlayerTower-Player-playerId;
Cells[pos.x()-1][pos.y()-1]=PlayerTower-Player-playerId;
for (int i=0; i<Starts.size(); i++) {
for (int j=0; j<Finishs.size(); j++) {
if (waveTrace(Starts.at(i),Finishs.at(j))<0) {
Cells[pos.x()][pos.y()]=Player+playerId;
for (int i=0; i<Starts.size(); i++) {
for (int j=0; j<Finishs.size(); j++) {
if (waveTrace(Starts.at(i),Finishs.at(j))<0) {
Cells[pos.x()][pos.y()]=Player+playerId;
Cells[pos.x()-1][pos.y()]=Player+playerId;
Cells[pos.x()][pos.y()-1]=Player+playerId;
Cells[pos.x()-1][pos.y()-1]=Player+playerId;
return false;
}
}
}
return true;
return false;
}
}
}
return true;
}
bool Map::addTowerOnMap(int playerId, QPoint pos)
{
if (playerId < 0 || playerId > players) return false;
QRect r(QPoint(),mapSize);
if (!r.contains(pos) ||
if (playerId < 0 || playerId > players) return false;
QRect r(QPoint(),mapSize);
if (!r.contains(pos) ||
!r.contains(pos-QPoint(1,0)) ||
!r.contains(pos-QPoint(0,1)) ||
!r.contains(pos-QPoint(1,1))) return false;
if (Cells[pos.x()][pos.y()]==Player+playerId &&
if (Cells[pos.x()][pos.y()]==Player+playerId &&
Cells[pos.x()-1][pos.y()]==Player+playerId &&
Cells[pos.x()][pos.y()-1]==Player+playerId &&
Cells[pos.x()-1][pos.y()-1]==Player+playerId)
return isReachable(playerId,pos);
if ((Cells[pos.x()][pos.y()]==AlienPath+Player+playerId || Cells[pos.x()][pos.y()]==Player+playerId) &&
return isReachable(playerId,pos);
if ((Cells[pos.x()][pos.y()]==AlienPath+Player+playerId || Cells[pos.x()][pos.y()]==Player+playerId) &&
(Cells[pos.x()-1][pos.y()]==AlienPath+Player+playerId || Cells[pos.x()-1][pos.y()]==Player+playerId) &&
(Cells[pos.x()][pos.y()-1]==AlienPath+Player+playerId || Cells[pos.x()][pos.y()-1]==Player+playerId) &&
(Cells[pos.x()-1][pos.y()-1]==AlienPath+Player+playerId || Cells[pos.x()-1][pos.y()-1]==Player+playerId))
{
if (!isReachable(playerId,pos)) return false;
bool * pathOK;
pathOK = new bool(true);
emit recreateAlienPath(pathOK);
qDebug() << *pathOK;
if (*pathOK)
return true;
else
delTowerOnMap(playerId,pos);
}
qDebug()<<"Dont buid here" << pos;
return false;
{
if (!isReachable(playerId,pos)) return false;
bool * pathOK;
pathOK = new bool(true);
emit recreateAlienPath(pathOK);
// qDebug() << *pathOK;
if (*pathOK)
return true;
else
delTowerOnMap(playerId,pos);
}
qWarning("Dont buid here");
return false;
}
QVector<QPointF> Map::createPath(QPoint start, QPoint finish)
{
QPointF tp;
QVector<QPoint> srcPath;
QVector<QPointF> tmpPath;
QVector<QPointF> path;
if (Cells[start.x()][start.y()] < 0)
{
qDebug("ERROR invalid start");
return path;
}
if (Cells[finish.x()][finish.y()] < 0)
{
qDebug("ERROR invalid finish");
return path;
}
srcPath = invWaveTrace(finish,waveTrace(start,finish));
for (int i=0; i<srcPath.size();i++)
{
int x = Cells.at(srcPath.at(i).x()).at(srcPath.at(i).y());
if (x > 0 && x < 1000) x = x+1000;
Cells[srcPath.at(i).x()][srcPath.at(i).y()] = x;
tmpPath.push_back(QPointF(srcPath.at(i)));
}
srcPath.clear();
if (!tmpPath.isEmpty())
{
for (int j=0; j<4; j++)
{
path.clear();
tp = tmpPath.at(0);
path.push_back(tp);
for (int i = 0; i < tmpPath.size() - 1; i++)
{
tp.setX((tmpPath.at(i).x() + tmpPath.at(i + 1).x()) / 2.0);
tp.setY((tmpPath.at(i).y() + tmpPath.at(i + 1).y()) / 2.0);
path.push_back(tp);
}
tp = tmpPath.at(tmpPath.size() - 1);
path.push_back(tp);
tmpPath = path;
}
tmpPath.clear();
if (path.size() >= 6)
{
path.remove(1);
path.remove(1);
path.remove(path.size()-2);
path.remove(path.size()-2);
}
return path;
}
path.clear();
return path;
QPointF tp;
QVector<QPoint> srcPath;
QVector<QPointF> tmpPath;
QVector<QPointF> path;
if (Cells[start.x()][start.y()] < 0)
{
qCritical("ERROR invalid start");
return path;
}
if (Cells[finish.x()][finish.y()] < 0)
{
qCritical("ERROR invalid finish");
return path;
}
srcPath = invWaveTrace(finish,waveTrace(start,finish));
for (int i=0; i<srcPath.size();i++)
{
int x = Cells.at(srcPath.at(i).x()).at(srcPath.at(i).y());
if (x > 0 && x < 1000) x = x+1000;
Cells[srcPath.at(i).x()][srcPath.at(i).y()] = x;
tmpPath.push_back(QPointF(srcPath.at(i)));
}
srcPath.clear();
if (!tmpPath.isEmpty())
{
for (int j=0; j<4; j++)
{
path.clear();
tp = tmpPath.at(0);
path.push_back(tp);
for (int i = 0; i < tmpPath.size() - 1; i++)
{
tp.setX((tmpPath.at(i).x() + tmpPath.at(i + 1).x()) / 2.0);
tp.setY((tmpPath.at(i).y() + tmpPath.at(i + 1).y()) / 2.0);
path.push_back(tp);
}
tp = tmpPath.at(tmpPath.size() - 1);
path.push_back(tp);
tmpPath = path;
}
tmpPath.clear();
if (path.size() >= 6)
{
path.remove(1);
path.remove(1);
path.remove(path.size()-2);
path.remove(path.size()-2);
}
return path;
}
path.clear();
return path;
}
int Map::waveTrace(QPoint start, QPoint finish)
{
bool stop = false;
int step = 2;
QPoint cp, tp;
QRect fr(QPoint(), mapSize);
QVector<QPoint> tmpp, curp;
TmpCells << Cells;
for (int i = 0; i < Cells.size(); i++)
{
for (int j = 0; j < Cells.at(i).size(); j++)
{
if (Cells[i][j] < 0 ) TmpCells[i][j] = -1;
else TmpCells[i][j] = 0;
}
}
cp = start;
curp.push_back(cp);
TmpCells[cp.x()][cp.y()] = 1;
//qDebug() << "trace";
while (!stop) {
tmpp = curp;
curp.clear();
stop = true;
for (int i = 0; i < tmpp.size(); i++) {
cp = tmpp.at(i);
if (cp == finish) {
TmpCells[cp.x()][cp.y()] = step;
//qDebug() << "trace done!";
return step;
}
tp.setX(cp.x() - 1);
tp.setY(cp.y());
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
tp.setX(cp.x() + 1);
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
tp.setX(cp.x());
tp.setY(cp.y() - 1);
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
tp.setY(cp.y() + 1);
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
}
step++;
}
qDebug() << "trace false";
return -1;
bool stop = false;
int step = 2;
QPoint cp, tp;
QRect fr(QPoint(), mapSize);
QVector<QPoint> tmpp, curp;
TmpCells << Cells;
for (int i = 0; i < Cells.size(); i++)
{
for (int j = 0; j < Cells.at(i).size(); j++)
{
if (Cells[i][j] < 0 ) TmpCells[i][j] = -1;
else TmpCells[i][j] = 0;
}
}
cp = start;
curp.push_back(cp);
TmpCells[cp.x()][cp.y()] = 1;
//qDebug() << "trace";
while (!stop) {
tmpp = curp;
curp.clear();
stop = true;
for (int i = 0; i < tmpp.size(); i++) {
cp = tmpp.at(i);
if (cp == finish) {
TmpCells[cp.x()][cp.y()] = step;
//qDebug() << "trace done!";
return step;
}
tp.setX(cp.x() - 1);
tp.setY(cp.y());
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
tp.setX(cp.x() + 1);
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
tp.setX(cp.x());
tp.setY(cp.y() - 1);
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
tp.setY(cp.y() + 1);
if (fr.contains(tp)) {
if (TmpCells[tp.x()][tp.y()] == 0) {
TmpCells[tp.x()][tp.y()] = step;
curp.push_back(tp);
stop = false;
}
}
}
step++;
}
qDebug() << "trace false";
return -1;
}
QVector<QPoint> Map::invWaveTrace(QPoint finish, int cnt)
{
QPoint wp, Ppnt;
QVector<QPoint> alpath;
if (cnt < 2) return alpath;
int Ind, c, xpp, ypp, xnn, ynn;
unsigned char chk;
Ppnt = wp = finish;
xnn=0;
xpp=0;
ynn=0;
ypp=0;
cnt--;
alpath.push_front(Ppnt);
while (cnt > 1)
{
cnt--;
chk = 0;
Ind = 0;
c = 0;
if (wp.x() - 1 >= 0 && TmpCells[wp.x()-1][wp.y()] == cnt)
{
chk = chk | 0x01;
c++;
}
if (wp.x() + 1 < mapSize.width() && TmpCells[wp.x()+1][wp.y()] == cnt)
{
chk = chk | 0x02;
c++;
}
if (wp.y() - 1 >= 0 && TmpCells[wp.x()][wp.y()-1] == cnt)
{
chk = chk | 0x04;
c++;
}
if (wp.y() + 1 < mapSize.height() && TmpCells[wp.x()][wp.y()+1] == cnt)
{
chk = chk | 0x08;
c++;
}
if (c == 0 || chk == 0) qDebug("ERROR in InvWaveTrace"),exit(-1);
if (c > 1)
{
if ((chk & 0x01)==0x01 && (chk & 0x04)==0x04)
{
if (xnn <= ynn && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ynn) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x04)==0x04)
{
if (xpp <= ynn && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ynn) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x01)==0x01 && (chk & 0x08)==0x08)
{
if (xnn <= ypp && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ypp) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x08)==0x08)
{
if (xpp <= ypp && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ypp) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
}
if (c == 1 || Ind == 0)
{
xnn=0;
xpp=0;
ynn=0;
ypp=0;
if ((chk & 0x01)==0x01) {
wp.rx()--;
xnn++;
}
else if ((chk & 0x02)==0x02) {
wp.rx()++;
xpp++;
}
else if ((chk & 0x04)==0x04) {
wp.ry()--;
ynn++;
}
else if ((chk & 0x08)==0x08) {
wp.ry()++;
ypp++;
}
}
Ppnt = wp;
alpath.push_front(Ppnt);
}
return alpath;
QPoint wp, Ppnt;
QVector<QPoint> alpath;
if (cnt < 2) return alpath;
int Ind, c, xpp, ypp, xnn, ynn;
unsigned char chk;
Ppnt = wp = finish;
xnn=0;
xpp=0;
ynn=0;
ypp=0;
cnt--;
alpath.push_front(Ppnt);
while (cnt > 1)
{
cnt--;
chk = 0;
Ind = 0;
c = 0;
if (wp.x() - 1 >= 0 && TmpCells[wp.x()-1][wp.y()] == cnt)
{
chk = chk | 0x01;
c++;
}
if (wp.x() + 1 < mapSize.width() && TmpCells[wp.x()+1][wp.y()] == cnt)
{
chk = chk | 0x02;
c++;
}
if (wp.y() - 1 >= 0 && TmpCells[wp.x()][wp.y()-1] == cnt)
{
chk = chk | 0x04;
c++;
}
if (wp.y() + 1 < mapSize.height() && TmpCells[wp.x()][wp.y()+1] == cnt)
{
chk = chk | 0x08;
c++;
}
if (c == 0 || chk == 0) qDebug("ERROR in InvWaveTrace"),exit(-1);
if (c > 1)
{
if ((chk & 0x01)==0x01 && (chk & 0x04)==0x04)
{
if (xnn <= ynn && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ynn) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x04)==0x04)
{
if (xpp <= ynn && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ynn) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()--;
ynn++;
ynn++;
Ind = 1;
}
}
if ((chk & 0x01)==0x01 && (chk & 0x08)==0x08)
{
if (xnn <= ypp && Ind == 0){
wp.rx()--;
xnn++;
if (xnn == ypp) xnn++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
if ((chk & 0x02)==0x02 && (chk & 0x08)==0x08)
{
if (xpp <= ypp && Ind == 0){
wp.rx()++;
xpp++;
if (xpp == ypp) xpp++;
Ind = 1;
} else if (Ind == 0) {
wp.ry()++;
ypp++;
ypp++;
Ind = 1;
}
}
}
if (c == 1 || Ind == 0)
{
xnn=0;
xpp=0;
ynn=0;
ypp=0;
if ((chk & 0x01)==0x01) {
wp.rx()--;
xnn++;
}
else if ((chk & 0x02)==0x02) {
wp.rx()++;
xpp++;
}
else if ((chk & 0x04)==0x04) {
wp.ry()--;
ynn++;
}
else if ((chk & 0x08)==0x08) {
wp.ry()++;
ypp++;
}
}
Ppnt = wp;
alpath.push_front(Ppnt);
}
return alpath;
}

View File

@@ -2,163 +2,164 @@
#include <cmath>
Splashes::Splashes(Game_Data *gd, QObject *parent) :
QObject(parent)
QObject(parent)
{
gameData = gd;
nextId = 1;
gameData = gd;
nextId = 1;
}
void Splashes::addSplash(int player, srcSplashType *src, QPointF pos, QPointF dest, int aim)
{
SplashType spl;
spl.id = nextId;
spl.towerId = QPoint(-1,-1);
spl.srcTow = 0;
spl.PlayerId = player;
spl.AlienId = 0;
spl.pos = pos;
spl.destination = dest;
spl.AlienId = aim;
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
spl.life = 0;
spl.src = src;
addSplash(&spl);
SplashType spl;
spl.id = nextId;
spl.towerId = QPoint(-1,-1);
spl.srcTow = 0;
spl.PlayerId = player;
spl.AlienId = 0;
spl.pos = pos;
spl.destination = dest;
spl.AlienId = aim;
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
spl.life = 0;
spl.src = src;
addSplash(&spl);
}
void Splashes::addSplash(const TowerType &tower)
{
SplashType spl;
spl.src = &(tower.src->splashes[0]);
spl.id = nextId;
spl.towerId = tower.pos;
spl.PlayerId = tower.PlayerId;
spl.AlienId = tower.aim;
spl.srcTow = tower.src;
SplashType spl;
spl.src = &(tower.src->splashes[0]);
spl.id = nextId;
spl.towerId = tower.pos;
spl.PlayerId = tower.PlayerId;
spl.AlienId = tower.aim;
spl.srcTow = tower.src;
spl.pos = QPointF(tower.pos);
if (gameData->aliens->curAliens.contains(spl.AlienId))
spl.destination = gameData->aliens->curAliens.value(spl.AlienId).pos+QPointF(0.5,0.5);
else {qCritical("aim alien not exists(!)");return;}
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
spl.life = 0;
addSplash(&spl);
if (gameData->aliens->curAliens.contains(spl.AlienId))
spl.destination = gameData->aliens->curAliens.value(spl.AlienId).pos+QPointF(0.5,0.5);
else {qCritical("aim alien not exists(!)");return;}
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
spl.life = 0;
addSplash(&spl);
}
void Splashes::addSplash(srcTowerType *srctower, int id, QPointF pos, QPointF dest, int aim, QPoint towerId)
{
SplashType spl;
if (srctower != 0)
spl.src = &(srctower->splashes[id]);
else spl.src = &(gameData->srcSplashes[id]);
spl.id = nextId;
spl.towerId = towerId;
spl.PlayerId = srctower->PlayerId;
spl.AlienId = aim;
spl.pos = pos;
spl.destination = dest;
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
spl.life = 0;
spl.srcTow = srctower;
addSplash(&spl);
SplashType spl;
if (srctower != 0)
spl.src = &(srctower->splashes[id]);
else spl.src = &(gameData->srcSplashes[id]);
spl.id = nextId;
spl.towerId = towerId;
spl.PlayerId = srctower->PlayerId;
spl.AlienId = aim;
spl.pos = pos;
spl.destination = dest;
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
spl.life = 0;
spl.srcTow = srctower;
addSplash(&spl);
}
void Splashes::addSplash(SplashType * spl)
{
srcTriggerType * trig;
for(int i=0; i<spl->src->triggerIndexes.size(); i++)
{
TriggerOnDest tod;
TriggerOnAlien toa;
TriggerOnTimer tot;
if (spl->srcTow != 0)
trig = &(spl->srcTow->triggers[spl->src->triggerIndexes.at(i)]);
else {qDebug("no parent tower"); trig = &(gameData->srcTriggers[spl->src->triggerIndexes.at(i)]);}
switch (trig->type)
{
case srcTriggerType::onDestination :
tod.src = trig;
spl->trigsOnDest.append(tod);
break;
case srcTriggerType::onAlienInRadius :
toa.src = trig;
spl->trigsOnAlien.append(toa);
break;
case srcTriggerType::onTimer :
tot.src = trig;
tot.timer = 0;
spl->trigsOnTimer.append(tot);
break;
}
srcTriggerType * trig;
for(int i=0; i<spl->src->triggerIndexes.size(); i++)
{
TriggerOnDest tod;
TriggerOnAlien toa;
TriggerOnTimer tot;
if (spl->srcTow != 0)
trig = &(spl->srcTow->triggers[spl->src->triggerIndexes.at(i)]);
else {qDebug("no parent tower"); trig = &(gameData->srcTriggers[spl->src->triggerIndexes.at(i)]);}
switch (trig->type)
{
case srcTriggerType::onDestination :
tod.src = trig;
spl->trigsOnDest.append(tod);
break;
case srcTriggerType::onAlienInRadius :
toa.src = trig;
spl->trigsOnAlien.append(toa);
break;
case srcTriggerType::onTimer :
tot.src = trig;
tot.timer = 0;
spl->trigsOnTimer.append(tot);
break;
}
}
spl->item = new ADItem(spl->id, ADItem::Splash, spl->src->images);
spl->item->setPos(spl->pos*cellSize);
spl->item->setRotation(spl->angle);
scene->addItem(spl->item);
gameData->curSplashes.insert(spl->id,*spl);
nextId++;
}
spl->item = new ADItem(spl->id, ADItem::Splash, spl->src->images);
spl->item->setPos(spl->pos*cellSize);
spl->item->setRotation(spl->angle);
scene->addItem(spl->item);
gameData->curSplashes.insert(spl->id,*spl);
nextId++;
}
void Splashes::update()
{
QList <int> deadIndexes;
for (QHash<int, SplashType>::iterator
spl = gameData->curSplashes.begin();
spl != gameData->curSplashes.end(); ++spl)
{
spl->life++;
if (spl->life > spl->src->lifetime)
deadIndexes.append(spl->id);
if (!spl->trigsOnTimer.isEmpty())
doTriggerOnTimer(spl,&deadIndexes);
float arctg;
float speed = spl->src->speed;
float speed2 = speed*speed;
if (spl->src->autoControl && spl->AlienId != -1)
{
bool badAl = false;
if (gameData->aliens->curAliens.contains(spl->AlienId))
spl->destination = gameData->aliens->curAliens.value(spl->AlienId).pos+QPointF(0.5,0.5);
else {
badAl = true;
spl->AlienId = -1;
}
if (distance2(spl->pos, spl->destination) < speed2)
{
if (badAl)
deadIndexes.push_back(spl->id);
spl->pos = spl->destination;
doTriggerOnDest(spl,&deadIndexes,badAl);
}
arctg = std::atan2(spl->pos.x() - spl->destination.x(),spl->pos.y() - spl->destination.y());
spl->angle = 180.0f*(-arctg)/M_PI;
} else {
if (!gameData->map->rect().contains(spl->pos.toPoint()))
deadIndexes.push_back(spl->id);
if (!spl->trigsOnDest.isEmpty())
{
if (distance2(spl->pos, spl->destination) < speed2)
{
spl->pos = spl->destination;
doTriggerOnDest(spl,&deadIndexes,true);
}
}
arctg = -spl->angle*M_PI/180.f;
}
spl->pos.rx() -= speed*std::sin(arctg);
spl->pos.ry() -= speed*std::cos(arctg);
/// TODO: smooth splash rotate
spl->item->setPos(spl->pos*cellSize);
spl->item->setRotation(spl->angle);
if (speed == 0) spl->item->next(1.f);
else spl->item->next(speed*cellSize);
}
for (int j=0; j<deadIndexes.size(); j++)
delSplash(deadIndexes.at(j));
QHash<int,int> deadIndexes;
for (QHash<int, SplashType>::iterator
spl = gameData->curSplashes.begin();
spl != gameData->curSplashes.end(); ++spl)
{
spl->life++;
if (spl->life > spl->src->lifetime)
deadIndexes.insert(spl->id,spl->id);
if (!spl->trigsOnTimer.isEmpty())
doTriggerOnTimer(spl,&deadIndexes);
float arctg;
float speed = spl->src->speed;
float speed2 = speed*speed;
if (spl->src->autoControl && spl->AlienId != -1)
{
bool badAl = false;
if (gameData->aliens->curAliens.contains(spl->AlienId))
spl->destination = gameData->aliens->curAliens.value(spl->AlienId).pos+QPointF(0.5,0.5);
else {
badAl = true;
spl->AlienId = -1;
}
if (distance2(spl->pos, spl->destination) < speed2)
{
if (badAl)
deadIndexes.insert(spl->id,spl->id);
spl->pos = spl->destination;
doTriggerOnDest(spl,&deadIndexes,badAl);
}
arctg = std::atan2(spl->pos.x() - spl->destination.x(),spl->pos.y() - spl->destination.y());
spl->angle = 180.0f*(-arctg)/M_PI;
} else {
if (!gameData->map->rect().contains(spl->pos.toPoint()))
deadIndexes.insert(spl->id,spl->id);
if (!spl->trigsOnDest.isEmpty())
{
if (distance2(spl->pos, spl->destination) < speed2)
{
spl->pos = spl->destination;
doTriggerOnDest(spl,&deadIndexes,true);
}
}
arctg = -spl->angle*M_PI/180.f;
}
spl->pos.rx() -= speed*std::sin(arctg);
spl->pos.ry() -= speed*std::cos(arctg);
/// TODO: smooth splash rotate
spl->item->setPos(spl->pos*cellSize);
spl->item->setRotation(spl->angle);
if (speed == 0) spl->item->next(1.f);
else spl->item->next(speed*cellSize);
}
for (QHash<int,int>::iterator j = deadIndexes.begin();
j != deadIndexes.end(); ++j)
delSplash(*j);
for (QHash<int,DeadAlienIndex>::iterator j = dead.begin();
j != dead.end(); ++j)
emit killAlien(j->player,j->id);
@@ -168,28 +169,28 @@ void Splashes::update()
void Splashes::delSplash(int Id)
{
scene->removeItem(gameData->curSplashes[Id].item);
delete gameData->curSplashes[Id].item;
gameData->curSplashes.remove(Id);
scene->removeItem(gameData->curSplashes[Id].item);
delete gameData->curSplashes[Id].item;
gameData->curSplashes.remove(Id);
}
/// FIXME : correct onTrigTimer()
void Splashes::doTriggerOnTimer(QHash<int, SplashType>::iterator
spl, QList<int> *deadIndexes)
spl, QHash<int,int> *deadIndexes)
{
for(QList<TriggerOnTimer>::iterator i = spl->trigsOnTimer.begin();
i != spl->trigsOnTimer.end(); ++i)
{
for(QList<TriggerOnTimer>::iterator i = spl->trigsOnTimer.begin();
i != spl->trigsOnTimer.end(); ++i)
{
srcTriggerType * strig = i->src;
i->timer++;
if (i->timer >= strig->timer)
{
i->timer++;
if (i->timer >= strig->timer)
{
/// TODO : add damage and other effects
i->timer = 0;
if (strig->delParent) deadIndexes->append(spl->id);
if (strig->count > 0 && strig->childId > 0)
{
if (strig->delParent) deadIndexes->insert(spl->id,spl->id);
if (strig->count > 0 && strig->childId > 0)
{
int aim;
switch(strig->childAim)
{
@@ -199,65 +200,65 @@ void Splashes::doTriggerOnTimer(QHash<int, SplashType>::iterator
default : aim = -1;
}
for (int j=0; j<strig->count; ++j)
{
/// TODO: randomRadiusPos
addSplash(spl->srcTow, strig->childId, spl->pos, spl->destination, aim, spl->towerId);
}
}
}
}
{
/// TODO: randomRadiusPos
addSplash(spl->srcTow, strig->childId, spl->pos, spl->destination, aim, spl->towerId);
}
}
}
}
}
void Splashes::doTriggerOnDest(QHash<int, SplashType>::iterator
spl, QList<int> *deadIndexes,
bool badAl)
spl, QHash<int,int> *deadIndexes,
bool badAl)
{
foreach(TriggerOnDest t, spl->trigsOnDest)
{
/// TODO: different aims for childs
if (t.src->delParent) deadIndexes->append(spl->id);
int aim;
switch(t.src->childAim)
{
case srcTriggerType::parentAim : aim = spl->AlienId; break;
/// TODO : other aim types
case srcTriggerType::noAim : aim = -1; break;
default : aim = -1;
}
if (t.src->count > 0 && t.src->childId > 0)
{
for (int j=0; j<t.src->count; ++j)
{
/// TODO: randomRadiusPos
addSplash(spl->srcTow,t.src->childId,
spl->pos,spl->destination,aim,spl->towerId);
}
}
float dmg = t.src->damage;
float rad = t.src->radius;
if (dmg > 0)
{
foreach(TriggerOnDest t, spl->trigsOnDest)
{
/// TODO: different aims for childs
if (t.src->delParent) deadIndexes->insert(spl->id,spl->id);
int aim;
switch(t.src->childAim)
{
case srcTriggerType::parentAim : aim = spl->AlienId; break;
/// TODO : other aim types
case srcTriggerType::noAim : aim = -1; break;
default : aim = -1;
}
if (t.src->count > 0 && t.src->childId > 0)
{
for (int j=0; j<t.src->count; ++j)
{
/// TODO: randomRadiusPos
addSplash(spl->srcTow,t.src->childId,
spl->pos,spl->destination,aim,spl->towerId);
}
}
float dmg = t.src->damage;
float rad = t.src->radius;
if (dmg > 0)
{
float hh;
if (!(rad > 0))
{
if (!badAl)
{
if (!(rad > 0))
{
if (!badAl)
{
hh = gameData->aliens->curAliens[spl->AlienId].health -= dmg;
if (hh <= 0) dead.insert(spl->AlienId, DeadAlienIndex(spl->AlienId, spl->PlayerId));
}
} else {
for (QHash<int, AlienType>::iterator
i = gameData->aliens->curAliens.begin();
i != gameData->aliens->curAliens.end(); ++i)
{
if (distance2(spl->pos, i->pos) < rad*rad)
{
}
} else {
for (QHash<int, AlienType>::iterator
i = gameData->aliens->curAliens.begin();
i != gameData->aliens->curAliens.end(); ++i)
{
if (distance2(spl->pos, i->pos) < rad*rad)
{
hh = i->health -= dmg;
if (hh <= 0) dead.insert(i->id, DeadAlienIndex(i->id, spl->PlayerId));
}
}
}
}
}
}
}
}
}
}
}

View File

@@ -5,28 +5,28 @@
class Splashes : public QObject
{
Q_OBJECT
Q_OBJECT
public:
explicit Splashes(Game_Data * gd, QObject *parent = 0);
void delSplash(int Id);
void update();
void setScene(QGraphicsScene * scene_) {scene = scene_;}
explicit Splashes(Game_Data * gd, QObject *parent = 0);
void delSplash(int Id);
void update();
void setScene(QGraphicsScene * scene_) {scene = scene_;}
signals:
/// TODO : fix killalien - new function for adding alien in kill list and del aliens in finish update
void killAlien(int playerId, int alienId);
void killAlien(int playerId, int alienId);
public slots:
void addSplash(int player, srcSplashType * src, QPointF pos, QPointF dest, int aim = -1);
void addSplash(const TowerType &tower);
void addSplash(srcTowerType * srctower, int id, QPointF pos, QPointF dest, int aim = -1, QPoint towerId = QPoint(-1,-1));
void addSplash(SplashType *spl);
void addSplash(int player, srcSplashType * src, QPointF pos, QPointF dest, int aim = -1);
void addSplash(const TowerType &tower);
void addSplash(srcTowerType * srctower, int id, QPointF pos, QPointF dest, int aim = -1, QPoint towerId = QPoint(-1,-1));
void addSplash(SplashType *spl);
private:
QGraphicsScene * scene;
Game_Data *gameData;
int nextId;
QGraphicsScene * scene;
Game_Data *gameData;
int nextId;
struct DeadAlienIndex
{
DeadAlienIndex(int i, int p) {id = i; player = p;}
@@ -35,11 +35,11 @@ private:
};
QHash <int, DeadAlienIndex> dead;
void doTriggerOnDest(QHash<int, SplashType>::iterator
spl, QList <int> * deadIndexes,
bool badAl);
void doTriggerOnTimer(QHash<int, SplashType>::iterator
spl, QList <int> * deadIndexes);
void doTriggerOnDest(QHash<int, SplashType>::iterator
spl, QHash<int,int> * deadIndexes,
bool badAl);
void doTriggerOnTimer(QHash<int, SplashType>::iterator
spl, QHash<int,int> * deadIndexes);
};
#endif // SPLASHES_H