Properly create new emerald map headers. Use 'trigger' instead of coord script, trap, etc.
This commit is contained in:
parent
ebdab421cb
commit
08ff21e415
9 changed files with 73 additions and 58 deletions
|
@ -107,16 +107,29 @@
|
|||
<item>
|
||||
<widget class="QLabel" name="label_name">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Object 1</string>
|
||||
<string>Id</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
|
|
|
@ -158,7 +158,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>false</bool>
|
||||
|
|
|
@ -10,8 +10,8 @@ class EventType
|
|||
public:
|
||||
static QString Object;
|
||||
static QString Warp;
|
||||
static QString CoordScript;
|
||||
static QString CoordWeather;
|
||||
static QString Trigger;
|
||||
static QString WeatherTrigger;
|
||||
static QString Sign;
|
||||
static QString HiddenItem;
|
||||
static QString SecretBase;
|
||||
|
@ -58,16 +58,16 @@ public:
|
|||
static Event* createNewObjectEvent();
|
||||
static Event* createNewWarpEvent(QString);
|
||||
static Event* createNewHealLocationEvent(QString);
|
||||
static Event* createNewCoordScriptEvent();
|
||||
static Event* createNewCoordWeatherEvent();
|
||||
static Event* createNewTriggerEvent();
|
||||
static Event* createNewWeatherTriggerEvent();
|
||||
static Event* createNewSignEvent();
|
||||
static Event* createNewHiddenItemEvent();
|
||||
static Event* createNewSecretBaseEvent();
|
||||
|
||||
QString buildObjectEventMacro(int);
|
||||
QString buildWarpEventMacro(QMap<QString, QString>*);
|
||||
QString buildCoordScriptEventMacro();
|
||||
QString buildCoordWeatherEventMacro();
|
||||
QString buildTriggerEventMacro();
|
||||
QString buildWeatherTriggerEventMacro();
|
||||
QString buildSignEventMacro();
|
||||
QString buildHiddenItemEventMacro();
|
||||
QString buildSecretBaseEventMacro();
|
||||
|
|
|
@ -137,8 +137,8 @@ private:
|
|||
Event* createNewObjectEvent();
|
||||
Event* createNewWarpEvent();
|
||||
Event* createNewHealLocationEvent();
|
||||
Event* createNewCoordScriptEvent();
|
||||
Event* createNewCoordWeatherEvent();
|
||||
Event* createNewTriggerEvent();
|
||||
Event* createNewWeatherTriggerEvent();
|
||||
Event* createNewSignEvent();
|
||||
Event* createNewHiddenItemEvent();
|
||||
Event* createNewSecretBaseEvent();
|
||||
|
|
|
@ -14,8 +14,8 @@ public slots:
|
|||
void newObject();
|
||||
void newWarp();
|
||||
void newHealLocation();
|
||||
void newCoordScript();
|
||||
void newCoordWeather();
|
||||
void newTrigger();
|
||||
void newWeatherTrigger();
|
||||
void newSign();
|
||||
void newHiddenItem();
|
||||
void newSecretBase();
|
||||
|
@ -26,8 +26,8 @@ private:
|
|||
QAction *newObjectAction;
|
||||
QAction *newWarpAction;
|
||||
QAction *newHealLocationAction;
|
||||
QAction *newCoordScriptAction;
|
||||
QAction *newCoordWeatherAction;
|
||||
QAction *newTriggerAction;
|
||||
QAction *newWeatherTriggerAction;
|
||||
QAction *newSignAction;
|
||||
QAction *newHiddenItemAction;
|
||||
QAction *newSecretBaseAction;
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
|
||||
QString EventType::Object = "event_object";
|
||||
QString EventType::Warp = "event_warp";
|
||||
QString EventType::CoordScript = "event_trap";
|
||||
QString EventType::CoordWeather = "event_trap_weather";
|
||||
QString EventType::Trigger = "event_trigger";
|
||||
QString EventType::WeatherTrigger = "event_weather_trigger";
|
||||
QString EventType::Sign = "event_sign";
|
||||
QString EventType::HiddenItem = "event_hidden_item";
|
||||
QString EventType::SecretBase = "event_secret_base";
|
||||
|
@ -25,10 +25,10 @@ Event* Event::createNewEvent(QString event_type, QString map_name)
|
|||
event = createNewWarpEvent(map_name);
|
||||
} else if (event_type == EventType::HealLocation) {
|
||||
event = createNewHealLocationEvent(map_name);
|
||||
} else if (event_type == EventType::CoordScript) {
|
||||
event = createNewCoordScriptEvent();
|
||||
} else if (event_type == EventType::CoordWeather) {
|
||||
event = createNewCoordWeatherEvent();
|
||||
} else if (event_type == EventType::Trigger) {
|
||||
event = createNewTriggerEvent();
|
||||
} else if (event_type == EventType::WeatherTrigger) {
|
||||
event = createNewWeatherTriggerEvent();
|
||||
} else if (event_type == EventType::Sign) {
|
||||
event = createNewSignEvent();
|
||||
} else if (event_type == EventType::HiddenItem) {
|
||||
|
@ -79,22 +79,22 @@ Event* Event::createNewHealLocationEvent(QString map_name)
|
|||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewCoordScriptEvent()
|
||||
Event* Event::createNewTriggerEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "coord_event_group");
|
||||
event->put("event_type", EventType::CoordScript);
|
||||
event->put("event_type", EventType::Trigger);
|
||||
event->put("script_label", "NULL");
|
||||
event->put("script_var", "VAR_TEMP_0");
|
||||
event->put("script_var_value", "0");
|
||||
return event;
|
||||
}
|
||||
|
||||
Event* Event::createNewCoordWeatherEvent()
|
||||
Event* Event::createNewWeatherTriggerEvent()
|
||||
{
|
||||
Event *event = new Event;
|
||||
event->put("event_group_type", "coord_event_group");
|
||||
event->put("event_type", EventType::CoordWeather);
|
||||
event->put("event_type", EventType::WeatherTrigger);
|
||||
event->put("weather", "COORD_EVENT_WEATHER_SUNNY");
|
||||
return event;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ QString Event::buildWarpEventMacro(QMap<QString, QString> *mapNamesToMapConstant
|
|||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildCoordScriptEventMacro()
|
||||
QString Event::buildTriggerEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tcoord_event %1").arg(this->get("x"));
|
||||
|
@ -188,7 +188,7 @@ QString Event::buildCoordScriptEventMacro()
|
|||
return text;
|
||||
}
|
||||
|
||||
QString Event::buildCoordWeatherEventMacro()
|
||||
QString Event::buildWeatherTriggerEventMacro()
|
||||
{
|
||||
QString text = "";
|
||||
text += QString("\tcoord_weather_event %1").arg(this->get("x"));
|
||||
|
|
|
@ -973,7 +973,7 @@ void MainWindow::updateObjects() {
|
|||
else if (event_type == EventType::Warp) {
|
||||
hasWarps = true;
|
||||
}
|
||||
else if (event_type == EventType::CoordScript || event_type == EventType::CoordWeather) {
|
||||
else if (event_type == EventType::Trigger || event_type == EventType::WeatherTrigger) {
|
||||
hasTriggers = true;
|
||||
}
|
||||
else if (event_type == EventType::Sign || event_type == EventType::HiddenItem || event_type == EventType::SecretBase) {
|
||||
|
@ -1053,20 +1053,13 @@ void MainWindow::updateSelectedObjects() {
|
|||
connect(z, SIGNAL(valueChanged(QString)), item, SLOT(set_elevation(QString)));
|
||||
connect(item, SIGNAL(elevationChanged(int)), z, SLOT(setValue(int)));
|
||||
|
||||
QFont font;
|
||||
font.setCapitalization(QFont::Capitalize);
|
||||
frame->ui->label_name->setFont(font);
|
||||
QString event_type = item->event->get("event_type");
|
||||
QString event_group_type = item->event->get("event_group_type");
|
||||
QString map_name = item->event->get("map_name");
|
||||
int event_offs;
|
||||
if (event_type == "event_warp") { event_offs = 0; }
|
||||
else { event_offs = 1; }
|
||||
frame->ui->label_name->setText(
|
||||
QString("%1 %2")
|
||||
.arg(map_name)
|
||||
.arg(event_type)
|
||||
);
|
||||
frame->ui->label_name->setText(QString("%1 Id").arg(event_type));
|
||||
|
||||
if (events->count() == 1)
|
||||
{
|
||||
|
@ -1136,12 +1129,12 @@ void MainWindow::updateSelectedObjects() {
|
|||
fields << "destination_map_name";
|
||||
fields << "destination_warp";
|
||||
}
|
||||
else if (event_type == EventType::CoordScript) {
|
||||
else if (event_type == EventType::Trigger) {
|
||||
fields << "script_label";
|
||||
fields << "script_var";
|
||||
fields << "script_var_value";
|
||||
}
|
||||
else if (event_type == EventType::CoordWeather) {
|
||||
else if (event_type == EventType::WeatherTrigger) {
|
||||
fields << "weather";
|
||||
}
|
||||
else if (event_type == EventType::Sign) {
|
||||
|
@ -1161,6 +1154,7 @@ void MainWindow::updateSelectedObjects() {
|
|||
QWidget *widget = new QWidget(frame);
|
||||
QFormLayout *fl = new QFormLayout(widget);
|
||||
fl->setContentsMargins(9, 0, 9, 0);
|
||||
fl->setRowWrapPolicy(QFormLayout::WrapLongRows);
|
||||
|
||||
// is_trainer is the only non-combobox item.
|
||||
if (key == "is_trainer") {
|
||||
|
|
|
@ -267,7 +267,15 @@ void Project::setNewMapHeader(Map* map, int mapIndex) {
|
|||
map->weather = "WEATHER_SUNNY";
|
||||
map->type = "MAP_TYPE_TOWN";
|
||||
map->unknown = "0";
|
||||
map->show_location = "TRUE";
|
||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby) {
|
||||
map->show_location = "TRUE";
|
||||
} else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeemerald) {
|
||||
map->allowBiking = "1";
|
||||
map->allowEscapeRope = "0";
|
||||
map->allowRunning = "1";
|
||||
map->show_location = "1";
|
||||
}
|
||||
|
||||
map->battle_scene = "MAP_BATTLE_SCENE_NORMAL";
|
||||
}
|
||||
|
||||
|
@ -1555,7 +1563,7 @@ void Project::loadEventPixmaps(QList<Event*> objects) {
|
|||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(0, 0, 16, 16);
|
||||
} else if (event_type == EventType::Warp) {
|
||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(16, 0, 16, 16);
|
||||
} else if (event_type == EventType::CoordScript || event_type == EventType::CoordWeather) {
|
||||
} else if (event_type == EventType::Trigger || event_type == EventType::WeatherTrigger) {
|
||||
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) {
|
||||
object->pixmap = QPixmap(":/images/Entities_16x16.png").copy(48, 0, 16, 16);
|
||||
|
@ -1630,10 +1638,10 @@ void Project::saveMapEvents(Map *map) {
|
|||
text += QString("%1::\n").arg(coordEventsLabel);
|
||||
for (Event *event : map->events["coord_event_group"]) {
|
||||
QString event_type = event->get("event_type");
|
||||
if (event_type == EventType::CoordScript) {
|
||||
text += event->buildCoordScriptEventMacro();
|
||||
} else if (event_type == EventType::CoordWeather) {
|
||||
text += event->buildCoordWeatherEventMacro();
|
||||
if (event_type == EventType::Trigger) {
|
||||
text += event->buildTriggerEventMacro();
|
||||
} else if (event_type == EventType::WeatherTrigger) {
|
||||
text += event->buildWeatherTriggerEventMacro();
|
||||
}
|
||||
}
|
||||
text += "\n";
|
||||
|
@ -1785,7 +1793,7 @@ void Project::readMapEvents(Map *map) {
|
|||
coord->put("script_var_value", command.value(i++));
|
||||
coord->put("script_label", command.value(i++));
|
||||
coord->put("event_group_type", "coord_event_group");
|
||||
coord->put("event_type", EventType::CoordScript);
|
||||
coord->put("event_type", EventType::Trigger);
|
||||
map->events["coord_event_group"].append(coord);
|
||||
} else if (command.value(0) == "coord_weather_event") {
|
||||
Event *coord = new Event;
|
||||
|
@ -1796,7 +1804,7 @@ void Project::readMapEvents(Map *map) {
|
|||
coord->put("elevation", command.value(i++));
|
||||
coord->put("weather", command.value(i++));
|
||||
coord->put("event_group_type", "coord_event_group");
|
||||
coord->put("event_type", EventType::CoordWeather);
|
||||
coord->put("event_type", EventType::WeatherTrigger);
|
||||
map->events["coord_event_group"].append(coord);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,13 +29,13 @@ void NewEventToolButton::init()
|
|||
connect(this->newHealLocationAction, SIGNAL(triggered(bool)), this, SLOT(newHealLocation()));
|
||||
*/
|
||||
|
||||
this->newCoordScriptAction = new QAction("New Coord Script", this);
|
||||
this->newCoordScriptAction->setIcon(QIcon(":/icons/add.ico"));
|
||||
connect(this->newCoordScriptAction, SIGNAL(triggered(bool)), this, SLOT(newCoordScript()));
|
||||
this->newTriggerAction = new QAction("New Trigger", this);
|
||||
this->newTriggerAction->setIcon(QIcon(":/icons/add.ico"));
|
||||
connect(this->newTriggerAction, SIGNAL(triggered(bool)), this, SLOT(newTrigger()));
|
||||
|
||||
this->newCoordWeatherAction = new QAction("New Coord Weather", this);
|
||||
this->newCoordWeatherAction->setIcon(QIcon(":/icons/add.ico"));
|
||||
connect(this->newCoordWeatherAction, SIGNAL(triggered(bool)), this, SLOT(newCoordWeather()));
|
||||
this->newWeatherTriggerAction = new QAction("New Weather Trigger", this);
|
||||
this->newWeatherTriggerAction->setIcon(QIcon(":/icons/add.ico"));
|
||||
connect(this->newWeatherTriggerAction, SIGNAL(triggered(bool)), this, SLOT(newWeatherTrigger()));
|
||||
|
||||
this->newSignAction = new QAction("New Sign", this);
|
||||
this->newSignAction->setIcon(QIcon(":/icons/add.ico"));
|
||||
|
@ -53,8 +53,8 @@ void NewEventToolButton::init()
|
|||
alignMenu->addAction(this->newObjectAction);
|
||||
alignMenu->addAction(this->newWarpAction);
|
||||
//alignMenu->addAction(this->newHealLocationAction);
|
||||
alignMenu->addAction(this->newCoordScriptAction);
|
||||
alignMenu->addAction(this->newCoordWeatherAction);
|
||||
alignMenu->addAction(this->newTriggerAction);
|
||||
alignMenu->addAction(this->newWeatherTriggerAction);
|
||||
alignMenu->addAction(this->newSignAction);
|
||||
alignMenu->addAction(this->newHiddenItemAction);
|
||||
alignMenu->addAction(this->newSecretBaseAction);
|
||||
|
@ -85,15 +85,15 @@ void NewEventToolButton::newHealLocation()
|
|||
emit newEventAdded(this->selectedEventType);
|
||||
}
|
||||
|
||||
void NewEventToolButton::newCoordScript()
|
||||
void NewEventToolButton::newTrigger()
|
||||
{
|
||||
this->selectedEventType = EventType::CoordScript;
|
||||
this->selectedEventType = EventType::Trigger;
|
||||
emit newEventAdded(this->selectedEventType);
|
||||
}
|
||||
|
||||
void NewEventToolButton::newCoordWeather()
|
||||
void NewEventToolButton::newWeatherTrigger()
|
||||
{
|
||||
this->selectedEventType = EventType::CoordWeather;
|
||||
this->selectedEventType = EventType::WeatherTrigger;
|
||||
emit newEventAdded(this->selectedEventType);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue