add HealLocation fly spots
This commit is contained in:
parent
6f3c5c25dd
commit
67f7fca399
15 changed files with 295 additions and 56 deletions
1
editor.h
1
editor.h
|
@ -130,6 +130,7 @@ private:
|
||||||
void updateMirroredConnection(Connection*, QString, QString, bool isDelete = false);
|
void updateMirroredConnection(Connection*, QString, QString, bool isDelete = false);
|
||||||
Event* createNewObjectEvent();
|
Event* createNewObjectEvent();
|
||||||
Event* createNewWarpEvent();
|
Event* createNewWarpEvent();
|
||||||
|
Event* createNewHealLocationEvent();
|
||||||
Event* createNewCoordScriptEvent();
|
Event* createNewCoordScriptEvent();
|
||||||
Event* createNewCoordWeatherEvent();
|
Event* createNewCoordWeatherEvent();
|
||||||
Event* createNewSignEvent();
|
Event* createNewSignEvent();
|
||||||
|
|
28
event.cpp
28
event.cpp
|
@ -1,4 +1,5 @@
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
#include "map.h"
|
||||||
|
|
||||||
QString EventType::Object = "event_object";
|
QString EventType::Object = "event_object";
|
||||||
QString EventType::Warp = "event_warp";
|
QString EventType::Warp = "event_warp";
|
||||||
|
@ -7,6 +8,7 @@ QString EventType::CoordWeather = "event_trap_weather";
|
||||||
QString EventType::Sign = "event_sign";
|
QString EventType::Sign = "event_sign";
|
||||||
QString EventType::HiddenItem = "event_hidden_item";
|
QString EventType::HiddenItem = "event_hidden_item";
|
||||||
QString EventType::SecretBase = "event_secret_base";
|
QString EventType::SecretBase = "event_secret_base";
|
||||||
|
QString EventType::HealLocation = "event_heal_location";
|
||||||
|
|
||||||
Event::Event()
|
Event::Event()
|
||||||
{
|
{
|
||||||
|
@ -19,6 +21,8 @@ Event* Event::createNewEvent(QString event_type, QString map_name)
|
||||||
event = createNewObjectEvent();
|
event = createNewObjectEvent();
|
||||||
} else if (event_type == EventType::Warp) {
|
} else if (event_type == EventType::Warp) {
|
||||||
event = createNewWarpEvent(map_name);
|
event = createNewWarpEvent(map_name);
|
||||||
|
} else if (event_type == EventType::HealLocation) {
|
||||||
|
event = createNewHealLocationEvent(map_name);
|
||||||
} else if (event_type == EventType::CoordScript) {
|
} else if (event_type == EventType::CoordScript) {
|
||||||
event = createNewCoordScriptEvent();
|
event = createNewCoordScriptEvent();
|
||||||
} else if (event_type == EventType::CoordWeather) {
|
} else if (event_type == EventType::CoordWeather) {
|
||||||
|
@ -64,6 +68,15 @@ Event* Event::createNewWarpEvent(QString map_name)
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event* Event::createNewHealLocationEvent(QString map_name)
|
||||||
|
{
|
||||||
|
Event *event = new Event;
|
||||||
|
event->put("event_group_type", "heal_event_group");
|
||||||
|
event->put("event_type", EventType::HealLocation);
|
||||||
|
event->put("loc_name", QString(Map::mapConstantFromName(map_name)).remove(0,4));
|
||||||
|
return event;
|
||||||
|
}
|
||||||
|
|
||||||
Event* Event::createNewCoordScriptEvent()
|
Event* Event::createNewCoordScriptEvent()
|
||||||
{
|
{
|
||||||
Event *event = new Event;
|
Event *event = new Event;
|
||||||
|
@ -150,6 +163,21 @@ QString Event::buildWarpEventMacro(QMap<QString, QString> *mapNamesToMapConstant
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HealLocation Event::buildHealLocation()
|
||||||
|
{
|
||||||
|
HealLocation hl;
|
||||||
|
hl.name = this->get("loc_name");
|
||||||
|
try {
|
||||||
|
hl.index = this->get("index").toInt();
|
||||||
|
}
|
||||||
|
catch(...) {
|
||||||
|
hl.index = 0;
|
||||||
|
}
|
||||||
|
hl.x = this->get("x").toInt();
|
||||||
|
hl.y = this->get("y").toInt();
|
||||||
|
return hl;
|
||||||
|
}
|
||||||
|
|
||||||
QString Event::buildCoordScriptEventMacro()
|
QString Event::buildCoordScriptEventMacro()
|
||||||
{
|
{
|
||||||
QString text = "";
|
QString text = "";
|
||||||
|
|
4
event.h
4
event.h
|
@ -1,6 +1,7 @@
|
||||||
#ifndef EVENT_H
|
#ifndef EVENT_H
|
||||||
#define EVENT_H
|
#define EVENT_H
|
||||||
|
|
||||||
|
#include "heallocation.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
@ -16,6 +17,7 @@ public:
|
||||||
static QString Sign;
|
static QString Sign;
|
||||||
static QString HiddenItem;
|
static QString HiddenItem;
|
||||||
static QString SecretBase;
|
static QString SecretBase;
|
||||||
|
static QString HealLocation;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Event
|
class Event
|
||||||
|
@ -54,6 +56,7 @@ public:
|
||||||
static Event* createNewEvent(QString, QString);
|
static Event* createNewEvent(QString, QString);
|
||||||
static Event* createNewObjectEvent();
|
static Event* createNewObjectEvent();
|
||||||
static Event* createNewWarpEvent(QString);
|
static Event* createNewWarpEvent(QString);
|
||||||
|
static Event* createNewHealLocationEvent(QString);
|
||||||
static Event* createNewCoordScriptEvent();
|
static Event* createNewCoordScriptEvent();
|
||||||
static Event* createNewCoordWeatherEvent();
|
static Event* createNewCoordWeatherEvent();
|
||||||
static Event* createNewSignEvent();
|
static Event* createNewSignEvent();
|
||||||
|
@ -62,6 +65,7 @@ public:
|
||||||
|
|
||||||
QString buildObjectEventMacro(int);
|
QString buildObjectEventMacro(int);
|
||||||
QString buildWarpEventMacro(QMap<QString, QString>*);
|
QString buildWarpEventMacro(QMap<QString, QString>*);
|
||||||
|
HealLocation buildHealLocation();
|
||||||
QString buildCoordScriptEventMacro();
|
QString buildCoordScriptEventMacro();
|
||||||
QString buildCoordWeatherEventMacro();
|
QString buildCoordWeatherEventMacro();
|
||||||
QString buildSignEventMacro();
|
QString buildSignEventMacro();
|
||||||
|
|
19
heallocation.cpp
Normal file
19
heallocation.cpp
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#include "heallocation.h"
|
||||||
|
|
||||||
|
//HealLocation::HealLocation() {}
|
||||||
|
|
||||||
|
HealLocation::HealLocation(QString map, int i, size_t x0, size_t y0) {
|
||||||
|
|
||||||
|
name = map;
|
||||||
|
index = i;
|
||||||
|
x = x0;
|
||||||
|
y = y0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QDebug operator<<(QDebug debug, const HealLocation &hl) {
|
||||||
|
|
||||||
|
debug << "HealLocation_" + hl.name << "(" << hl.x << ',' << hl.y << ")";
|
||||||
|
return debug;
|
||||||
|
|
||||||
|
}
|
23
heallocation.h
Normal file
23
heallocation.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef HEALLOCATION_H
|
||||||
|
#define HEALLOCATION_H
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
class HealLocation {
|
||||||
|
|
||||||
|
public:
|
||||||
|
HealLocation()=default;
|
||||||
|
HealLocation(QString, int, size_t, size_t);
|
||||||
|
friend QDebug operator<<(QDebug debug, const HealLocation &hl);
|
||||||
|
|
||||||
|
public:
|
||||||
|
//QString group;
|
||||||
|
QString name;
|
||||||
|
int index;
|
||||||
|
size_t x;
|
||||||
|
size_t y;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // HEALLOCATION_H
|
|
@ -862,12 +862,17 @@ void MainWindow::on_toolButton_deleteObject_clicked()
|
||||||
if (editor && editor->selected_events) {
|
if (editor && editor->selected_events) {
|
||||||
if (editor->selected_events->length()) {
|
if (editor->selected_events->length()) {
|
||||||
for (DraggablePixmapItem *item : *editor->selected_events) {
|
for (DraggablePixmapItem *item : *editor->selected_events) {
|
||||||
|
if (item->event->get("event_type") != EventType::HealLocation) {
|
||||||
editor->deleteEvent(item->event);
|
editor->deleteEvent(item->event);
|
||||||
if (editor->scene->items().contains(item)) {
|
if (editor->scene->items().contains(item)) {
|
||||||
editor->scene->removeItem(item);
|
editor->scene->removeItem(item);
|
||||||
}
|
}
|
||||||
editor->selected_events->removeOne(item);
|
editor->selected_events->removeOne(item);
|
||||||
}
|
}
|
||||||
|
else { // don't allow deletion of heal locations
|
||||||
|
qDebug() << "Cannot delete event of type " << item->event->get("event_type");
|
||||||
|
}
|
||||||
|
}
|
||||||
updateSelectedObjects();
|
updateSelectedObjects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
map.h
1
map.h
|
@ -128,6 +128,7 @@ public:
|
||||||
QString layout_id;
|
QString layout_id;
|
||||||
QString location;
|
QString location;
|
||||||
QString requiresFlash;
|
QString requiresFlash;
|
||||||
|
QString isFlyable; // TODO: implement this
|
||||||
QString weather;
|
QString weather;
|
||||||
QString type;
|
QString type;
|
||||||
QString unknown;
|
QString unknown;
|
||||||
|
|
|
@ -23,6 +23,12 @@ void NewEventToolButton::initButton()
|
||||||
this->newWarpAction->setIcon(QIcon(":/icons/add.ico"));
|
this->newWarpAction->setIcon(QIcon(":/icons/add.ico"));
|
||||||
connect(this->newWarpAction, SIGNAL(triggered(bool)), this, SLOT(newWarp()));
|
connect(this->newWarpAction, SIGNAL(triggered(bool)), this, SLOT(newWarp()));
|
||||||
|
|
||||||
|
/* // disable this functionality for now
|
||||||
|
this->newHealLocationAction = new QAction("New Heal Location", this);
|
||||||
|
this->newHealLocationAction->setIcon(QIcon(":/icons/add.ico"));
|
||||||
|
connect(this->newHealLocationAction, SIGNAL(triggered(bool)), this, SLOT(newHealLocation()));
|
||||||
|
*/
|
||||||
|
|
||||||
this->newCoordScriptAction = new QAction("New Coord Script", this);
|
this->newCoordScriptAction = new QAction("New Coord Script", this);
|
||||||
this->newCoordScriptAction->setIcon(QIcon(":/icons/add.ico"));
|
this->newCoordScriptAction->setIcon(QIcon(":/icons/add.ico"));
|
||||||
connect(this->newCoordScriptAction, SIGNAL(triggered(bool)), this, SLOT(newCoordScript()));
|
connect(this->newCoordScriptAction, SIGNAL(triggered(bool)), this, SLOT(newCoordScript()));
|
||||||
|
@ -46,6 +52,7 @@ void NewEventToolButton::initButton()
|
||||||
QMenu *alignMenu = new QMenu();
|
QMenu *alignMenu = new QMenu();
|
||||||
alignMenu->addAction(this->newObjectAction);
|
alignMenu->addAction(this->newObjectAction);
|
||||||
alignMenu->addAction(this->newWarpAction);
|
alignMenu->addAction(this->newWarpAction);
|
||||||
|
//alignMenu->addAction(this->newHealLocationAction);
|
||||||
alignMenu->addAction(this->newCoordScriptAction);
|
alignMenu->addAction(this->newCoordScriptAction);
|
||||||
alignMenu->addAction(this->newCoordWeatherAction);
|
alignMenu->addAction(this->newCoordWeatherAction);
|
||||||
alignMenu->addAction(this->newSignAction);
|
alignMenu->addAction(this->newSignAction);
|
||||||
|
@ -72,6 +79,12 @@ void NewEventToolButton::newWarp()
|
||||||
emit newEventAdded(this->selectedEventType);
|
emit newEventAdded(this->selectedEventType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NewEventToolButton::newHealLocation()
|
||||||
|
{
|
||||||
|
this->selectedEventType = EventType::HealLocation;
|
||||||
|
emit newEventAdded(this->selectedEventType);
|
||||||
|
}
|
||||||
|
|
||||||
void NewEventToolButton::newCoordScript()
|
void NewEventToolButton::newCoordScript()
|
||||||
{
|
{
|
||||||
this->selectedEventType = EventType::CoordScript;
|
this->selectedEventType = EventType::CoordScript;
|
||||||
|
|
|
@ -14,6 +14,7 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void newObject();
|
void newObject();
|
||||||
void newWarp();
|
void newWarp();
|
||||||
|
void newHealLocation();
|
||||||
void newCoordScript();
|
void newCoordScript();
|
||||||
void newCoordWeather();
|
void newCoordWeather();
|
||||||
void newSign();
|
void newSign();
|
||||||
|
@ -25,6 +26,7 @@ private:
|
||||||
QString selectedEventType;
|
QString selectedEventType;
|
||||||
QAction *newObjectAction;
|
QAction *newObjectAction;
|
||||||
QAction *newWarpAction;
|
QAction *newWarpAction;
|
||||||
|
QAction *newHealLocationAction;
|
||||||
QAction *newCoordScriptAction;
|
QAction *newCoordScriptAction;
|
||||||
QAction *newCoordWeatherAction;
|
QAction *newCoordWeatherAction;
|
||||||
QAction *newSignAction;
|
QAction *newSignAction;
|
||||||
|
|
|
@ -68,6 +68,24 @@ int ParseUtil::evaluateDefine(QString define, QMap<QString, int>* knownDefines)
|
||||||
return evaluatePostfix(postfixExpression);
|
return evaluatePostfix(postfixExpression);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// arg here is the text in the file src/data/heal_locations.h
|
||||||
|
// returns a list of HealLocations (mapname, x, y)
|
||||||
|
QList<HealLocation>* ParseUtil::parseHealLocs(QString text) {
|
||||||
|
QList<HealLocation> *parsed = new QList<HealLocation>;
|
||||||
|
QStringList lines = text.split('\n');
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
for (auto line : lines){
|
||||||
|
if (line.contains("MAP_GROUP")){
|
||||||
|
QList<QString> li = line.replace(" ","").chopped(2).remove('{').split(',');
|
||||||
|
HealLocation hloc = HealLocation(li[1].remove("MAP_NUM(").remove(")"), i, li[2].toInt(), li[3].toInt());
|
||||||
|
parsed->append(hloc);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return parsed;
|
||||||
|
}
|
||||||
|
|
||||||
QList<Token> ParseUtil::tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers) {
|
QList<Token> ParseUtil::tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers) {
|
||||||
QList<Token> tokens;
|
QList<Token> tokens;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef PARSEUTIL_H
|
#ifndef PARSEUTIL_H
|
||||||
#define PARSEUTIL_H
|
#define PARSEUTIL_H
|
||||||
|
|
||||||
|
#include "heallocation.h"
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
|
@ -35,6 +37,7 @@ public:
|
||||||
void strip_comment(QString*);
|
void strip_comment(QString*);
|
||||||
QList<QStringList>* parseAsm(QString);
|
QList<QStringList>* parseAsm(QString);
|
||||||
int evaluateDefine(QString, QMap<QString, int>*);
|
int evaluateDefine(QString, QMap<QString, int>*);
|
||||||
|
QList<HealLocation>* parseHealLocs(QString);
|
||||||
private:
|
private:
|
||||||
QList<Token> tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers);
|
QList<Token> tokenizeExpression(QString expression, QMap<QString, int>* knownIdentifiers);
|
||||||
QList<Token> generatePostfix(QList<Token> tokens);
|
QList<Token> generatePostfix(QList<Token> tokens);
|
||||||
|
|
|
@ -27,7 +27,8 @@ SOURCES += main.cpp\
|
||||||
parseutil.cpp \
|
parseutil.cpp \
|
||||||
neweventtoolbutton.cpp \
|
neweventtoolbutton.cpp \
|
||||||
noscrollcombobox.cpp \
|
noscrollcombobox.cpp \
|
||||||
noscrollspinbox.cpp
|
noscrollspinbox.cpp \
|
||||||
|
heallocation.cpp
|
||||||
|
|
||||||
HEADERS += mainwindow.h \
|
HEADERS += mainwindow.h \
|
||||||
project.h \
|
project.h \
|
||||||
|
@ -43,7 +44,8 @@ HEADERS += mainwindow.h \
|
||||||
parseutil.h \
|
parseutil.h \
|
||||||
neweventtoolbutton.h \
|
neweventtoolbutton.h \
|
||||||
noscrollcombobox.h \
|
noscrollcombobox.h \
|
||||||
noscrollspinbox.h
|
noscrollspinbox.h \
|
||||||
|
heallocation.h
|
||||||
|
|
||||||
FORMS += mainwindow.ui \
|
FORMS += mainwindow.ui \
|
||||||
objectpropertiesframe.ui
|
objectpropertiesframe.ui
|
||||||
|
|
117
project.cpp
117
project.cpp
|
@ -501,6 +501,82 @@ void Project::saveMapConstantsHeader() {
|
||||||
saveTextFile(root + "/include/constants/maps.h", text);
|
saveTextFile(root + "/include/constants/maps.h", text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// saves heal location coords in root + /src/data/heal_locations.h
|
||||||
|
// and indexes as defines in root + /include/constants/heal_locations.h
|
||||||
|
void Project::saveHealLocationStruct(Map *map) {
|
||||||
|
QString tab = QString(" ");
|
||||||
|
|
||||||
|
QString data_text = QString("static const struct HealLocation sHealLocations[] =\n{\n");
|
||||||
|
|
||||||
|
QString constants_text = QString("#ifndef GUARD_CONSTANTS_HEAL_LOCATIONS_H\n");
|
||||||
|
constants_text += QString("#define GUARD_CONSTANTS_HEAL_LOCATIONS_H\n\n");
|
||||||
|
|
||||||
|
QMap<QString, int> flyableMapsDupes;
|
||||||
|
QSet<QString> flyableMapsUnique;
|
||||||
|
|
||||||
|
// erase old location from flyableMaps list
|
||||||
|
// set flyableMapsDupes and flyableMapsUnique
|
||||||
|
for (auto it = flyableMaps->begin(); it != flyableMaps->end(); it++) {
|
||||||
|
HealLocation loc = *it;
|
||||||
|
QString xname = loc.name;
|
||||||
|
if (flyableMapsUnique.contains(xname)) {
|
||||||
|
flyableMapsDupes[xname] = 1;
|
||||||
|
}
|
||||||
|
if (xname == QString(mapNamesToMapConstants->value(map->name)).remove(0,4)) {
|
||||||
|
it = flyableMaps->erase(it) - 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
flyableMapsUnique.insert(xname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set new location in flyableMapsList
|
||||||
|
if (map->events["heal_event_group"].length() > 0) {
|
||||||
|
QList<HealLocation>* flymaps = flyableMaps;
|
||||||
|
|
||||||
|
for (Event *heal : map->events["heal_event_group"]) {
|
||||||
|
HealLocation hl = heal->buildHealLocation();
|
||||||
|
flymaps->insert(hl.index - 1, hl);
|
||||||
|
}
|
||||||
|
flyableMaps = flymaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
|
||||||
|
for (auto map_in : *flyableMaps) {
|
||||||
|
data_text += QString(" {MAP_GROUP(%1), MAP_NUM(%1), %2, %3},\n")
|
||||||
|
.arg(map_in.name)
|
||||||
|
.arg(map_in.x)
|
||||||
|
.arg(map_in.y);
|
||||||
|
|
||||||
|
QString ending = QString("");
|
||||||
|
|
||||||
|
// must add _1 / _2 for maps that have duplicates
|
||||||
|
if (flyableMapsDupes.keys().contains(map_in.name)) {
|
||||||
|
// map contains multiple heal locations
|
||||||
|
ending += QString("_%1").arg(flyableMapsDupes[map_in.name]);
|
||||||
|
flyableMapsDupes[map_in.name]++;
|
||||||
|
}
|
||||||
|
if (map_in.index != 0) {
|
||||||
|
constants_text += QString("#define HEAL_LOCATION_%1 %2\n")
|
||||||
|
.arg(map_in.name + ending)
|
||||||
|
.arg(map_in.index);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
constants_text += QString("#define HEAL_LOCATION_%1 %2\n")
|
||||||
|
.arg(map_in.name + ending)
|
||||||
|
.arg(i);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
data_text += QString("};\n");
|
||||||
|
constants_text += QString("\n#endif // GUARD_CONSTANTS_HEAL_LOCATIONS_H\n");
|
||||||
|
|
||||||
|
saveTextFile(root + "/src/data/heal_locations.h", data_text);
|
||||||
|
saveTextFile(root + "/include/constants/heal_locations.h", constants_text);
|
||||||
|
}
|
||||||
|
|
||||||
void Project::loadMapTilesets(Map* map) {
|
void Project::loadMapTilesets(Map* map) {
|
||||||
if (map->layout->has_unsaved_changes) {
|
if (map->layout->has_unsaved_changes) {
|
||||||
return;
|
return;
|
||||||
|
@ -947,6 +1023,10 @@ void Project::readMapGroups() {
|
||||||
groupNames = groups;
|
groupNames = groups;
|
||||||
groupedMapNames = groupedMaps;
|
groupedMapNames = groupedMaps;
|
||||||
mapNames = maps;
|
mapNames = maps;
|
||||||
|
|
||||||
|
QString hltext = readTextFile(root + QString("/src/data/heal_locations.h"));
|
||||||
|
QList<HealLocation>* hl = parser->parseHealLocs(hltext);
|
||||||
|
flyableMaps = hl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
Map* Project::addNewMapToGroup(QString mapName, int groupNum) {
|
||||||
|
@ -1221,6 +1301,8 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(32, 0, 16, 16);
|
||||||
} else if (event_type == EventType::Sign || event_type == EventType::HiddenItem || event_type == EventType::SecretBase) {
|
} else if (event_type == EventType::Sign || event_type == EventType::HiddenItem || event_type == EventType::SecretBase) {
|
||||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
|
||||||
|
} else if (event_type == EventType::HealLocation) {
|
||||||
|
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(64, 0, 16, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event_type == EventType::Object) {
|
if (event_type == EventType::Object) {
|
||||||
|
@ -1309,6 +1391,17 @@ void Project::saveMapEvents(Map *map) {
|
||||||
.arg(bgEventsLabel);
|
.arg(bgEventsLabel);
|
||||||
|
|
||||||
saveTextFile(path, text);
|
saveTextFile(path, text);
|
||||||
|
|
||||||
|
// save heal event changes
|
||||||
|
if (map->events["heal_event_group"].length() > 0) {
|
||||||
|
QList<HealLocation>* flymaps = flyableMaps;
|
||||||
|
for (Event *heal : map->events["heal_event_group"]) {
|
||||||
|
HealLocation hl = heal->buildHealLocation();
|
||||||
|
flymaps->append(hl);
|
||||||
|
}
|
||||||
|
flyableMaps = flymaps;
|
||||||
|
}
|
||||||
|
saveHealLocationStruct(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Project::readMapEvents(Map *map) {
|
void Project::readMapEvents(Map *map) {
|
||||||
|
@ -1379,6 +1472,29 @@ void Project::readMapEvents(Map *map) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map->events["heal_event_group"].clear();
|
||||||
|
|
||||||
|
for (auto it = flyableMaps->begin(); it != flyableMaps->end(); it++) {
|
||||||
|
|
||||||
|
HealLocation loc = *it;
|
||||||
|
|
||||||
|
//if TRUE map is flyable / has healing location
|
||||||
|
if (loc.name == QString(mapNamesToMapConstants->value(map->name)).remove(0,4)) {
|
||||||
|
Event *heal = new Event;
|
||||||
|
heal->put("map_name", map->name);
|
||||||
|
heal->put("x", loc.x);
|
||||||
|
heal->put("y", loc.y);
|
||||||
|
heal->put("loc_name", loc.name);
|
||||||
|
heal->put("index", loc.index);
|
||||||
|
heal->put("elevation", 3); // TODO: change this?
|
||||||
|
heal->put("destination_map_name", mapConstantsToMapNames->value(map->name));
|
||||||
|
heal->put("event_group_type", "heal_event_group");
|
||||||
|
heal->put("event_type", EventType::HealLocation);
|
||||||
|
map->events["heal_event_group"].append(heal);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QList<QStringList> *coords = getLabelMacros(parseAsm(text), coordEventsLabel);
|
QList<QStringList> *coords = getLabelMacros(parseAsm(text), coordEventsLabel);
|
||||||
map->events["coord_event_group"].clear();
|
map->events["coord_event_group"].clear();
|
||||||
for (QStringList command : *coords) {
|
for (QStringList command : *coords) {
|
||||||
|
@ -1455,6 +1571,7 @@ void Project::readMapEvents(Map *map) {
|
||||||
void Project::setNewMapEvents(Map *map) {
|
void Project::setNewMapEvents(Map *map) {
|
||||||
map->events["object_event_group"].clear();
|
map->events["object_event_group"].clear();
|
||||||
map->events["warp_event_group"].clear();
|
map->events["warp_event_group"].clear();
|
||||||
|
map->events["heal_event_group"].clear();
|
||||||
map->events["coord_event_group"].clear();
|
map->events["coord_event_group"].clear();
|
||||||
map->events["bg_event_group"].clear();
|
map->events["bg_event_group"].clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "map.h"
|
#include "map.h"
|
||||||
#include "blockdata.h"
|
#include "blockdata.h"
|
||||||
|
#include "heallocation.h"
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
@ -17,6 +18,7 @@ public:
|
||||||
QMap<QString, int> *map_groups;
|
QMap<QString, int> *map_groups;
|
||||||
QList<QStringList> groupedMapNames;
|
QList<QStringList> groupedMapNames;
|
||||||
QStringList *mapNames = NULL;
|
QStringList *mapNames = NULL;
|
||||||
|
QList<HealLocation> *flyableMaps = NULL; // can't be a QMap because duplicates
|
||||||
QMap<QString, QString>* mapConstantsToMapNames;
|
QMap<QString, QString>* mapConstantsToMapNames;
|
||||||
QMap<QString, QString>* mapNamesToMapConstants;
|
QMap<QString, QString>* mapNamesToMapConstants;
|
||||||
QList<QString> mapLayoutsTable;
|
QList<QString> mapLayoutsTable;
|
||||||
|
@ -77,6 +79,7 @@ public:
|
||||||
void saveAllMapLayouts();
|
void saveAllMapLayouts();
|
||||||
void saveMapGroupsTable();
|
void saveMapGroupsTable();
|
||||||
void saveMapConstantsHeader();
|
void saveMapConstantsHeader();
|
||||||
|
void saveHealLocationStruct(Map*);
|
||||||
|
|
||||||
QList<QStringList>* parseAsm(QString text);
|
QList<QStringList>* parseAsm(QString text);
|
||||||
QStringList getSongNames();
|
QStringList getSongNames();
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 490 B |
Loading…
Reference in a new issue