diff --git a/WorldEditor/EditInfos.cpp b/WorldEditor/EditInfos.cpp
index 3edec0b..a8b0674 100644
--- a/WorldEditor/EditInfos.cpp
+++ b/WorldEditor/EditInfos.cpp
@@ -304,6 +304,11 @@ int CMainFrame::GetInsertGapBetweenModel() const
return ui.spinInsertGap->value();
}
+int CMainFrame::GetInsertNombreModelCercle() const
+{
+ return ui.spinNombreModelCercle->value();
+}
+
void CMainFrame::GetWaterEditInfos(int& mode, byte& waterHeight, byte& waterTexture, int& size)
{
mode = WTYPE_NONE;
diff --git a/WorldEditor/MainFrame.h b/WorldEditor/MainFrame.h
index e5ed70a..b0b8529 100644
--- a/WorldEditor/MainFrame.h
+++ b/WorldEditor/MainFrame.h
@@ -94,6 +94,7 @@ class CMainFrame : public QMainWindow
int GetInsertRectLength() const;
int GetInsertCercleRadius() const;
int GetInsertGapBetweenModel() const;
+ int GetInsertNombreModelCercle() const;
void GetWaterEditInfos(int& mode, byte& waterHeight, byte& waterTexture, int& size);
void GetTerrainHeightEditInfos(int& mode, bool& rounded, int& radius, int& hardness, bool& useFixedheight, float& fixedHeight, int& attribute);
int GetTerrainHeightEditMode() const;
diff --git a/WorldEditor/MainFrame.ui b/WorldEditor/MainFrame.ui
index 08c03ab..497bf72 100644
--- a/WorldEditor/MainFrame.ui
+++ b/WorldEditor/MainFrame.ui
@@ -654,7 +654,7 @@
255
- 255
+ 250
Qt::Horizontal
@@ -979,16 +979,16 @@
-
-
+
- Multi Suffle
+ Multiple
-
-
+
- Multiple
+ Multi Suffle
@@ -1108,14 +1108,21 @@
-
-
-
+
-
radius:
- -
+
-
+
+
+ 10
+
+
+
+ -
1
@@ -1131,10 +1138,20 @@
- -
-
+
-
+
- 10
+ Nombre de model:
+
+
+
+ -
+
+
+ 1
+
+
+ 5
diff --git a/WorldEditor/WorldEditor.cpp b/WorldEditor/WorldEditor.cpp
index fcc60b2..2f8fdaa 100644
--- a/WorldEditor/WorldEditor.cpp
+++ b/WorldEditor/WorldEditor.cpp
@@ -363,11 +363,11 @@ void CWorldEditor::mousePressEvent(QMouseEvent* event)
}
else if (modeInsert == EInsertMode::INSERT_MULTIPLE || modeInsert == EInsertMode::INSERT_SUFFLE)
{
+ int gap = MainFrame->GetInsertGapBetweenModel();
if (modeGeo == EInsertionGeometry::INSERT_GEO_RECT)
{
int length = MainFrame->GetInsertRectLength();
int width = MainFrame->GetInsertRectWidth();
- int gap = MainFrame->GetInsertGapBetweenModel();
int px = obj->m_pos.x - ((gap * length) / 2);
int pz = obj->m_pos.z - ((gap * width) / 2);
@@ -409,6 +409,47 @@ void CWorldEditor::mousePressEvent(QMouseEvent* event)
}
}
}
+ else if (modeGeo == EInsertionGeometry::INSERT_GEO_CERCLE)
+ {
+ int nombreModel = MainFrame->GetInsertNombreModelCercle();
+ int radius = MainFrame->GetInsertCercleRadius();
+ float angle = 360 / nombreModel; // nombre de models
+
+ for (unsigned int teta = angle; teta <= 360; teta += angle)
+ {
+ double x, z;
+ if (modeInsert == EInsertMode::INSERT_MULTIPLE)
+ {
+ x = qCos(qDegreesToRadians(static_cast(teta)));
+ z = qSin(qDegreesToRadians(static_cast(teta)));
+ }
+ else if (modeInsert == EInsertMode::INSERT_SUFFLE)
+ {
+ float tetaX = qrand() % 360;
+ float tetaZ = qrand() % 360;
+ x = qCos(qDegreesToRadians(static_cast(tetaX)));
+ z = qSin(qDegreesToRadians(static_cast(tetaZ)));
+ }
+
+ CObject* newObj = CObject::CreateObject(obj->m_type, obj);
+ D3DXVECTOR3 newPos = newObj->m_pos;
+ newPos.x += (radius * (x * 100)) / 100;
+ newPos.z += (radius * (z * 100)) / 100;
+ newPos.y = m_world->GetHeight(newPos.x, newPos.z);
+ newObj->SetPos(newPos);
+
+ if (obj->m_type == OT_MOVER || obj->m_type == OT_ITEM || obj->m_type == OT_CTRL)
+ {
+ CSpawnObject* dyna = ((CSpawnObject*)newObj);
+ dyna->m_rect = QRect(QPoint(
+ (int)(newObj->m_pos.z + 0.5f),
+ (int)(newObj->m_pos.x + 0.5f)) + dyna->m_rect.topLeft(),
+ dyna->m_rect.size()
+ );
+ }
+ newObjs.push_back(newObj);
+ }
+ }
}
// Add the new objects