fixed few critical bugs
This commit is contained in:
131
ad_graphics.cpp
131
ad_graphics.cpp
@@ -6,65 +6,65 @@
|
|||||||
|
|
||||||
AD_Graphics::AD_Graphics(AD_Core *adcore, QWidget *parent) : QGraphicsView(parent)
|
AD_Graphics::AD_Graphics(AD_Core *adcore, QWidget *parent) : QGraphicsView(parent)
|
||||||
{
|
{
|
||||||
data = adcore->addata;
|
data = adcore->addata;
|
||||||
core = adcore;
|
core = adcore;
|
||||||
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
|
||||||
setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
setAlignment(Qt::AlignLeft | Qt::AlignTop);
|
||||||
scene = new QGraphicsScene();
|
scene = new QGraphicsScene();
|
||||||
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
|
||||||
core->setScene(scene);
|
core->setScene(scene);
|
||||||
setScene(scene);
|
setScene(scene);
|
||||||
//setCacheMode();
|
//setCacheMode();
|
||||||
//setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
//setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
|
||||||
mapimg = new QImage(data->map->rect().size()*cellSize,QImage::Format_ARGB32);
|
mapimg = new QImage(data->map->rect().size()*cellSize,QImage::Format_ARGB32);
|
||||||
//setDragMode(RubberBandDrag);
|
//setDragMode(RubberBandDrag);
|
||||||
QPainter p(mapimg);
|
QPainter p(mapimg);
|
||||||
for (int i=0; i<data->map->cells().size(); i++) {
|
for (int i=0; i<data->map->cells().size(); i++) {
|
||||||
for (int j=0; j<data->map->cells().at(i).size(); j++) {
|
for (int j=0; j<data->map->cells().at(i).size(); j++) {
|
||||||
QPen pen;
|
QPen pen;
|
||||||
QBrush brush;
|
QBrush brush;
|
||||||
pen.setColor(Qt::white);
|
pen.setColor(Qt::white);
|
||||||
brush.setColor(Qt::white);
|
brush.setColor(Qt::white);
|
||||||
brush.setStyle(Qt::SolidPattern);
|
brush.setStyle(Qt::SolidPattern);
|
||||||
int cel = data->map->cells().at(i).at(j);
|
int cel = data->map->cells().at(i).at(j);
|
||||||
if (cel == Map::Wall)
|
if (cel == Map::Wall)
|
||||||
{
|
{
|
||||||
pen.setColor(Qt::black);
|
pen.setColor(Qt::black);
|
||||||
brush.setColor(Qt::black);
|
brush.setColor(Qt::black);
|
||||||
}
|
}
|
||||||
if (cel >= Map::Free || (cel <= Map::PlayerTower && cel !=Map::Wall))
|
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));
|
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));
|
brush.setColor(QColor(qAbs(cel+2)*345%255,(qAbs(cel+2)*721)%255,(qAbs(cel+2)*75)%255,80));
|
||||||
}
|
}
|
||||||
p.setPen(pen);
|
p.setPen(pen);
|
||||||
p.setBrush(brush);
|
p.setBrush(brush);
|
||||||
p.drawRect(i*cellSize,j*cellSize,cellSize,cellSize);
|
p.drawRect(i*cellSize,j*cellSize,cellSize,cellSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.end();
|
p.end();
|
||||||
scene->setSceneRect(mapimg->rect());
|
scene->setSceneRect(mapimg->rect());
|
||||||
scene->setBackgroundBrush(*mapimg);
|
scene->setBackgroundBrush(*mapimg);
|
||||||
setCacheMode(QGraphicsView::CacheBackground);
|
setCacheMode(QGraphicsView::CacheBackground);
|
||||||
resize(mapimg->size());
|
resize(mapimg->size());
|
||||||
// startTimer(50);
|
startTimer(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AD_Graphics::~AD_Graphics()
|
AD_Graphics::~AD_Graphics()
|
||||||
{
|
{
|
||||||
delete scene;
|
delete scene;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Graphics::mousePressEvent(QMouseEvent *event)
|
void AD_Graphics::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
scene->clearSelection();
|
scene->clearSelection();
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
if (m_building) emit add_tow((QPointF(event->pos())/cellSize).toPoint());
|
if (m_building) emit add_tow((QPointF(event->pos())/cellSize).toPoint());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
QList<QGraphicsItem*> list = scene->items(event->pos(), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder);
|
QList<QGraphicsItem*> list = scene->items(event->pos(), Qt::IntersectsItemBoundingRect, Qt::AscendingOrder);
|
||||||
ADItem * al = 0;
|
ADItem * al = 0;
|
||||||
foreach(QGraphicsItem* x, list)
|
foreach(QGraphicsItem* x, list)
|
||||||
@@ -87,17 +87,18 @@ void AD_Graphics::mousePressEvent(QMouseEvent *event)
|
|||||||
emit alien_select(al->id());
|
emit alien_select(al->id());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event->button() == Qt::RightButton)
|
if (event->button() == Qt::RightButton)
|
||||||
emit cancel();
|
emit cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//void AD_Graphics::timerEvent(QTimerEvent * )
|
void AD_Graphics::timerEvent(QTimerEvent * )
|
||||||
//{
|
{
|
||||||
// scene->update();
|
if (!core->isWaveEnd())
|
||||||
//}
|
scene->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Graphics::drawBackground(QPainter * p, const QRectF & )
|
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)
|
void AD_Graphics::drawForeground(QPainter *p, const QRectF &rect)
|
||||||
{
|
{
|
||||||
QList <QGraphicsItem *> l = scene->items();
|
QList <QGraphicsItem *> l = scene->items();
|
||||||
foreach(QGraphicsItem * g,l)
|
foreach(QGraphicsItem * g,l)
|
||||||
{
|
{
|
||||||
ADItem * i = qgraphicsitem_cast<ADItem *>(g);
|
ADItem * i = qgraphicsitem_cast<ADItem *>(g);
|
||||||
if (i->isBarVisible())
|
if (i->isBarVisible())
|
||||||
{
|
{
|
||||||
p->setPen(Qt::black);
|
p->setPen(Qt::black);
|
||||||
p->setBrush(QBrush(QColor(qRound(255*(1-i->value())),qRound(255*i->value()),0)));
|
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);
|
p->drawRect(i->pos().x()-cellSize,i->pos().y()-cellSize*1.25,cellSize*2*i->value(),cellSize/4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,44 +10,44 @@
|
|||||||
|
|
||||||
class AD_Graphics: public QGraphicsView
|
class AD_Graphics: public QGraphicsView
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(bool building READ building WRITE setBuilding)
|
Q_PROPERTY(bool building READ building WRITE setBuilding)
|
||||||
public:
|
public:
|
||||||
explicit AD_Graphics(AD_Core * core, QWidget * parent = 0);
|
explicit AD_Graphics(AD_Core * core, QWidget * parent = 0);
|
||||||
~AD_Graphics();
|
~AD_Graphics();
|
||||||
|
|
||||||
bool building() const
|
bool building() const
|
||||||
{
|
{
|
||||||
return m_building;
|
return m_building;
|
||||||
}
|
}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setBuilding(bool arg)
|
void setBuilding(bool arg)
|
||||||
{
|
{
|
||||||
m_building = arg;
|
m_building = arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void drawBackground(QPainter * p, const QRectF &);
|
void drawBackground(QPainter * p, const QRectF &);
|
||||||
void drawForeground(QPainter *painter, const QRectF &rect);
|
void drawForeground(QPainter *painter, const QRectF &rect);
|
||||||
void mousePressEvent(QMouseEvent *event);
|
void mousePressEvent(QMouseEvent *event);
|
||||||
|
|
||||||
QGraphicsScene * scene;
|
QGraphicsScene * scene;
|
||||||
AD_Core * core;
|
AD_Core * core;
|
||||||
QImage * mapimg;
|
QImage * mapimg;
|
||||||
Game_Data * data;
|
Game_Data * data;
|
||||||
|
|
||||||
bool m_building;
|
bool m_building;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// void timerEvent(QTimerEvent * );
|
void timerEvent(QTimerEvent * );
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void cancel();
|
void cancel();
|
||||||
void add_tow(QPoint pnt);
|
void add_tow(QPoint pnt);
|
||||||
void tower_select(QPoint id);
|
void tower_select(QPoint id);
|
||||||
void alien_select(int id);
|
void alien_select(int id);
|
||||||
};
|
};
|
||||||
|
|||||||
115
adcore.cpp
115
adcore.cpp
@@ -1,93 +1,94 @@
|
|||||||
#include "adcore.h"
|
#include "adcore.h"
|
||||||
|
|
||||||
AD_Core::AD_Core(QObject *parent) :
|
AD_Core::AD_Core(QObject *parent) :
|
||||||
QThread(parent)
|
QThread(parent)
|
||||||
{
|
{
|
||||||
step = 0;
|
step = 0;
|
||||||
Loader * adloader = new Loader();
|
Loader * adloader = new Loader();
|
||||||
adloader->load("data2.xml");
|
adloader->load("data2.xml");
|
||||||
addata = adloader->loadlevel(1);
|
addata = adloader->loadlevel(1);
|
||||||
delete adloader;
|
delete adloader;
|
||||||
if (addata != 0) qDebug("Sucsess");
|
if (addata != 0) qDebug("Sucsess");
|
||||||
else qFatal("Error");
|
else qFatal("Error");
|
||||||
adtowers = new Towers(addata);
|
adtowers = new Towers(addata);
|
||||||
adsplashes = new Splashes(addata);
|
adsplashes = new Splashes(addata);
|
||||||
connect(addata->map,SIGNAL(recreateAlienPath(bool*)),addata->aliens,SLOT(retrace(bool*)));
|
connect(addata->map,SIGNAL(recreateAlienPath(bool*)),addata->aliens,SLOT(retrace(bool*)));
|
||||||
connect(adtowers,SIGNAL(shot(TowerType)),adsplashes,SLOT(addSplash(TowerType)));
|
connect(adtowers,SIGNAL(shot(TowerType)),adsplashes,SLOT(addSplash(TowerType)));
|
||||||
connect(adsplashes,SIGNAL(killAlien(int,int)),this,SLOT(killAlien(int,int)));
|
connect(adsplashes,SIGNAL(killAlien(int,int)),this,SLOT(killAlien(int,int)));
|
||||||
waveInProgress = false;
|
waveInProgress = false;
|
||||||
waveEnd = false;
|
waveEnd = false;
|
||||||
startTimer(50);
|
startTimer(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Core::next()
|
void AD_Core::next()
|
||||||
{
|
{
|
||||||
adtowers->update();
|
adtowers->update();
|
||||||
adsplashes->update();
|
adsplashes->update();
|
||||||
addata->aliens->update();
|
addata->aliens->update();
|
||||||
waveProcessing();
|
waveProcessing();
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Core::timerEvent(QTimerEvent * )
|
void AD_Core::timerEvent(QTimerEvent * )
|
||||||
{
|
{
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Core::nextWave()
|
void AD_Core::nextWave()
|
||||||
{
|
{
|
||||||
if (waveInProgress) return;
|
if (waveInProgress) return;
|
||||||
if (addata->curWave >= addata->waves.size()) {
|
if (addata->curWave >= addata->waves.size()) {
|
||||||
qDebug("level finished");
|
qDebug("level finished");
|
||||||
waveEnd = false;
|
waveEnd = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//wavetime = addata->waves.at(addata->curWave).timeout;
|
//wavetime = addata->waves.at(addata->curWave).timeout;
|
||||||
qDebug() << tr("Next wave %1").arg(addata->curWave+1);
|
qDebug() << tr("Next wave %1").arg(addata->curWave+1);
|
||||||
wavetime = 0;
|
wavetime = 0;
|
||||||
waveInProgress = true;
|
waveInProgress = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Core::waveProcessing()
|
void AD_Core::waveProcessing()
|
||||||
{
|
{
|
||||||
if (addata->aliens->curAliens.isEmpty() && waveEnd)
|
/// FIXME : resolve problem with prise for finish wave, it is calculated wrong!
|
||||||
{
|
if (addata->aliens->curAliens.isEmpty() && waveEnd)
|
||||||
addata->players.at(0)->money += addata->waves.at(addata->curWave-1).prise;
|
{
|
||||||
waveEnd = false;
|
if(addata->curWave > 0) addata->players.at(0)->money += addata->waves.at(addata->curWave-1).prise;
|
||||||
}
|
waveEnd = false;
|
||||||
if (!waveInProgress) return;
|
}
|
||||||
if (wavetime <= 0) {
|
if (!waveInProgress) return;
|
||||||
for (int i=0; i<addata->waves.at(addata->curWave).counts.size(); i++) {
|
if (wavetime <= 0) {
|
||||||
if (addata->waves.at(addata->curWave).counts.at(i) > 0) {
|
for (int i=0; i<addata->waves.at(addata->curWave).counts.size(); i++) {
|
||||||
addata->aliens->addAlien(addata->waves.at(addata->curWave).types.at(i));
|
if (addata->waves.at(addata->curWave).counts.at(i) > 0) {
|
||||||
addata->waves[addata->curWave].counts[i]--;
|
addata->aliens->addAlien(addata->waves.at(addata->curWave).types.at(i));
|
||||||
wavetime = addata->waves.at(addata->curWave).timeout;
|
addata->waves[addata->curWave].counts[i]--;
|
||||||
waveEnd = true;
|
wavetime = addata->waves.at(addata->curWave).timeout;
|
||||||
return;
|
waveEnd = true;
|
||||||
}
|
return;
|
||||||
}
|
}
|
||||||
addata->curWave++;
|
}
|
||||||
waveInProgress = false;
|
addata->curWave++;
|
||||||
} else {
|
waveInProgress = false;
|
||||||
wavetime--;
|
} else {
|
||||||
}
|
wavetime--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Core::killAlien(int playerId, int alienId)
|
void AD_Core::killAlien(int playerId, int alienId)
|
||||||
{
|
{
|
||||||
addata->players.at(playerId)->money += addata->aliens->curAliens[alienId].src->prise;
|
addata->players.at(playerId)->money += addata->aliens->curAliens[alienId].src->prise;
|
||||||
addata->aliens->delAlien(alienId);
|
addata->aliens->delAlien(alienId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AD_Core::setScene(QGraphicsScene *scene)
|
void AD_Core::setScene(QGraphicsScene *scene)
|
||||||
{
|
{
|
||||||
addata->aliens->setScene(scene);
|
addata->aliens->setScene(scene);
|
||||||
adtowers->setScene(scene);
|
adtowers->setScene(scene);
|
||||||
adsplashes->setScene(scene);
|
adsplashes->setScene(scene);
|
||||||
}
|
}
|
||||||
|
|||||||
29
adcore.h
29
adcore.h
@@ -12,28 +12,29 @@ class AD_Core : public QThread
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit AD_Core(QObject *parent = 0);
|
explicit AD_Core(QObject *parent = 0);
|
||||||
Game_Data * addata;
|
Game_Data * addata;
|
||||||
Towers * adtowers;
|
Towers * adtowers;
|
||||||
Splashes * adsplashes;
|
Splashes * adsplashes;
|
||||||
long int step;
|
long int step;
|
||||||
|
|
||||||
void setScene(QGraphicsScene * scene);
|
void setScene(QGraphicsScene * scene);
|
||||||
|
bool isWaveEnd() {return waveEnd;}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void next();
|
void next();
|
||||||
void nextWave();
|
void nextWave();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void timerEvent(QTimerEvent * );
|
void timerEvent(QTimerEvent * );
|
||||||
void waveProcessing();
|
void waveProcessing();
|
||||||
|
|
||||||
bool waveInProgress;
|
bool waveInProgress;
|
||||||
bool waveEnd;
|
bool waveEnd;
|
||||||
int wavetime;
|
int wavetime;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void killAlien(int playerId, int alienId);
|
void killAlien(int playerId, int alienId);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
|
<!-- Written by Qt Creator 2.2.84, 2011-08-20T10:11:41. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
@@ -7,166 +9,280 @@
|
|||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
<valuemap type="QVariantMap">
|
<valuemap type="QVariantMap">
|
||||||
<value key="EditorConfiguration.AutoIndent" type="bool">true</value>
|
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||||
<value key="EditorConfiguration.AutoSpacesForTabs" type="bool">false</value>
|
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||||
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
|
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||||
<value key="EditorConfiguration.DoubleIndentBlocks" type="bool">false</value>
|
<value type="QString" key="language">Cpp</value>
|
||||||
<value key="EditorConfiguration.IndentBraces" type="bool">false</value>
|
<valuemap type="QVariantMap" key="value">
|
||||||
<value key="EditorConfiguration.IndentSize" type="int">4</value>
|
<value type="bool" key="AlignAssignments">true</value>
|
||||||
<value key="EditorConfiguration.MouseNavigation" type="bool">true</value>
|
<value type="QString" key="CurrentFallback">CppProject</value>
|
||||||
<value key="EditorConfiguration.PaddingMode" type="int">1</value>
|
<value type="bool" key="ExtraPaddingForConditionsIfConfusingAlign">false</value>
|
||||||
<value key="EditorConfiguration.ScrollWheelZooming" type="bool">true</value>
|
<value type="bool" key="IndentAccessSpecifiers">false</value>
|
||||||
<value key="EditorConfiguration.SmartBackspace" type="bool">false</value>
|
<value type="bool" key="IndentBlockBody">true</value>
|
||||||
<value key="EditorConfiguration.SpacesForTabs" type="bool">false</value>
|
<value type="bool" key="IndentBlockBraces">false</value>
|
||||||
<value key="EditorConfiguration.TabKeyBehavior" type="int">0</value>
|
<value type="bool" key="IndentBlocksRelativeToSwitchLabels">false</value>
|
||||||
<value key="EditorConfiguration.TabSize" type="int">4</value>
|
<value type="bool" key="IndentClassBraces">false</value>
|
||||||
<value key="EditorConfiguration.UseGlobal" type="bool">true</value>
|
<value type="bool" key="IndentControlFlowRelativeToSwitchLabels">false</value>
|
||||||
<value key="EditorConfiguration.Utf8BomBehavior" type="int">1</value>
|
<value type="bool" key="IndentDeclarationsRelativeToAccessSpecifiers">true</value>
|
||||||
<value key="EditorConfiguration.addFinalNewLine" type="bool">true</value>
|
<value type="bool" key="IndentEnumBraces">false</value>
|
||||||
<value key="EditorConfiguration.cleanIndentation" type="bool">true</value>
|
<value type="bool" key="IndentFunctionBody">true</value>
|
||||||
<value key="EditorConfiguration.cleanWhitespace" type="bool">true</value>
|
<value type="bool" key="IndentFunctionBraces">false</value>
|
||||||
<value key="EditorConfiguration.inEntireDocument" type="bool">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>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||||
<valuemap type="QVariantMap">
|
<valuemap type="QVariantMap">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Target.DesktopTarget</value>
|
||||||
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||||
<value key="ProjectExplorer.Target.ActiveDeployConfiguration" type="int">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||||
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
|
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||||
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||||
<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>
|
<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 key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||||
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
|
||||||
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments">clean</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Debug</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Debug</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Debug</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">2</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
|
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">7</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">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 type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
|
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
|
||||||
<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>
|
<value type="QString" key="ProjectExplorer.BuildCOnfiguration.ToolChain">INVALID</value>
|
||||||
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">qmake</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QtProjectManager.QMakeBuildStep</value>
|
||||||
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary">false</value>
|
||||||
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibraryAuto">false</value>
|
||||||
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
|
<value type="QString" key="QtProjectManager.QMakeBuildStep.QMakeArguments"></value>
|
||||||
|
<value type="bool" key="QtProjectManager.QMakeBuildStep.QMakeForced">false</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.1">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">false</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">2</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||||
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Сборка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Сборка</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.MakeStep</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
|
<value type="bool" key="Qt4ProjectManager.MakeStep.Clean">true</value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeArguments"></value>
|
||||||
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
|
<value type="QString" key="Qt4ProjectManager.MakeStep.MakeCommand"></value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||||
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
|
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||||
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Release</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Release</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Release</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4BuildConfiguration</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration">0</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
|
<value type="QString" key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory">D:/Dropbox/My Dropbox/projects/aliendefender-build-desktop</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
|
<value type="int" key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId">-1</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 type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">false</value>
|
||||||
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">false</value>
|
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
|
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">2</value>
|
||||||
<valuemap key="ProjectExplorer.Target.DeployConfiguration.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||||
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||||
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">0</value>
|
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Установка</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Установка</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Deploy</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Deploy</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">1</value>
|
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Без установки</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Без установки</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Без установки</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Без установки</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.DefaultDeployConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.Target.DeployConfigurationCount" type="int">1</value>
|
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||||
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
|
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Конфигурация запуска Qt4</value>
|
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">aliendefender</value>
|
<value type="bool" key="Analyzer.Project.UseGlobal">true</value>
|
||||||
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||||
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
|
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
|
||||||
<value key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QString"></value>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||||
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">aliendefender.pro</value>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
|
||||||
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||||
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
|
||||||
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||||
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
|
||||||
<value key="RunConfiguration.QmlDebugServerPort" type="uint">3768</value>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||||
<value key="RunConfiguration.UseCppDebugger" type="bool">true</value>
|
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
|
||||||
<value key="RunConfiguration.UseQmlDebugger" type="bool">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>
|
</valuemap>
|
||||||
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
|
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||||
</valuemap>
|
</valuemap>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
@@ -175,10 +291,10 @@
|
|||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
|
<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>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||||
<value type="int">9</value>
|
<value type="int">10</value>
|
||||||
</data>
|
</data>
|
||||||
</qtcreator>
|
</qtcreator>
|
||||||
|
|||||||
156
aliens.cpp
156
aliens.cpp
@@ -4,67 +4,67 @@
|
|||||||
Aliens::Aliens(Map * map_, QObject *parent) :
|
Aliens::Aliens(Map * map_, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
map = map_;
|
map = map_;
|
||||||
nextId = 1;
|
nextId = 1;
|
||||||
m_missingAliens = 0;
|
m_missingAliens = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Aliens::addAlien(int srcId)
|
void Aliens::addAlien(int srcId)
|
||||||
{
|
{
|
||||||
if (srcId < 0 || srcId >= srcAliens.size())
|
if (srcId < 0 || srcId >= srcAliens.size())
|
||||||
{
|
{
|
||||||
qCritical("ERROR out of aliens range");
|
qCritical("ERROR out of aliens range");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AlienType al;
|
AlienType al;
|
||||||
al.id = nextId;
|
al.id = nextId;
|
||||||
al.src = &(srcAliens[srcId]);
|
al.src = &(srcAliens[srcId]);
|
||||||
al.finish = map->finishs().at(qrand()%map->finishs().size());
|
al.finish = map->finishs().at(qrand()%map->finishs().size());
|
||||||
al.pos = QPointF(map->starts().at(qrand()%map->starts().size()));
|
al.pos = QPointF(map->starts().at(qrand()%map->starts().size()));
|
||||||
al.path = map->createPath(al.pos.toPoint(),al.finish);
|
al.path = map->createPath(al.pos.toPoint(),al.finish);
|
||||||
al.pathIndex = 1;
|
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;
|
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())
|
if (al.path.isEmpty())
|
||||||
{
|
{
|
||||||
qCritical("ERROR create path");
|
qCritical("ERROR create path");
|
||||||
return; // FIXME: this
|
return; // FIXME: this
|
||||||
}
|
}
|
||||||
//qDebug() << al.path;
|
//qDebug() << al.path;
|
||||||
al.health = al.src->health;
|
al.health = al.src->health;
|
||||||
al.speed = al.src->speed;
|
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 = 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->setPos(al.pos*cellSize+QPointF(cellSize/2,cellSize/2));
|
||||||
al.item->setRotation(al.angle);
|
al.item->setRotation(al.angle);
|
||||||
curAliens.insert(al.id,al);
|
curAliens.insert(al.id,al);
|
||||||
scene->addItem(al.item);
|
scene->addItem(al.item);
|
||||||
nextId++;
|
nextId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Aliens::retrace(bool * OK)
|
void Aliens::retrace(bool * OK)
|
||||||
{
|
{
|
||||||
map->removeAliensPath();
|
map->removeAliensPath();
|
||||||
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
|
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
|
||||||
{
|
{
|
||||||
i->path = map->createPath(i->pos.toPoint(),i->finish);
|
i->path = map->createPath(i->pos.toPoint(),i->finish);
|
||||||
i->pathIndex = 1;
|
i->pathIndex = 1;
|
||||||
if (i->path.isEmpty())
|
if (i->path.isEmpty())
|
||||||
{
|
{
|
||||||
*OK = false;
|
*OK = false;
|
||||||
qDebug("Aliens retrace = false");
|
qDebug("Aliens retrace = false");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Aliens::delAlien(int id, bool missed)
|
void Aliens::delAlien(int id, bool missed)
|
||||||
{
|
{
|
||||||
if (missed)
|
if (missed)
|
||||||
{
|
{
|
||||||
m_missingAliens++;
|
m_missingAliens++;
|
||||||
qDebug() << tr("Missing aliens = %1!").arg(m_missingAliens);
|
qDebug() << tr("Missing aliens = %1!").arg(m_missingAliens);
|
||||||
}
|
}
|
||||||
scene->removeItem(curAliens[id].item);
|
scene->removeItem(curAliens[id].item);
|
||||||
delete curAliens[id].item;
|
delete curAliens[id].item;
|
||||||
curAliens.remove(id);
|
curAliens.remove(id);
|
||||||
@@ -73,37 +73,37 @@ void Aliens::delAlien(int id, bool missed)
|
|||||||
|
|
||||||
void Aliens::update()
|
void Aliens::update()
|
||||||
{
|
{
|
||||||
QList <int> missIndex;
|
QList <int> missIndex;
|
||||||
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
|
for (QHash<int, AlienType>::iterator i = curAliens.begin(); i != curAliens.end(); ++i)
|
||||||
{
|
{
|
||||||
float angl,arctg = 0;
|
float angl,arctg = 0;
|
||||||
int curMiss = -1;
|
int curMiss = -1;
|
||||||
while (distance2(i->pos, i->path.at(i->pathIndex)) < i->speed * i->speed)
|
while (distance2(i->pos, i->path.at(i->pathIndex)) < i->speed * i->speed)
|
||||||
{
|
{
|
||||||
i->pathIndex++;
|
i->pathIndex++;
|
||||||
if (i->pathIndex >= i->path.size())
|
if (i->pathIndex >= i->path.size())
|
||||||
{
|
{
|
||||||
missIndex.push_back(i->id);
|
missIndex.push_back(i->id);
|
||||||
curMiss = i->id;
|
curMiss = i->id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (curMiss < 0)
|
if (curMiss < 0)
|
||||||
{
|
{
|
||||||
// TODO: smooth rotate (how???)
|
// 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());
|
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;
|
angl = 180.0f*(-arctg)/M_PI;
|
||||||
i->angle = angl;
|
i->angle = angl;
|
||||||
i->pos.rx() -= i->speed*std::sin(arctg);
|
i->pos.rx() -= i->speed*std::sin(arctg);
|
||||||
i->pos.ry() -= i->speed*std::cos(arctg);
|
i->pos.ry() -= i->speed*std::cos(arctg);
|
||||||
}
|
}
|
||||||
i->item->setPos(i->pos*cellSize+QPointF(cellSize/2,cellSize/2));
|
i->item->setPos(i->pos*cellSize+QPointF(cellSize/2,cellSize/2));
|
||||||
i->item->setRotation(i->angle);
|
i->item->setRotation(i->angle);
|
||||||
i->item->setBarValue(i->health/i->src->health);
|
i->item->setBarValue(i->health/i->src->health);
|
||||||
i->item->next(i->speed*cellSize);
|
i->item->next(i->speed*cellSize);
|
||||||
}
|
}
|
||||||
for (int j=0; j<missIndex.size(); j++)
|
for (int j=0; j<missIndex.size(); j++)
|
||||||
{
|
{
|
||||||
delAlien(missIndex.at(j),true);
|
delAlien(missIndex.at(j),true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
636
map.cpp
636
map.cpp
@@ -1,382 +1,382 @@
|
|||||||
#include "map.h"
|
#include "map.h"
|
||||||
|
|
||||||
Map::Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, QObject *parent) :
|
Map::Map(QByteArray data, QSize size, QString name, int maxPlayers, int image, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
QByteArray ba = QByteArray::fromBase64(data);
|
QByteArray ba = QByteArray::fromBase64(data);
|
||||||
ba = qUncompress(ba);
|
ba = qUncompress(ba);
|
||||||
QDataStream s(ba);
|
QDataStream s(ba);
|
||||||
mapName = name;
|
mapName = name;
|
||||||
s >> Cells;
|
s >> Cells;
|
||||||
int chei;
|
int chei;
|
||||||
if (Cells.size() <= 0)
|
if (Cells.size() <= 0)
|
||||||
qFatal("Map has invalid width");
|
qFatal("Map has invalid width");
|
||||||
if (Cells.size() != size.width())
|
if (Cells.size() != size.width())
|
||||||
qCritical("Map has wrong width");
|
qCritical("Map has wrong width");
|
||||||
mapSize.setWidth(Cells.size());
|
mapSize.setWidth(Cells.size());
|
||||||
chei = Cells.at(0).size();
|
chei = Cells.at(0).size();
|
||||||
for (int i=0; i<Cells.size(); i++)
|
for (int i=0; i<Cells.size(); i++)
|
||||||
{
|
{
|
||||||
if (Cells[i].size() <= 0)
|
if (Cells[i].size() <= 0)
|
||||||
qFatal("Map has invalid height");
|
qFatal("Map has invalid height");
|
||||||
if (Cells[i].size() != size.height())
|
if (Cells[i].size() != size.height())
|
||||||
{
|
{
|
||||||
qCritical("Map has wrong height");
|
qCritical("Map has wrong height");
|
||||||
if (Cells[i].size() != chei)
|
if (Cells[i].size() != chei)
|
||||||
qFatal("Corrupted map data");
|
qFatal("Corrupted map data");
|
||||||
}
|
}
|
||||||
for (int j=0; j<Cells[i].size(); j++)
|
for (int j=0; j<Cells[i].size(); j++)
|
||||||
{
|
{
|
||||||
if (Cells[i][j]==Start) Starts.push_back(QPoint(i,j));
|
if (Cells[i][j]==Start) Starts.push_back(QPoint(i,j));
|
||||||
if (Cells[i][j]==Finish) Finishs.push_back(QPoint(i,j));
|
if (Cells[i][j]==Finish) Finishs.push_back(QPoint(i,j));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mapSize.setHeight(chei);
|
mapSize.setHeight(chei);
|
||||||
if (Starts.isEmpty() || Finishs.isEmpty()) qFatal("invalid map, not found start/finish");
|
if (Starts.isEmpty() || Finishs.isEmpty()) qFatal("invalid map, not found start/finish");
|
||||||
// TODO: check for maxPlayers
|
// TODO: check for maxPlayers
|
||||||
players = maxPlayers;
|
players = maxPlayers;
|
||||||
imageType = image;
|
imageType = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Map::printMap()
|
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()
|
void Map::removeAliensPath()
|
||||||
{
|
{
|
||||||
for (int i=0; i<Cells.size(); i++)
|
for (int i=0; i<Cells.size(); i++)
|
||||||
{
|
{
|
||||||
for (int j=0; j<Cells[i].size(); j++)
|
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;
|
if (Cells[i][j] > 1000 && Cells[i][j] < 2000) Cells[i][j]=Cells[i][j]-1000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Map::delTowerOnMap(int playerId, QPoint pos)
|
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()-1][pos.y()]=Player+playerId;
|
||||||
Cells[pos.x()][pos.y()-1]=Player+playerId;
|
Cells[pos.x()][pos.y()-1]=Player+playerId;
|
||||||
Cells[pos.x()-1][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)
|
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()-1][pos.y()]=PlayerTower-Player-playerId;
|
||||||
Cells[pos.x()][pos.y()-1]=PlayerTower-Player-playerId;
|
Cells[pos.x()][pos.y()-1]=PlayerTower-Player-playerId;
|
||||||
Cells[pos.x()-1][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 i=0; i<Starts.size(); i++) {
|
||||||
for (int j=0; j<Finishs.size(); j++) {
|
for (int j=0; j<Finishs.size(); j++) {
|
||||||
if (waveTrace(Starts.at(i),Finishs.at(j))<0) {
|
if (waveTrace(Starts.at(i),Finishs.at(j))<0) {
|
||||||
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()-1][pos.y()]=Player+playerId;
|
||||||
Cells[pos.x()][pos.y()-1]=Player+playerId;
|
Cells[pos.x()][pos.y()-1]=Player+playerId;
|
||||||
Cells[pos.x()-1][pos.y()-1]=Player+playerId;
|
Cells[pos.x()-1][pos.y()-1]=Player+playerId;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Map::addTowerOnMap(int playerId, QPoint pos)
|
bool Map::addTowerOnMap(int playerId, QPoint pos)
|
||||||
{
|
{
|
||||||
if (playerId < 0 || playerId > players) return false;
|
if (playerId < 0 || playerId > players) return false;
|
||||||
QRect r(QPoint(),mapSize);
|
QRect r(QPoint(),mapSize);
|
||||||
if (!r.contains(pos) ||
|
if (!r.contains(pos) ||
|
||||||
!r.contains(pos-QPoint(1,0)) ||
|
!r.contains(pos-QPoint(1,0)) ||
|
||||||
!r.contains(pos-QPoint(0,1)) ||
|
!r.contains(pos-QPoint(0,1)) ||
|
||||||
!r.contains(pos-QPoint(1,1))) return false;
|
!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()-1][pos.y()]==Player+playerId &&
|
||||||
Cells[pos.x()][pos.y()-1]==Player+playerId &&
|
Cells[pos.x()][pos.y()-1]==Player+playerId &&
|
||||||
Cells[pos.x()-1][pos.y()-1]==Player+playerId)
|
Cells[pos.x()-1][pos.y()-1]==Player+playerId)
|
||||||
return isReachable(playerId,pos);
|
return isReachable(playerId,pos);
|
||||||
if ((Cells[pos.x()][pos.y()]==AlienPath+Player+playerId || Cells[pos.x()][pos.y()]==Player+playerId) &&
|
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()-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()][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))
|
(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;
|
if (!isReachable(playerId,pos)) return false;
|
||||||
bool * pathOK;
|
bool * pathOK;
|
||||||
pathOK = new bool(true);
|
pathOK = new bool(true);
|
||||||
emit recreateAlienPath(pathOK);
|
emit recreateAlienPath(pathOK);
|
||||||
qDebug() << *pathOK;
|
// qDebug() << *pathOK;
|
||||||
if (*pathOK)
|
if (*pathOK)
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
delTowerOnMap(playerId,pos);
|
delTowerOnMap(playerId,pos);
|
||||||
}
|
}
|
||||||
qDebug()<<"Dont buid here" << pos;
|
qWarning("Dont buid here");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVector<QPointF> Map::createPath(QPoint start, QPoint finish)
|
QVector<QPointF> Map::createPath(QPoint start, QPoint finish)
|
||||||
{
|
{
|
||||||
QPointF tp;
|
QPointF tp;
|
||||||
QVector<QPoint> srcPath;
|
QVector<QPoint> srcPath;
|
||||||
QVector<QPointF> tmpPath;
|
QVector<QPointF> tmpPath;
|
||||||
QVector<QPointF> path;
|
QVector<QPointF> path;
|
||||||
if (Cells[start.x()][start.y()] < 0)
|
if (Cells[start.x()][start.y()] < 0)
|
||||||
{
|
{
|
||||||
qDebug("ERROR invalid start");
|
qCritical("ERROR invalid start");
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
if (Cells[finish.x()][finish.y()] < 0)
|
if (Cells[finish.x()][finish.y()] < 0)
|
||||||
{
|
{
|
||||||
qDebug("ERROR invalid finish");
|
qCritical("ERROR invalid finish");
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
srcPath = invWaveTrace(finish,waveTrace(start,finish));
|
srcPath = invWaveTrace(finish,waveTrace(start,finish));
|
||||||
for (int i=0; i<srcPath.size();i++)
|
for (int i=0; i<srcPath.size();i++)
|
||||||
{
|
{
|
||||||
int x = Cells.at(srcPath.at(i).x()).at(srcPath.at(i).y());
|
int x = Cells.at(srcPath.at(i).x()).at(srcPath.at(i).y());
|
||||||
if (x > 0 && x < 1000) x = x+1000;
|
if (x > 0 && x < 1000) x = x+1000;
|
||||||
Cells[srcPath.at(i).x()][srcPath.at(i).y()] = x;
|
Cells[srcPath.at(i).x()][srcPath.at(i).y()] = x;
|
||||||
tmpPath.push_back(QPointF(srcPath.at(i)));
|
tmpPath.push_back(QPointF(srcPath.at(i)));
|
||||||
}
|
}
|
||||||
srcPath.clear();
|
srcPath.clear();
|
||||||
if (!tmpPath.isEmpty())
|
if (!tmpPath.isEmpty())
|
||||||
{
|
{
|
||||||
for (int j=0; j<4; j++)
|
for (int j=0; j<4; j++)
|
||||||
{
|
{
|
||||||
path.clear();
|
path.clear();
|
||||||
tp = tmpPath.at(0);
|
tp = tmpPath.at(0);
|
||||||
path.push_back(tp);
|
path.push_back(tp);
|
||||||
for (int i = 0; i < tmpPath.size() - 1; i++)
|
for (int i = 0; i < tmpPath.size() - 1; i++)
|
||||||
{
|
{
|
||||||
tp.setX((tmpPath.at(i).x() + tmpPath.at(i + 1).x()) / 2.0);
|
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);
|
tp.setY((tmpPath.at(i).y() + tmpPath.at(i + 1).y()) / 2.0);
|
||||||
path.push_back(tp);
|
path.push_back(tp);
|
||||||
}
|
}
|
||||||
tp = tmpPath.at(tmpPath.size() - 1);
|
tp = tmpPath.at(tmpPath.size() - 1);
|
||||||
path.push_back(tp);
|
path.push_back(tp);
|
||||||
tmpPath = path;
|
tmpPath = path;
|
||||||
}
|
}
|
||||||
tmpPath.clear();
|
tmpPath.clear();
|
||||||
if (path.size() >= 6)
|
if (path.size() >= 6)
|
||||||
{
|
{
|
||||||
path.remove(1);
|
path.remove(1);
|
||||||
path.remove(1);
|
path.remove(1);
|
||||||
path.remove(path.size()-2);
|
path.remove(path.size()-2);
|
||||||
path.remove(path.size()-2);
|
path.remove(path.size()-2);
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
path.clear();
|
path.clear();
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Map::waveTrace(QPoint start, QPoint finish)
|
int Map::waveTrace(QPoint start, QPoint finish)
|
||||||
{
|
{
|
||||||
bool stop = false;
|
bool stop = false;
|
||||||
int step = 2;
|
int step = 2;
|
||||||
QPoint cp, tp;
|
QPoint cp, tp;
|
||||||
QRect fr(QPoint(), mapSize);
|
QRect fr(QPoint(), mapSize);
|
||||||
QVector<QPoint> tmpp, curp;
|
QVector<QPoint> tmpp, curp;
|
||||||
TmpCells << Cells;
|
TmpCells << Cells;
|
||||||
for (int i = 0; i < Cells.size(); i++)
|
for (int i = 0; i < Cells.size(); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < Cells.at(i).size(); j++)
|
for (int j = 0; j < Cells.at(i).size(); j++)
|
||||||
{
|
{
|
||||||
if (Cells[i][j] < 0 ) TmpCells[i][j] = -1;
|
if (Cells[i][j] < 0 ) TmpCells[i][j] = -1;
|
||||||
else TmpCells[i][j] = 0;
|
else TmpCells[i][j] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cp = start;
|
cp = start;
|
||||||
curp.push_back(cp);
|
curp.push_back(cp);
|
||||||
TmpCells[cp.x()][cp.y()] = 1;
|
TmpCells[cp.x()][cp.y()] = 1;
|
||||||
//qDebug() << "trace";
|
//qDebug() << "trace";
|
||||||
while (!stop) {
|
while (!stop) {
|
||||||
tmpp = curp;
|
tmpp = curp;
|
||||||
curp.clear();
|
curp.clear();
|
||||||
stop = true;
|
stop = true;
|
||||||
for (int i = 0; i < tmpp.size(); i++) {
|
for (int i = 0; i < tmpp.size(); i++) {
|
||||||
cp = tmpp.at(i);
|
cp = tmpp.at(i);
|
||||||
if (cp == finish) {
|
if (cp == finish) {
|
||||||
TmpCells[cp.x()][cp.y()] = step;
|
TmpCells[cp.x()][cp.y()] = step;
|
||||||
//qDebug() << "trace done!";
|
//qDebug() << "trace done!";
|
||||||
return step;
|
return step;
|
||||||
}
|
}
|
||||||
tp.setX(cp.x() - 1);
|
tp.setX(cp.x() - 1);
|
||||||
tp.setY(cp.y());
|
tp.setY(cp.y());
|
||||||
if (fr.contains(tp)) {
|
if (fr.contains(tp)) {
|
||||||
if (TmpCells[tp.x()][tp.y()] == 0) {
|
if (TmpCells[tp.x()][tp.y()] == 0) {
|
||||||
TmpCells[tp.x()][tp.y()] = step;
|
TmpCells[tp.x()][tp.y()] = step;
|
||||||
curp.push_back(tp);
|
curp.push_back(tp);
|
||||||
stop = false;
|
stop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tp.setX(cp.x() + 1);
|
tp.setX(cp.x() + 1);
|
||||||
if (fr.contains(tp)) {
|
if (fr.contains(tp)) {
|
||||||
if (TmpCells[tp.x()][tp.y()] == 0) {
|
if (TmpCells[tp.x()][tp.y()] == 0) {
|
||||||
TmpCells[tp.x()][tp.y()] = step;
|
TmpCells[tp.x()][tp.y()] = step;
|
||||||
curp.push_back(tp);
|
curp.push_back(tp);
|
||||||
stop = false;
|
stop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tp.setX(cp.x());
|
tp.setX(cp.x());
|
||||||
tp.setY(cp.y() - 1);
|
tp.setY(cp.y() - 1);
|
||||||
if (fr.contains(tp)) {
|
if (fr.contains(tp)) {
|
||||||
if (TmpCells[tp.x()][tp.y()] == 0) {
|
if (TmpCells[tp.x()][tp.y()] == 0) {
|
||||||
TmpCells[tp.x()][tp.y()] = step;
|
TmpCells[tp.x()][tp.y()] = step;
|
||||||
curp.push_back(tp);
|
curp.push_back(tp);
|
||||||
stop = false;
|
stop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tp.setY(cp.y() + 1);
|
tp.setY(cp.y() + 1);
|
||||||
if (fr.contains(tp)) {
|
if (fr.contains(tp)) {
|
||||||
if (TmpCells[tp.x()][tp.y()] == 0) {
|
if (TmpCells[tp.x()][tp.y()] == 0) {
|
||||||
TmpCells[tp.x()][tp.y()] = step;
|
TmpCells[tp.x()][tp.y()] = step;
|
||||||
curp.push_back(tp);
|
curp.push_back(tp);
|
||||||
stop = false;
|
stop = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
step++;
|
step++;
|
||||||
}
|
}
|
||||||
qDebug() << "trace false";
|
qDebug() << "trace false";
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QVector<QPoint> Map::invWaveTrace(QPoint finish, int cnt)
|
QVector<QPoint> Map::invWaveTrace(QPoint finish, int cnt)
|
||||||
{
|
{
|
||||||
QPoint wp, Ppnt;
|
QPoint wp, Ppnt;
|
||||||
QVector<QPoint> alpath;
|
QVector<QPoint> alpath;
|
||||||
if (cnt < 2) return alpath;
|
if (cnt < 2) return alpath;
|
||||||
int Ind, c, xpp, ypp, xnn, ynn;
|
int Ind, c, xpp, ypp, xnn, ynn;
|
||||||
unsigned char chk;
|
unsigned char chk;
|
||||||
Ppnt = wp = finish;
|
Ppnt = wp = finish;
|
||||||
xnn=0;
|
xnn=0;
|
||||||
xpp=0;
|
xpp=0;
|
||||||
ynn=0;
|
ynn=0;
|
||||||
ypp=0;
|
ypp=0;
|
||||||
cnt--;
|
cnt--;
|
||||||
alpath.push_front(Ppnt);
|
alpath.push_front(Ppnt);
|
||||||
while (cnt > 1)
|
while (cnt > 1)
|
||||||
{
|
{
|
||||||
cnt--;
|
cnt--;
|
||||||
chk = 0;
|
chk = 0;
|
||||||
Ind = 0;
|
Ind = 0;
|
||||||
c = 0;
|
c = 0;
|
||||||
if (wp.x() - 1 >= 0 && TmpCells[wp.x()-1][wp.y()] == cnt)
|
if (wp.x() - 1 >= 0 && TmpCells[wp.x()-1][wp.y()] == cnt)
|
||||||
{
|
{
|
||||||
chk = chk | 0x01;
|
chk = chk | 0x01;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
if (wp.x() + 1 < mapSize.width() && TmpCells[wp.x()+1][wp.y()] == cnt)
|
if (wp.x() + 1 < mapSize.width() && TmpCells[wp.x()+1][wp.y()] == cnt)
|
||||||
{
|
{
|
||||||
chk = chk | 0x02;
|
chk = chk | 0x02;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
if (wp.y() - 1 >= 0 && TmpCells[wp.x()][wp.y()-1] == cnt)
|
if (wp.y() - 1 >= 0 && TmpCells[wp.x()][wp.y()-1] == cnt)
|
||||||
{
|
{
|
||||||
chk = chk | 0x04;
|
chk = chk | 0x04;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
if (wp.y() + 1 < mapSize.height() && TmpCells[wp.x()][wp.y()+1] == cnt)
|
if (wp.y() + 1 < mapSize.height() && TmpCells[wp.x()][wp.y()+1] == cnt)
|
||||||
{
|
{
|
||||||
chk = chk | 0x08;
|
chk = chk | 0x08;
|
||||||
c++;
|
c++;
|
||||||
}
|
}
|
||||||
if (c == 0 || chk == 0) qDebug("ERROR in InvWaveTrace"),exit(-1);
|
if (c == 0 || chk == 0) qDebug("ERROR in InvWaveTrace"),exit(-1);
|
||||||
if (c > 1)
|
if (c > 1)
|
||||||
{
|
{
|
||||||
if ((chk & 0x01)==0x01 && (chk & 0x04)==0x04)
|
if ((chk & 0x01)==0x01 && (chk & 0x04)==0x04)
|
||||||
{
|
{
|
||||||
if (xnn <= ynn && Ind == 0){
|
if (xnn <= ynn && Ind == 0){
|
||||||
wp.rx()--;
|
wp.rx()--;
|
||||||
xnn++;
|
xnn++;
|
||||||
if (xnn == ynn) xnn++;
|
if (xnn == ynn) xnn++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
} else if (Ind == 0) {
|
} else if (Ind == 0) {
|
||||||
wp.ry()--;
|
wp.ry()--;
|
||||||
ynn++;
|
ynn++;
|
||||||
ynn++;
|
ynn++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((chk & 0x02)==0x02 && (chk & 0x04)==0x04)
|
if ((chk & 0x02)==0x02 && (chk & 0x04)==0x04)
|
||||||
{
|
{
|
||||||
if (xpp <= ynn && Ind == 0){
|
if (xpp <= ynn && Ind == 0){
|
||||||
wp.rx()++;
|
wp.rx()++;
|
||||||
xpp++;
|
xpp++;
|
||||||
if (xpp == ynn) xpp++;
|
if (xpp == ynn) xpp++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
} else if (Ind == 0) {
|
} else if (Ind == 0) {
|
||||||
wp.ry()--;
|
wp.ry()--;
|
||||||
ynn++;
|
ynn++;
|
||||||
ynn++;
|
ynn++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((chk & 0x01)==0x01 && (chk & 0x08)==0x08)
|
if ((chk & 0x01)==0x01 && (chk & 0x08)==0x08)
|
||||||
{
|
{
|
||||||
if (xnn <= ypp && Ind == 0){
|
if (xnn <= ypp && Ind == 0){
|
||||||
wp.rx()--;
|
wp.rx()--;
|
||||||
xnn++;
|
xnn++;
|
||||||
if (xnn == ypp) xnn++;
|
if (xnn == ypp) xnn++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
} else if (Ind == 0) {
|
} else if (Ind == 0) {
|
||||||
wp.ry()++;
|
wp.ry()++;
|
||||||
ypp++;
|
ypp++;
|
||||||
ypp++;
|
ypp++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((chk & 0x02)==0x02 && (chk & 0x08)==0x08)
|
if ((chk & 0x02)==0x02 && (chk & 0x08)==0x08)
|
||||||
{
|
{
|
||||||
if (xpp <= ypp && Ind == 0){
|
if (xpp <= ypp && Ind == 0){
|
||||||
wp.rx()++;
|
wp.rx()++;
|
||||||
xpp++;
|
xpp++;
|
||||||
if (xpp == ypp) xpp++;
|
if (xpp == ypp) xpp++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
} else if (Ind == 0) {
|
} else if (Ind == 0) {
|
||||||
wp.ry()++;
|
wp.ry()++;
|
||||||
ypp++;
|
ypp++;
|
||||||
ypp++;
|
ypp++;
|
||||||
Ind = 1;
|
Ind = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (c == 1 || Ind == 0)
|
if (c == 1 || Ind == 0)
|
||||||
{
|
{
|
||||||
xnn=0;
|
xnn=0;
|
||||||
xpp=0;
|
xpp=0;
|
||||||
ynn=0;
|
ynn=0;
|
||||||
ypp=0;
|
ypp=0;
|
||||||
if ((chk & 0x01)==0x01) {
|
if ((chk & 0x01)==0x01) {
|
||||||
wp.rx()--;
|
wp.rx()--;
|
||||||
xnn++;
|
xnn++;
|
||||||
}
|
}
|
||||||
else if ((chk & 0x02)==0x02) {
|
else if ((chk & 0x02)==0x02) {
|
||||||
wp.rx()++;
|
wp.rx()++;
|
||||||
xpp++;
|
xpp++;
|
||||||
}
|
}
|
||||||
else if ((chk & 0x04)==0x04) {
|
else if ((chk & 0x04)==0x04) {
|
||||||
wp.ry()--;
|
wp.ry()--;
|
||||||
ynn++;
|
ynn++;
|
||||||
}
|
}
|
||||||
else if ((chk & 0x08)==0x08) {
|
else if ((chk & 0x08)==0x08) {
|
||||||
wp.ry()++;
|
wp.ry()++;
|
||||||
ypp++;
|
ypp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ppnt = wp;
|
Ppnt = wp;
|
||||||
alpath.push_front(Ppnt);
|
alpath.push_front(Ppnt);
|
||||||
}
|
}
|
||||||
return alpath;
|
return alpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
387
splashes.cpp
387
splashes.cpp
@@ -2,163 +2,164 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
Splashes::Splashes(Game_Data *gd, QObject *parent) :
|
Splashes::Splashes(Game_Data *gd, QObject *parent) :
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
gameData = gd;
|
gameData = gd;
|
||||||
nextId = 1;
|
nextId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Splashes::addSplash(int player, srcSplashType *src, QPointF pos, QPointF dest, int aim)
|
void Splashes::addSplash(int player, srcSplashType *src, QPointF pos, QPointF dest, int aim)
|
||||||
{
|
{
|
||||||
SplashType spl;
|
SplashType spl;
|
||||||
spl.id = nextId;
|
spl.id = nextId;
|
||||||
spl.towerId = QPoint(-1,-1);
|
spl.towerId = QPoint(-1,-1);
|
||||||
spl.srcTow = 0;
|
spl.srcTow = 0;
|
||||||
spl.PlayerId = player;
|
spl.PlayerId = player;
|
||||||
spl.AlienId = 0;
|
spl.AlienId = 0;
|
||||||
spl.pos = pos;
|
spl.pos = pos;
|
||||||
spl.destination = dest;
|
spl.destination = dest;
|
||||||
spl.AlienId = aim;
|
spl.AlienId = aim;
|
||||||
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
|
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
|
||||||
spl.life = 0;
|
spl.life = 0;
|
||||||
spl.src = src;
|
spl.src = src;
|
||||||
addSplash(&spl);
|
addSplash(&spl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Splashes::addSplash(const TowerType &tower)
|
void Splashes::addSplash(const TowerType &tower)
|
||||||
{
|
{
|
||||||
SplashType spl;
|
SplashType spl;
|
||||||
spl.src = &(tower.src->splashes[0]);
|
spl.src = &(tower.src->splashes[0]);
|
||||||
spl.id = nextId;
|
spl.id = nextId;
|
||||||
spl.towerId = tower.pos;
|
spl.towerId = tower.pos;
|
||||||
spl.PlayerId = tower.PlayerId;
|
spl.PlayerId = tower.PlayerId;
|
||||||
spl.AlienId = tower.aim;
|
spl.AlienId = tower.aim;
|
||||||
spl.srcTow = tower.src;
|
spl.srcTow = tower.src;
|
||||||
spl.pos = QPointF(tower.pos);
|
spl.pos = QPointF(tower.pos);
|
||||||
if (gameData->aliens->curAliens.contains(spl.AlienId))
|
if (gameData->aliens->curAliens.contains(spl.AlienId))
|
||||||
spl.destination = gameData->aliens->curAliens.value(spl.AlienId).pos+QPointF(0.5,0.5);
|
spl.destination = gameData->aliens->curAliens.value(spl.AlienId).pos+QPointF(0.5,0.5);
|
||||||
else {qCritical("aim alien not exists(!)");return;}
|
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.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
|
||||||
spl.life = 0;
|
spl.life = 0;
|
||||||
addSplash(&spl);
|
addSplash(&spl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Splashes::addSplash(srcTowerType *srctower, int id, QPointF pos, QPointF dest, int aim, QPoint towerId)
|
void Splashes::addSplash(srcTowerType *srctower, int id, QPointF pos, QPointF dest, int aim, QPoint towerId)
|
||||||
{
|
{
|
||||||
SplashType spl;
|
SplashType spl;
|
||||||
if (srctower != 0)
|
if (srctower != 0)
|
||||||
spl.src = &(srctower->splashes[id]);
|
spl.src = &(srctower->splashes[id]);
|
||||||
else spl.src = &(gameData->srcSplashes[id]);
|
else spl.src = &(gameData->srcSplashes[id]);
|
||||||
spl.id = nextId;
|
spl.id = nextId;
|
||||||
spl.towerId = towerId;
|
spl.towerId = towerId;
|
||||||
spl.PlayerId = srctower->PlayerId;
|
spl.PlayerId = srctower->PlayerId;
|
||||||
spl.AlienId = aim;
|
spl.AlienId = aim;
|
||||||
spl.pos = pos;
|
spl.pos = pos;
|
||||||
spl.destination = dest;
|
spl.destination = dest;
|
||||||
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
|
spl.angle = 180.0f*(- std::atan2(spl.pos.x() - spl.destination.x(),spl.pos.y() - spl.destination.y()))/M_PI;
|
||||||
spl.life = 0;
|
spl.life = 0;
|
||||||
spl.srcTow = srctower;
|
spl.srcTow = srctower;
|
||||||
addSplash(&spl);
|
addSplash(&spl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Splashes::addSplash(SplashType * spl)
|
void Splashes::addSplash(SplashType * spl)
|
||||||
{
|
{
|
||||||
srcTriggerType * trig;
|
srcTriggerType * trig;
|
||||||
for(int i=0; i<spl->src->triggerIndexes.size(); i++)
|
for(int i=0; i<spl->src->triggerIndexes.size(); i++)
|
||||||
{
|
{
|
||||||
TriggerOnDest tod;
|
TriggerOnDest tod;
|
||||||
TriggerOnAlien toa;
|
TriggerOnAlien toa;
|
||||||
TriggerOnTimer tot;
|
TriggerOnTimer tot;
|
||||||
if (spl->srcTow != 0)
|
if (spl->srcTow != 0)
|
||||||
trig = &(spl->srcTow->triggers[spl->src->triggerIndexes.at(i)]);
|
trig = &(spl->srcTow->triggers[spl->src->triggerIndexes.at(i)]);
|
||||||
else {qDebug("no parent tower"); trig = &(gameData->srcTriggers[spl->src->triggerIndexes.at(i)]);}
|
else {qDebug("no parent tower"); trig = &(gameData->srcTriggers[spl->src->triggerIndexes.at(i)]);}
|
||||||
switch (trig->type)
|
switch (trig->type)
|
||||||
{
|
{
|
||||||
case srcTriggerType::onDestination :
|
case srcTriggerType::onDestination :
|
||||||
tod.src = trig;
|
tod.src = trig;
|
||||||
spl->trigsOnDest.append(tod);
|
spl->trigsOnDest.append(tod);
|
||||||
break;
|
break;
|
||||||
case srcTriggerType::onAlienInRadius :
|
case srcTriggerType::onAlienInRadius :
|
||||||
toa.src = trig;
|
toa.src = trig;
|
||||||
spl->trigsOnAlien.append(toa);
|
spl->trigsOnAlien.append(toa);
|
||||||
break;
|
break;
|
||||||
case srcTriggerType::onTimer :
|
case srcTriggerType::onTimer :
|
||||||
tot.src = trig;
|
tot.src = trig;
|
||||||
tot.timer = 0;
|
tot.timer = 0;
|
||||||
spl->trigsOnTimer.append(tot);
|
spl->trigsOnTimer.append(tot);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
spl->item = new ADItem(spl->id, ADItem::Splash, spl->src->images);
|
spl->item = new ADItem(spl->id, ADItem::Splash, spl->src->images);
|
||||||
spl->item->setPos(spl->pos*cellSize);
|
spl->item->setPos(spl->pos*cellSize);
|
||||||
spl->item->setRotation(spl->angle);
|
spl->item->setRotation(spl->angle);
|
||||||
scene->addItem(spl->item);
|
scene->addItem(spl->item);
|
||||||
gameData->curSplashes.insert(spl->id,*spl);
|
gameData->curSplashes.insert(spl->id,*spl);
|
||||||
nextId++;
|
nextId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Splashes::update()
|
void Splashes::update()
|
||||||
{
|
{
|
||||||
QList <int> deadIndexes;
|
QHash<int,int> deadIndexes;
|
||||||
for (QHash<int, SplashType>::iterator
|
for (QHash<int, SplashType>::iterator
|
||||||
spl = gameData->curSplashes.begin();
|
spl = gameData->curSplashes.begin();
|
||||||
spl != gameData->curSplashes.end(); ++spl)
|
spl != gameData->curSplashes.end(); ++spl)
|
||||||
{
|
{
|
||||||
spl->life++;
|
spl->life++;
|
||||||
if (spl->life > spl->src->lifetime)
|
if (spl->life > spl->src->lifetime)
|
||||||
deadIndexes.append(spl->id);
|
deadIndexes.insert(spl->id,spl->id);
|
||||||
if (!spl->trigsOnTimer.isEmpty())
|
if (!spl->trigsOnTimer.isEmpty())
|
||||||
doTriggerOnTimer(spl,&deadIndexes);
|
doTriggerOnTimer(spl,&deadIndexes);
|
||||||
float arctg;
|
float arctg;
|
||||||
float speed = spl->src->speed;
|
float speed = spl->src->speed;
|
||||||
float speed2 = speed*speed;
|
float speed2 = speed*speed;
|
||||||
if (spl->src->autoControl && spl->AlienId != -1)
|
if (spl->src->autoControl && spl->AlienId != -1)
|
||||||
{
|
{
|
||||||
bool badAl = false;
|
bool badAl = false;
|
||||||
if (gameData->aliens->curAliens.contains(spl->AlienId))
|
if (gameData->aliens->curAliens.contains(spl->AlienId))
|
||||||
spl->destination = gameData->aliens->curAliens.value(spl->AlienId).pos+QPointF(0.5,0.5);
|
spl->destination = gameData->aliens->curAliens.value(spl->AlienId).pos+QPointF(0.5,0.5);
|
||||||
else {
|
else {
|
||||||
badAl = true;
|
badAl = true;
|
||||||
spl->AlienId = -1;
|
spl->AlienId = -1;
|
||||||
}
|
}
|
||||||
if (distance2(spl->pos, spl->destination) < speed2)
|
if (distance2(spl->pos, spl->destination) < speed2)
|
||||||
{
|
{
|
||||||
if (badAl)
|
if (badAl)
|
||||||
deadIndexes.push_back(spl->id);
|
deadIndexes.insert(spl->id,spl->id);
|
||||||
spl->pos = spl->destination;
|
spl->pos = spl->destination;
|
||||||
doTriggerOnDest(spl,&deadIndexes,badAl);
|
doTriggerOnDest(spl,&deadIndexes,badAl);
|
||||||
}
|
}
|
||||||
arctg = std::atan2(spl->pos.x() - spl->destination.x(),spl->pos.y() - spl->destination.y());
|
arctg = std::atan2(spl->pos.x() - spl->destination.x(),spl->pos.y() - spl->destination.y());
|
||||||
spl->angle = 180.0f*(-arctg)/M_PI;
|
spl->angle = 180.0f*(-arctg)/M_PI;
|
||||||
} else {
|
} else {
|
||||||
if (!gameData->map->rect().contains(spl->pos.toPoint()))
|
if (!gameData->map->rect().contains(spl->pos.toPoint()))
|
||||||
deadIndexes.push_back(spl->id);
|
deadIndexes.insert(spl->id,spl->id);
|
||||||
if (!spl->trigsOnDest.isEmpty())
|
if (!spl->trigsOnDest.isEmpty())
|
||||||
{
|
{
|
||||||
if (distance2(spl->pos, spl->destination) < speed2)
|
if (distance2(spl->pos, spl->destination) < speed2)
|
||||||
{
|
{
|
||||||
spl->pos = spl->destination;
|
spl->pos = spl->destination;
|
||||||
doTriggerOnDest(spl,&deadIndexes,true);
|
doTriggerOnDest(spl,&deadIndexes,true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
arctg = -spl->angle*M_PI/180.f;
|
arctg = -spl->angle*M_PI/180.f;
|
||||||
}
|
}
|
||||||
spl->pos.rx() -= speed*std::sin(arctg);
|
spl->pos.rx() -= speed*std::sin(arctg);
|
||||||
spl->pos.ry() -= speed*std::cos(arctg);
|
spl->pos.ry() -= speed*std::cos(arctg);
|
||||||
/// TODO: smooth splash rotate
|
/// TODO: smooth splash rotate
|
||||||
spl->item->setPos(spl->pos*cellSize);
|
spl->item->setPos(spl->pos*cellSize);
|
||||||
spl->item->setRotation(spl->angle);
|
spl->item->setRotation(spl->angle);
|
||||||
if (speed == 0) spl->item->next(1.f);
|
if (speed == 0) spl->item->next(1.f);
|
||||||
else spl->item->next(speed*cellSize);
|
else spl->item->next(speed*cellSize);
|
||||||
}
|
}
|
||||||
for (int j=0; j<deadIndexes.size(); j++)
|
for (QHash<int,int>::iterator j = deadIndexes.begin();
|
||||||
delSplash(deadIndexes.at(j));
|
j != deadIndexes.end(); ++j)
|
||||||
|
delSplash(*j);
|
||||||
for (QHash<int,DeadAlienIndex>::iterator j = dead.begin();
|
for (QHash<int,DeadAlienIndex>::iterator j = dead.begin();
|
||||||
j != dead.end(); ++j)
|
j != dead.end(); ++j)
|
||||||
emit killAlien(j->player,j->id);
|
emit killAlien(j->player,j->id);
|
||||||
@@ -168,28 +169,28 @@ void Splashes::update()
|
|||||||
|
|
||||||
void Splashes::delSplash(int Id)
|
void Splashes::delSplash(int Id)
|
||||||
{
|
{
|
||||||
scene->removeItem(gameData->curSplashes[Id].item);
|
scene->removeItem(gameData->curSplashes[Id].item);
|
||||||
delete gameData->curSplashes[Id].item;
|
delete gameData->curSplashes[Id].item;
|
||||||
gameData->curSplashes.remove(Id);
|
gameData->curSplashes.remove(Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// FIXME : correct onTrigTimer()
|
/// FIXME : correct onTrigTimer()
|
||||||
void Splashes::doTriggerOnTimer(QHash<int, SplashType>::iterator
|
void Splashes::doTriggerOnTimer(QHash<int, SplashType>::iterator
|
||||||
spl, QList<int> *deadIndexes)
|
spl, QHash<int,int> *deadIndexes)
|
||||||
{
|
{
|
||||||
for(QList<TriggerOnTimer>::iterator i = spl->trigsOnTimer.begin();
|
for(QList<TriggerOnTimer>::iterator i = spl->trigsOnTimer.begin();
|
||||||
i != spl->trigsOnTimer.end(); ++i)
|
i != spl->trigsOnTimer.end(); ++i)
|
||||||
{
|
{
|
||||||
srcTriggerType * strig = i->src;
|
srcTriggerType * strig = i->src;
|
||||||
i->timer++;
|
i->timer++;
|
||||||
if (i->timer >= strig->timer)
|
if (i->timer >= strig->timer)
|
||||||
{
|
{
|
||||||
/// TODO : add damage and other effects
|
/// TODO : add damage and other effects
|
||||||
i->timer = 0;
|
i->timer = 0;
|
||||||
if (strig->delParent) deadIndexes->append(spl->id);
|
if (strig->delParent) deadIndexes->insert(spl->id,spl->id);
|
||||||
if (strig->count > 0 && strig->childId > 0)
|
if (strig->count > 0 && strig->childId > 0)
|
||||||
{
|
{
|
||||||
int aim;
|
int aim;
|
||||||
switch(strig->childAim)
|
switch(strig->childAim)
|
||||||
{
|
{
|
||||||
@@ -199,65 +200,65 @@ void Splashes::doTriggerOnTimer(QHash<int, SplashType>::iterator
|
|||||||
default : aim = -1;
|
default : aim = -1;
|
||||||
}
|
}
|
||||||
for (int j=0; j<strig->count; ++j)
|
for (int j=0; j<strig->count; ++j)
|
||||||
{
|
{
|
||||||
/// TODO: randomRadiusPos
|
/// TODO: randomRadiusPos
|
||||||
addSplash(spl->srcTow, strig->childId, spl->pos, spl->destination, aim, spl->towerId);
|
addSplash(spl->srcTow, strig->childId, spl->pos, spl->destination, aim, spl->towerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Splashes::doTriggerOnDest(QHash<int, SplashType>::iterator
|
void Splashes::doTriggerOnDest(QHash<int, SplashType>::iterator
|
||||||
spl, QList<int> *deadIndexes,
|
spl, QHash<int,int> *deadIndexes,
|
||||||
bool badAl)
|
bool badAl)
|
||||||
{
|
{
|
||||||
foreach(TriggerOnDest t, spl->trigsOnDest)
|
foreach(TriggerOnDest t, spl->trigsOnDest)
|
||||||
{
|
{
|
||||||
/// TODO: different aims for childs
|
/// TODO: different aims for childs
|
||||||
if (t.src->delParent) deadIndexes->append(spl->id);
|
if (t.src->delParent) deadIndexes->insert(spl->id,spl->id);
|
||||||
int aim;
|
int aim;
|
||||||
switch(t.src->childAim)
|
switch(t.src->childAim)
|
||||||
{
|
{
|
||||||
case srcTriggerType::parentAim : aim = spl->AlienId; break;
|
case srcTriggerType::parentAim : aim = spl->AlienId; break;
|
||||||
/// TODO : other aim types
|
/// TODO : other aim types
|
||||||
case srcTriggerType::noAim : aim = -1; break;
|
case srcTriggerType::noAim : aim = -1; break;
|
||||||
default : aim = -1;
|
default : aim = -1;
|
||||||
}
|
}
|
||||||
if (t.src->count > 0 && t.src->childId > 0)
|
if (t.src->count > 0 && t.src->childId > 0)
|
||||||
{
|
{
|
||||||
for (int j=0; j<t.src->count; ++j)
|
for (int j=0; j<t.src->count; ++j)
|
||||||
{
|
{
|
||||||
/// TODO: randomRadiusPos
|
/// TODO: randomRadiusPos
|
||||||
addSplash(spl->srcTow,t.src->childId,
|
addSplash(spl->srcTow,t.src->childId,
|
||||||
spl->pos,spl->destination,aim,spl->towerId);
|
spl->pos,spl->destination,aim,spl->towerId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
float dmg = t.src->damage;
|
float dmg = t.src->damage;
|
||||||
float rad = t.src->radius;
|
float rad = t.src->radius;
|
||||||
if (dmg > 0)
|
if (dmg > 0)
|
||||||
{
|
{
|
||||||
float hh;
|
float hh;
|
||||||
if (!(rad > 0))
|
if (!(rad > 0))
|
||||||
{
|
{
|
||||||
if (!badAl)
|
if (!badAl)
|
||||||
{
|
{
|
||||||
hh = gameData->aliens->curAliens[spl->AlienId].health -= dmg;
|
hh = gameData->aliens->curAliens[spl->AlienId].health -= dmg;
|
||||||
if (hh <= 0) dead.insert(spl->AlienId, DeadAlienIndex(spl->AlienId, spl->PlayerId));
|
if (hh <= 0) dead.insert(spl->AlienId, DeadAlienIndex(spl->AlienId, spl->PlayerId));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (QHash<int, AlienType>::iterator
|
for (QHash<int, AlienType>::iterator
|
||||||
i = gameData->aliens->curAliens.begin();
|
i = gameData->aliens->curAliens.begin();
|
||||||
i != gameData->aliens->curAliens.end(); ++i)
|
i != gameData->aliens->curAliens.end(); ++i)
|
||||||
{
|
{
|
||||||
if (distance2(spl->pos, i->pos) < rad*rad)
|
if (distance2(spl->pos, i->pos) < rad*rad)
|
||||||
{
|
{
|
||||||
hh = i->health -= dmg;
|
hh = i->health -= dmg;
|
||||||
if (hh <= 0) dead.insert(i->id, DeadAlienIndex(i->id, spl->PlayerId));
|
if (hh <= 0) dead.insert(i->id, DeadAlienIndex(i->id, spl->PlayerId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
36
splashes.h
36
splashes.h
@@ -5,28 +5,28 @@
|
|||||||
|
|
||||||
class Splashes : public QObject
|
class Splashes : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit Splashes(Game_Data * gd, QObject *parent = 0);
|
explicit Splashes(Game_Data * gd, QObject *parent = 0);
|
||||||
void delSplash(int Id);
|
void delSplash(int Id);
|
||||||
void update();
|
void update();
|
||||||
void setScene(QGraphicsScene * scene_) {scene = scene_;}
|
void setScene(QGraphicsScene * scene_) {scene = scene_;}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
/// TODO : fix killalien - new function for adding alien in kill list and del aliens in finish update
|
/// 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:
|
public slots:
|
||||||
void addSplash(int player, srcSplashType * src, QPointF pos, QPointF dest, int aim = -1);
|
void addSplash(int player, srcSplashType * src, QPointF pos, QPointF dest, int aim = -1);
|
||||||
void addSplash(const TowerType &tower);
|
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(srcTowerType * srctower, int id, QPointF pos, QPointF dest, int aim = -1, QPoint towerId = QPoint(-1,-1));
|
||||||
void addSplash(SplashType *spl);
|
void addSplash(SplashType *spl);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
QGraphicsScene * scene;
|
QGraphicsScene * scene;
|
||||||
Game_Data *gameData;
|
Game_Data *gameData;
|
||||||
int nextId;
|
int nextId;
|
||||||
struct DeadAlienIndex
|
struct DeadAlienIndex
|
||||||
{
|
{
|
||||||
DeadAlienIndex(int i, int p) {id = i; player = p;}
|
DeadAlienIndex(int i, int p) {id = i; player = p;}
|
||||||
@@ -35,11 +35,11 @@ private:
|
|||||||
};
|
};
|
||||||
QHash <int, DeadAlienIndex> dead;
|
QHash <int, DeadAlienIndex> dead;
|
||||||
|
|
||||||
void doTriggerOnDest(QHash<int, SplashType>::iterator
|
void doTriggerOnDest(QHash<int, SplashType>::iterator
|
||||||
spl, QList <int> * deadIndexes,
|
spl, QHash<int,int> * deadIndexes,
|
||||||
bool badAl);
|
bool badAl);
|
||||||
void doTriggerOnTimer(QHash<int, SplashType>::iterator
|
void doTriggerOnTimer(QHash<int, SplashType>::iterator
|
||||||
spl, QList <int> * deadIndexes);
|
spl, QHash<int,int> * deadIndexes);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SPLASHES_H
|
#endif // SPLASHES_H
|
||||||
|
|||||||
Reference in New Issue
Block a user