Provide populated comboboxes and tooltips for (mostly) everything

This commit is contained in:
Marcus Huderle 2018-07-13 20:33:49 -05:00
parent 74c2766c01
commit fba2ade2bb
8 changed files with 328 additions and 263 deletions

View file

@ -42,14 +42,14 @@ Event* Event::createNewObjectEvent()
Event *event = new Event;
event->put("event_group_type", "object_event_group");
event->put("event_type", EventType::Object);
event->put("sprite", "EVENT_OBJ_GFX_BOY_1");
event->put("sprite", "MOVEMENT_TYPE_LOOK_AROUND");
event->put("movement_type", "1");
event->put("radius_x", 0);
event->put("radius_y", 0);
event->put("script_label", "NULL");
event->put("event_flag", "0");
event->put("replacement", "0");
event->put("trainer_see_type", "0");
event->put("is_trainer", "FALSE");
event->put("sight_radius_tree_id", 0);
return event;
}
@ -130,7 +130,7 @@ QString Event::buildObjectEventMacro(int item_index)
text += QString(", %1").arg(this->get("movement_type"));
text += QString(", %1").arg(radius_x);
text += QString(", %1").arg(radius_y);
text += QString(", %1").arg(this->get("trainer_see_type"));
text += QString(", %1").arg(this->get("is_trainer"));
text += QString(", %1").arg(this->get("sight_radius_tree_id"));
text += QString(", %1").arg(this->get("script_label"));
text += QString(", %1").arg(this->get("event_flag"));

View file

@ -244,7 +244,7 @@ void MainWindow::setRecentMap(QString map_name) {
void MainWindow::displayMapProperties() {
ui->comboBox_Song->clear();
ui->comboBox_Location->clear();
ui->comboBox_Visibility->clear();
ui->checkBox_Visibility->setChecked(false);
ui->comboBox_Weather->clear();
ui->comboBox_Type->clear();
ui->comboBox_BattleScene->clear();
@ -263,7 +263,7 @@ void MainWindow::displayMapProperties() {
ui->comboBox_Song->addItems(songs);
ui->comboBox_Song->setCurrentText(map->song);
ui->comboBox_Location->addItems(project->getLocations());
ui->comboBox_Location->addItems(*project->regionMapSections);
ui->comboBox_Location->setCurrentText(map->location);
QMap<QString, QStringList> tilesets = project->getTilesets();
@ -272,16 +272,15 @@ void MainWindow::displayMapProperties() {
ui->comboBox_SecondaryTileset->addItems(tilesets.value("secondary"));
ui->comboBox_SecondaryTileset->setCurrentText(map->layout->tileset_secondary_label);
ui->comboBox_Visibility->addItems(project->getVisibilities());
ui->comboBox_Visibility->setCurrentText(map->visibility);
ui->checkBox_Visibility->setChecked(map->requiresFlash.toInt() > 0 || map->requiresFlash == "TRUE");
ui->comboBox_Weather->addItems(project->getWeathers());
ui->comboBox_Weather->addItems(*project->weatherNames);
ui->comboBox_Weather->setCurrentText(map->weather);
ui->comboBox_Type->addItems(project->getMapTypes());
ui->comboBox_Type->addItems(*project->mapTypes);
ui->comboBox_Type->setCurrentText(map->type);
ui->comboBox_BattleScene->addItems(project->getBattleScenes());
ui->comboBox_BattleScene->addItems(*project->mapBattleScenes);
ui->comboBox_BattleScene->setCurrentText(map->battle_scene);
ui->checkBox_ShowLocation->setChecked(map->show_location.toInt() > 0 || map->show_location == "TRUE");
@ -301,10 +300,10 @@ void MainWindow::on_comboBox_Location_activated(const QString &location)
}
}
void MainWindow::on_comboBox_Visibility_activated(const QString &visibility)
void MainWindow::on_comboBox_Visibility_activated(const QString &requiresFlash)
{
if (editor && editor->map) {
editor->map->visibility = visibility;
editor->map->requiresFlash = requiresFlash;
}
}
@ -329,6 +328,17 @@ void MainWindow::on_comboBox_BattleScene_activated(const QString &battle_scene)
}
}
void MainWindow::on_checkBox_Visibility_clicked(bool checked)
{
if (editor && editor->map) {
if (checked) {
editor->map->requiresFlash = "TRUE";
} else {
editor->map->requiresFlash = "FALSE";
}
}
}
void MainWindow::on_checkBox_ShowLocation_clicked(bool checked)
{
if (editor && editor->map) {
@ -344,10 +354,14 @@ void MainWindow::loadDataStructures() {
Project *project = editor->project;
project->readMapLayoutsTable();
project->readAllMapLayouts();
project->readRegionMapSections();
project->readItemNames();
project->readFlagNames();
project->readVarNames();
project->readMovementTypes();
project->readMapTypes();
project->readMapBattleScenes();
project->readWeatherNames();
project->readCoordEventWeatherNames();
project->readSecretBaseIds();
project->readBgEventFacingDirections();
@ -642,11 +656,10 @@ void MainWindow::updateSelectedObjects() {
QMap<QString, QString> field_labels;
field_labels["script_label"] = "Script";
field_labels["event_flag"] = "Event Flag";
field_labels["replacement"] = "Replacement";
field_labels["movement_type"] = "Movement";
field_labels["radius_x"] = "Movement Radius X";
field_labels["radius_y"] = "Movement Radius Y";
field_labels["trainer_see_type"] = "Trainer See Type";
field_labels["is_trainer"] = "Trainer";
field_labels["sight_radius_tree_id"] = "Sight Radius / Berry Tree ID";
field_labels["destination_warp"] = "Destination Warp";
field_labels["destination_map_name"] = "Destination Map";
@ -684,8 +697,7 @@ void MainWindow::updateSelectedObjects() {
fields << "radius_y";
fields << "script_label";
fields << "event_flag";
fields << "replacement";
fields << "trainer_see_type";
fields << "is_trainer";
fields << "sight_radius_tree_id";
}
else if (event_type == EventType::Warp) {
@ -713,18 +725,38 @@ void MainWindow::updateSelectedObjects() {
}
for (QString key : fields) {
QString value = item->event->get(key);
QWidget *widget = new QWidget(frame);
QFormLayout *fl = new QFormLayout(widget);
fl->setContentsMargins(9, 0, 9, 0);
// is_trainer is the only non-combobox item.
if (key == "is_trainer") {
QCheckBox *checkbox = new QCheckBox(widget);
checkbox->setEnabled(true);
checkbox->setChecked(value.toInt() != 0 && value != "FALSE");
checkbox->setToolTip("Whether or not this object is trainer.");
fl->addRow(new QLabel(field_labels[key], widget), checkbox);
widget->setLayout(fl);
frame->layout()->addWidget(widget);
connect(checkbox, &QCheckBox::stateChanged, [=](int state) {
QString isTrainer = state == Qt::Checked ? "TRUE" : "FALSE";
item->event->put("is_trainer", isTrainer);
});
continue;
}
NoScrollComboBox *combo = new NoScrollComboBox(widget);
combo->setEditable(true);
QString value = item->event->get(key);
if (key == "destination_map_name") {
if (!editor->project->mapNames->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->mapNames);
combo->setToolTip("The destination map name of the warp.");
} else if (key == "destination_warp") {
combo->setToolTip("The warp id on the destination map.");
} else if (key == "item") {
if (!editor->project->itemNames->contains(value)) {
combo->addItem(value);
@ -735,31 +767,50 @@ void MainWindow::updateSelectedObjects() {
combo->addItem(value);
}
combo->addItems(*editor->project->flagNames);
if (key == "flag")
combo->setToolTip("The flag which is set when the hidden item is picked up.");
else if (key == "event_flag")
combo->setToolTip("The flag which hides the object when set.");
} else if (key == "script_var") {
if (!editor->project->varNames->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->varNames);
combo->setToolTip("The variable by which the script is triggered. The script is triggered when this variable's value matches 'Var Value'.");
} else if (key == "script_var_value") {
combo->setToolTip("The variable's value which triggers the script.");
} else if (key == "movement_type") {
if (!editor->project->movementTypes->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->movementTypes);
combo->setToolTip("The object's natural movement behavior when the player is not interacting with it.");
} else if (key == "weather") {
if (!editor->project->coordEventWeatherNames->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->coordEventWeatherNames);
combo->setToolTip("The weather that starts when the player steps on this spot.");
} else if (key == "secret_base_id") {
if (!editor->project->secretBaseIds->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->secretBaseIds);
combo->setToolTip("The secret base id which is inside this secret base entrance. Secret base ids are meant to be unique to each and every secret base entrance.");
} else if (key == "player_facing_direction") {
if (!editor->project->bgEventFacingDirections->contains(value)) {
combo->addItem(value);
}
combo->addItems(*editor->project->bgEventFacingDirections);
combo->setToolTip("The direction which the player must be facing to be able to interact with this event.");
} else if (key == "radius_x") {
combo->setToolTip("The maximum number of metatiles this object is allowed to move left or right during its normal movement behavior actions.");
} else if (key == "radius_y") {
combo->setToolTip("The maximum number of metatiles this object is allowed to move up or down during its normal movement behavior actions.");
} else if (key == "script_label") {
combo->setToolTip("The script which is executed with this event.");
} else if (key == "sight_radius_tree_id") {
combo->setToolTip("The maximum sight range of a trainer, OR the unique id of the berry tree.");
} else {
combo->addItem(value);
}

View file

@ -99,6 +99,8 @@ private slots:
void on_checkBox_smartPaths_stateChanged(int selected);
void on_checkBox_Visibility_clicked(bool checked);
private:
Ui::MainWindow *ui;
QStandardItemModel *mapListModel;

View file

@ -69,6 +69,9 @@
<bool>false</bool>
</property>
<widget class="QWidget" name="tab_Map">
<property name="toolTip">
<string/>
</property>
<attribute name="icon">
<iconset resource="resources/images.qrc">
<normaloff>:/icons/map.ico</normaloff>:/icons/map.ico</iconset>
@ -76,6 +79,9 @@
<attribute name="title">
<string>Map</string>
</attribute>
<attribute name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Edit the map layout.&lt;/p&gt;&lt;p&gt;Select metatiles or collision attributes from the right panel, and paint them onto the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_9">
<property name="leftMargin">
<number>0</number>
@ -164,6 +170,9 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pencil&lt;/p&gt;&lt;p&gt;Click and drag to draw on the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Paint</string>
</property>
@ -187,6 +196,9 @@
<property name="enabled">
<bool>true</bool>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Pointer&lt;/p&gt;&lt;p&gt;Does nothing&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Select</string>
</property>
@ -201,6 +213,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButton_Fill">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Flood Fill&lt;/p&gt;&lt;p&gt;Fills all similar tiles in a region with the selected metatiles or collision attributes&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Fill</string>
</property>
@ -215,6 +230,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButton_Dropper">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Eye Dropper&lt;/p&gt;&lt;p&gt;Click to select a metatile or collision attribute.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Dropper</string>
</property>
@ -229,6 +247,9 @@
</item>
<item>
<widget class="QCheckBox" name="checkBox_smartPaths">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Smart-path mode allows easier drawing of paths. If a 3x3 metatile block is selcted in the right panel, then smart path mode will automatically form a pathway using those selected blocks.&lt;/p&gt;&lt;p&gt;When smart-path mode is &lt;span style=&quot; font-weight:600;&quot;&gt;not&lt;/span&gt; enabled, clicking and dragging a selection will tile it in a grid.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true">margin-left: 10px</string>
</property>
@ -239,6 +260,9 @@
</item>
<item>
<widget class="QCheckBox" name="checkBox_ToggleGrid">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Toggles a grid over the map's metatile boundaries.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
@ -262,6 +286,9 @@
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Change a map layout's width and height.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Change Dimensions</string>
</property>
@ -494,6 +521,9 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Primary Tileset&lt;/p&gt;&lt;p&gt;Defines the first 0x200 metatiles available for the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
@ -511,6 +541,9 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Secondary Tileset&lt;/p&gt;&lt;p&gt;Defines the second 0x200 metatiles available for the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
@ -580,6 +613,9 @@
<height>48</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The border is a 2x2 metatile which is repeated outside of the map layout's boundary. Draw on this border area to modify it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
@ -852,7 +888,10 @@
<bool>true</bool>
</property>
<attribute name="title">
<string>Objects</string>
<string>Events</string>
</attribute>
<attribute name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Edit the map's events.&lt;/p&gt;&lt;p&gt;View and modify objects, warps, signs, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_10">
<property name="leftMargin">
@ -1113,6 +1152,9 @@
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a new event to the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>New Object</string>
</property>
@ -1139,6 +1181,9 @@
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Delete the selected event from the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Delete</string>
</property>
@ -1178,7 +1223,7 @@
</widget>
<widget class="QWidget" name="tab_Attributes">
<attribute name="title">
<string>Attributes</string>
<string>Header</string>
</attribute>
<widget class="QFrame" name="frame_3">
<property name="enabled">
@ -1188,211 +1233,146 @@
<rect>
<x>10</x>
<y>10</y>
<width>301</width>
<height>251</height>
<width>381</width>
<height>311</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>20</x>
<y>30</y>
<width>47</width>
<height>21</height>
</rect>
<layout class="QFormLayout" name="formLayout_2">
<property name="verticalSpacing">
<number>12</number>
</property>
<property name="text">
<string>Song</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<width>47</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Location</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>20</x>
<y>90</y>
<width>47</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Visibility</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>20</x>
<y>120</y>
<width>47</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Weather</string>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>20</x>
<y>150</y>
<width>47</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Type</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>20</x>
<y>180</y>
<width>101</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Show location name</string>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>20</x>
<y>210</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Battle scene</string>
</property>
</widget>
<widget class="QComboBox" name="comboBox_Location">
<property name="geometry">
<rect>
<x>80</x>
<y>60</y>
<width>211</width>
<height>22</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox" name="comboBox_Visibility">
<property name="geometry">
<rect>
<x>80</x>
<y>90</y>
<width>211</width>
<height>22</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox" name="comboBox_Song">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>211</width>
<height>22</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox" name="comboBox_Weather">
<property name="geometry">
<rect>
<x>80</x>
<y>120</y>
<width>211</width>
<height>22</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox" name="comboBox_Type">
<property name="geometry">
<rect>
<x>80</x>
<y>150</y>
<width>211</width>
<height>22</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
<widget class="QComboBox" name="comboBox_BattleScene">
<property name="geometry">
<rect>
<x>90</x>
<y>210</y>
<width>201</width>
<height>22</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_ShowLocation">
<property name="geometry">
<rect>
<x>130</x>
<y>180</y>
<width>161</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Header</string>
</property>
</widget>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Song</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_Song">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default background music for this map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Location</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="comboBox_Location">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The section of the region map which the map is grouped under. This also determines the name of the map that is display when the player enters it.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Requires Flash</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Weather</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="comboBox_Weather">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The default weather for this map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>Type</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QComboBox" name="comboBox_Type">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The map type is a general attribute, which is used for many different things. For example. it determines whether biking or running is allowed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Show Location Name</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="checkBox_ShowLocation">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not to display the location name when the player enters the map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Battle scene</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="comboBox_BattleScene">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Determines the type of battle scene graphics to use.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBox_Visibility">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Whether or not the map is dark and requires Flash to illuminate.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="tab_Connections">
@ -1486,6 +1466,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Add a new connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
@ -1498,6 +1481,9 @@
</item>
<item>
<widget class="QPushButton" name="pushButton_RemoveConnection">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Remove the currently-selected connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
@ -1546,6 +1532,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If enabled, connections will automatically be updated on the connected map.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Mirror</string>
</property>
@ -1608,6 +1597,9 @@
</property>
<item>
<widget class="QComboBox" name="comboBox_ConnectionDirection">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The direction of the connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>up</string>
@ -1655,6 +1647,9 @@
</item>
<item>
<widget class="QComboBox" name="comboBox_ConnectedMap">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The destination map name of the connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
@ -1669,6 +1664,9 @@
</item>
<item>
<widget class="QSpinBox" name="spinBox_ConnectionOffset">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The number of metatiles to offset the connection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>-999</number>
</property>
@ -1846,6 +1844,9 @@
</item>
<item>
<widget class="QComboBox" name="comboBox_DiveMap">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Destination map name when using &lt;span style=&quot; font-weight:600;&quot;&gt;Dive&lt;/span&gt;. If empty, no such connection will exist.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>
@ -1860,6 +1861,9 @@
</item>
<item>
<widget class="QComboBox" name="comboBox_EmergeMap">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Destination map name when emerging using &lt;span style=&quot; font-weight:600;&quot;&gt;Dive&lt;/span&gt;. If empty, no such connection will exist.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>

2
map.h
View file

@ -127,7 +127,7 @@ public:
QString song;
QString layout_id;
QString location;
QString visibility;
QString requiresFlash;
QString weather;
QString type;
QString unknown;

View file

@ -109,6 +109,9 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The X coordinate of this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>-32768</number>
</property>
@ -136,6 +139,9 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The Y coordinate of this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="minimum">
<number>-32768</number>
</property>
@ -163,6 +169,9 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The elevation of this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="maximum">
<number>15</number>
</property>
@ -232,6 +241,9 @@
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The sprite graphics to use for this object.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
</property>

View file

@ -17,10 +17,14 @@ Project::Project()
groupNames = new QStringList;
map_groups = new QMap<QString, int>;
mapNames = new QStringList;
regionMapSections = new QStringList;
itemNames = new QStringList;
flagNames = new QStringList;
varNames = new QStringList;
movementTypes = new QStringList;
mapTypes = new QStringList;
mapBattleScenes = new QStringList;
weatherNames = new QStringList;
coordEventWeatherNames = new QStringList;
secretBaseIds = new QStringList;
bgEventFacingDirections = new QStringList;
@ -168,7 +172,7 @@ void Project::readMapHeader(Map* map) {
map->song = header->value(4);
map->layout_id = header->value(5);
map->location = header->value(6);
map->visibility = header->value(7);
map->requiresFlash = header->value(7);
map->weather = header->value(8);
map->type = header->value(9);
map->unknown = header->value(10);
@ -183,13 +187,13 @@ void Project::setNewMapHeader(Map* map, int mapIndex) {
map->connections_label = "0x0";
map->song = "MUS_DAN02";
map->layout_id = QString("%1").arg(mapIndex);
map->location = "0";
map->visibility = "0";
map->weather = "2";
map->type = "1";
map->location = "MAPSEC_LITTLEROOT_TOWN";
map->requiresFlash = "FALSE";
map->weather = "WEATHER_SUNNY";
map->type = "MAP_TYPE_TOWN";
map->unknown = "0";
map->show_location = "1";
map->battle_scene = "0";
map->show_location = "TRUE";
map->battle_scene = "MAP_BATTLE_SCENE_NORMAL";
}
void Project::saveMapHeader(Map *map) {
@ -211,7 +215,7 @@ void Project::saveMapHeader(Map *map) {
text += QString("\t.2byte %1\n").arg(map->song);
text += QString("\t.2byte %1\n").arg(map->layout_id);
text += QString("\t.byte %1\n").arg(map->location);
text += QString("\t.byte %1\n").arg(map->visibility);
text += QString("\t.byte %1\n").arg(map->requiresFlash);
text += QString("\t.byte %1\n").arg(map->weather);
text += QString("\t.byte %1\n").arg(map->type);
text += QString("\t.2byte %1\n").arg(map->unknown);
@ -986,15 +990,6 @@ QList<QStringList>* Project::parseAsm(QString text) {
return parser->parseAsm(text);
}
QStringList Project::getLocations() {
// TODO
QStringList names;
for (int i = 0; i < 88; i++) {
names.append(QString("%1").arg(i));
}
return names;
}
QStringList Project::getVisibilities() {
// TODO
QStringList names;
@ -1045,31 +1040,10 @@ QMap<QString, QStringList> Project::getTilesets() {
return allTilesets;
}
QStringList Project::getWeathers() {
// TODO
QStringList names;
for (int i = 0; i < 16; i++) {
names.append(QString("%1").arg(i));
}
return names;
}
QStringList Project::getMapTypes() {
// TODO
QStringList names;
for (int i = 0; i < 16; i++) {
names.append(QString("%1").arg(i));
}
return names;
}
QStringList Project::getBattleScenes() {
// TODO
QStringList names;
for (int i = 0; i < 16; i++) {
names.append(QString("%1").arg(i));
}
return names;
void Project::readRegionMapSections() {
QString filepath = root + "/include/constants/region_map_sections.h";
QStringList prefixes = (QStringList() << "MAPSEC_");
readCDefinesSorted(filepath, prefixes, regionMapSections);
}
void Project::readItemNames() {
@ -1096,6 +1070,24 @@ void Project::readMovementTypes() {
readCDefinesSorted(filepath, prefixes, movementTypes);
}
void Project::readMapTypes() {
QString filepath = root + "/include/constants/map_types.h";
QStringList prefixes = (QStringList() << "MAP_TYPE_");
readCDefinesSorted(filepath, prefixes, mapTypes);
}
void Project::readMapBattleScenes() {
QString filepath = root + "/include/constants/map_types.h";
QStringList prefixes = (QStringList() << "MAP_BATTLE_SCENE_");
readCDefinesSorted(filepath, prefixes, mapBattleScenes);
}
void Project::readWeatherNames() {
QString filepath = root + "/include/constants/weather.h";
QStringList prefixes = (QStringList() << "WEATHER_");
readCDefinesSorted(filepath, prefixes, weatherNames);
}
void Project::readCoordEventWeatherNames() {
QString filepath = root + "/include/constants/weather.h";
QStringList prefixes = (QStringList() << "COORD_EVENT_WEATHER_");
@ -1352,7 +1344,7 @@ void Project::readMapEvents(Map *map) {
object->put("movement_type", command.value(i++));
object->put("radius_x", command.value(i++).toInt(nullptr, 0));
object->put("radius_y", command.value(i++).toInt(nullptr, 0));
object->put("trainer_see_type", command.value(i++));
object->put("is_trainer", command.value(i++));
object->put("sight_radius_tree_id", command.value(i++));
object->put("script_label", command.value(i++));
object->put("event_flag", command.value(i++));

View file

@ -23,10 +23,14 @@ public:
QList<QString> mapLayoutsTableMaster;
QMap<QString, MapLayout*> mapLayouts;
QMap<QString, MapLayout*> mapLayoutsMaster;
QStringList *regionMapSections = NULL;
QStringList *itemNames = NULL;
QStringList *flagNames = NULL;
QStringList *varNames = NULL;
QStringList *movementTypes = NULL;
QStringList *mapTypes = NULL;
QStringList *mapBattleScenes = NULL;
QStringList *weatherNames = NULL;
QStringList *coordEventWeatherNames = NULL;
QStringList *secretBaseIds = NULL;
QStringList *bgEventFacingDirections = NULL;
@ -76,16 +80,16 @@ public:
QList<QStringList>* parseAsm(QString text);
QStringList getSongNames();
QStringList getLocations();
QStringList getVisibilities();
QMap<QString, QStringList> getTilesets();
QStringList getWeathers();
QStringList getMapTypes();
QStringList getBattleScenes();
void readRegionMapSections();
void readItemNames();
void readFlagNames();
void readVarNames();
void readMovementTypes();
void readMapTypes();
void readMapBattleScenes();
void readWeatherNames();
void readCoordEventWeatherNames();
void readSecretBaseIds();
void readBgEventFacingDirections();