summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2015-03-17 17:15:36 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2015-03-17 17:15:36 -0400
commitaf9488a0a557e79dbf69c0b433e90a44fedb06a8 (patch)
tree85cadaeb3c553bf21660862da3f5980a6c8bda91
parent42c18bdf3bcb61da246e218985cd498dbc24541e (diff)
downloadtherapy-af9488a0a557e79dbf69c0b433e90a44fedb06a8.tar.gz
therapy-af9488a0a557e79dbf69c0b433e90a44fedb06a8.tar.bz2
therapy-af9488a0a557e79dbf69c0b433e90a44fedb06a8.zip
Fixed bug with placing entities in map editor
-rw-r--r--res/maps.xml6
-rw-r--r--tools/mapedit/src/widget.cpp20
2 files changed, 13 insertions, 13 deletions
diff --git a/res/maps.xml b/res/maps.xml index 4fdb43e..114ab00 100644 --- a/res/maps.xml +++ b/res/maps.xml
@@ -1,5 +1,5 @@
1<?xml version="1.0" encoding="ISO-8859-1"?> 1<?xml version="1.0" encoding="ISO-8859-1"?>
2<world><nextmapid>4</nextmapid><lastmap>0</lastmap><root>0</root><root>2</root><startpos id="2" pos="141,66"/><map id="0"><name>Everything Is Embarrassing</name><environment>0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,18,9,8,10,8,11,8,10,10,8,11,8,9,10,21,0, 2<world><nextmapid>4</nextmapid><lastmap>0</lastmap><root>0</root><root>2</root><startpos id="0" pos="203,44"/><map id="0"><name>Everything Is Embarrassing</name><environment>0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,18,9,8,10,8,11,8,10,10,8,11,8,9,10,21,0,
30,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,22,21, 30,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,22,21,
40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, 40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,8,8,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,
50,19,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, 50,19,0,0,0,0,0,0,0,0,0,0,0,18,8,8,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,
@@ -23,7 +23,7 @@
230,0,0,0,24,3,1,2,1,1,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,27,1,3,2,26,0,0,0,0,0,0, 230,0,0,0,24,3,1,2,1,1,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,27,1,3,2,26,0,0,0,0,0,0,
241,2,3,1,25,0,0,0,0,0,20,0,0,0,0,0,0,19,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,27,1,2,2,4,3,1, 241,2,3,1,25,0,0,0,0,0,20,0,0,0,0,0,0,19,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,27,1,2,2,4,3,1,
250,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0, 250,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,
26</environment><leftmap>1</leftmap><rightmap></rightmap><entities><entity><entity-type>checkpoint</entity-type><entity-position>164,62</entity-position></entity></entities><child>1</child><child>3</child><expanded>1</expanded></map><map id="1"><name>It's A Trap!</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 26</environment><leftmap>1</leftmap><rightmap></rightmap><entities/><child>1</child><child>3</child><expanded>1</expanded></map><map id="1"><name>It's A Trap!</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0, 270,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,
280,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0, 280,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,19,0,0,0,0,0,0,0,0,0,0,0,0,0,
290,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 290,0,0,0,0,0,0,19,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@@ -47,7 +47,7 @@
470,0,0,27,2,2,3,3,3,4,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 470,0,0,27,2,2,3,3,3,4,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
480,20,0,0,0,0,0,19,0,0,27,1,1,1,2,2,2,26,0,0,0,0,0,0,0,0,0,0,24,4,2,2,1,3,2,2,1,2,2,3, 480,20,0,0,0,0,0,19,0,0,27,1,1,1,2,2,2,26,0,0,0,0,0,0,0,0,0,0,24,4,2,2,1,3,2,2,1,2,2,3,
490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,42,42,42,42,42,42,42,42,42,42,12,0,0,0,0,0,19,0,0,0,0,0, 490,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,42,42,42,42,42,42,42,42,42,42,12,0,0,0,0,0,19,0,0,0,0,0,
50</environment><leftmap></leftmap><rightmap>0</rightmap><entities/></map><map id="2"><name>junk</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 50</environment><leftmap></leftmap><rightmap>0</rightmap><entities><entity><entity-type>checkpoint</entity-type><entity-position>262,156</entity-position></entity></entities></map><map id="2"><name>junk</name><environment>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
510,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 510,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 530,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
diff --git a/tools/mapedit/src/widget.cpp b/tools/mapedit/src/widget.cpp index cb10489..3b96281 100644 --- a/tools/mapedit/src/widget.cpp +++ b/tools/mapedit/src/widget.cpp
@@ -234,8 +234,8 @@ void MapeditWidget::OnClick(wxMouseEvent& event)
234 { 234 {
235 if (addingEntity != nullptr) 235 if (addingEntity != nullptr)
236 { 236 {
237 int x = (event.GetPosition().x + vX) / scale - (addingEntity->getWidth() / 2); 237 int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale - (addingEntity->getWidth() / 2);
238 int y = (event.GetPosition().y + vY) / scale - (addingEntity->getHeight() / 2); 238 int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale - (addingEntity->getHeight() / 2);
239 239
240 auto data = std::make_shared<MapObjectEntry>(); 240 auto data = std::make_shared<MapObjectEntry>();
241 data->object = addingEntity; 241 data->object = addingEntity;
@@ -255,8 +255,8 @@ void MapeditWidget::OnClick(wxMouseEvent& event)
255 addingEntity = nullptr; 255 addingEntity = nullptr;
256 } else if (movingEntity != nullptr) 256 } else if (movingEntity != nullptr)
257 { 257 {
258 int x = (event.GetPosition().x + vX) / scale - (movingEntity->object->getWidth() / 2); 258 int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale - (movingEntity->object->getWidth() / 2);
259 int y = (event.GetPosition().y + vY) / scale - (movingEntity->object->getHeight() / 2); 259 int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale - (movingEntity->object->getHeight() / 2);
260 auto oldPos = movingEntity->position; 260 auto oldPos = movingEntity->position;
261 MapObjectEntry* me = movingEntity; 261 MapObjectEntry* me = movingEntity;
262 262
@@ -273,8 +273,8 @@ void MapeditWidget::OnClick(wxMouseEvent& event)
273 frame->SetIsAddingEntity(false); 273 frame->SetIsAddingEntity(false);
274 movingEntity = nullptr; 274 movingEntity = nullptr;
275 } else { 275 } else {
276 int x = (event.GetPosition().x + vX) / scale; 276 int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale;
277 int y = (event.GetPosition().y + vY) / scale; 277 int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale;
278 278
279 if (selectedEntity) 279 if (selectedEntity)
280 { 280 {
@@ -307,8 +307,8 @@ void MapeditWidget::OnClick(wxMouseEvent& event)
307 307
308 if (isSettingPos) 308 if (isSettingPos)
309 { 309 {
310 int x = (event.GetPosition().x + vX) / scale - (PLAYER_WIDTH[currentPlayer] / 2); 310 int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale - (PLAYER_WIDTH[currentPlayer] / 2);
311 int y = (event.GetPosition().y + vY) / scale - (PLAYER_HEIGHT[currentPlayer] / 2); 311 int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale - (PLAYER_HEIGHT[currentPlayer] / 2);
312 auto oldPos = map->getWorld()->getStartingPosition(); 312 auto oldPos = map->getWorld()->getStartingPosition();
313 auto oldSMap = map->getWorld()->getStartingMap(); 313 auto oldSMap = map->getWorld()->getStartingMap();
314 314
@@ -344,8 +344,8 @@ void MapeditWidget::OnRightClick(wxMouseEvent& event)
344 vX *= vXX; 344 vX *= vXX;
345 vY *= vYX; 345 vY *= vYX;
346 346
347 int x = (event.GetPosition().x + vX) / scale; 347 int x = (event.GetPosition().x + vX - EDITOR_SPACING_X*scale) / scale;
348 int y = (event.GetPosition().y + vY) / scale; 348 int y = (event.GetPosition().y + vY - EDITOR_SPACING_Y*scale) / scale;
349 349
350 if ((x > selectedEntity->position.first) && (x < selectedEntity->position.first + selectedEntity->object->getWidth()) 350 if ((x > selectedEntity->position.first) && (x < selectedEntity->position.first + selectedEntity->object->getWidth())
351 && (y > selectedEntity->position.second) && (y < selectedEntity->position.second + selectedEntity->object->getHeight())) 351 && (y > selectedEntity->position.second) && (y < selectedEntity->position.second + selectedEntity->object->getHeight()))