Skip to content

Commit

Permalink
Pivot map header experience based on base_game_version
Browse files Browse the repository at this point in the history
  • Loading branch information
huderlem committed Dec 26, 2018
1 parent 6b01d5a commit ebdab42
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 40 deletions.
125 changes: 88 additions & 37 deletions forms/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<property name="tabsClosable">
<bool>false</bool>
Expand Down Expand Up @@ -482,8 +482,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>481</width>
<height>606</height>
<width>469</width>
<height>608</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">
Expand Down Expand Up @@ -797,8 +797,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>70</height>
<width>324</width>
<height>77</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
Expand Down Expand Up @@ -909,8 +909,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>304</width>
<height>372</height>
<width>307</width>
<height>387</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1226,8 +1226,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>385</width>
<height>655</height>
<width>381</width>
<height>657</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_7">
Expand Down Expand Up @@ -1499,8 +1499,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>565</height>
<width>430</width>
<height>568</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1544,8 +1544,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>565</height>
<width>98</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1589,8 +1589,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>565</height>
<width>98</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1634,8 +1634,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>565</height>
<width>98</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1679,8 +1679,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>565</height>
<width>98</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1730,8 +1730,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>432</width>
<height>565</height>
<width>98</width>
<height>28</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -1826,6 +1826,16 @@
</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>
<item row="3" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
Expand Down Expand Up @@ -1860,14 +1870,31 @@
</property>
</widget>
</item>
<item row="5" column="0">
<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="7" column="0">
<widget class="QLabel" name="label_8">
<property name="text">
<string>Show Location Name</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="7" 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>
Expand All @@ -1877,27 +1904,51 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_9">
<item row="8" column="0">
<widget class="QLabel" name="label_AllowRunning">
<property name="text">
<string>Battle scene</string>
<string>Allow Running</string>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QComboBox" name="comboBox_BattleScene">
<item row="8" column="1">
<widget class="QCheckBox" name="checkBox_AllowRunning">
<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>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Allows the player to use Running Shoes&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="editable">
<bool>true</bool>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="checkBox_Visibility">
<item row="9" column="0">
<widget class="QLabel" name="label_AllowBiking">
<property name="text">
<string>Allow Biking</string>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QCheckBox" name="checkBox_AllowBiking">
<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>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Allows the player to use a Bike&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_AllowEscapeRope">
<property name="text">
<string>Allow Dig &amp; Escape Rope</string>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QCheckBox" name="checkBox_AllowEscapeRope">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Allows the player to use Dig or Escape Rope&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string/>
Expand Down Expand Up @@ -2234,8 +2285,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>829</width>
<height>552</height>
<width>826</width>
<height>557</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_14">
Expand Down Expand Up @@ -2407,7 +2458,7 @@
<x>0</x>
<y>0</y>
<width>1117</width>
<height>20</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down
3 changes: 3 additions & 0 deletions include/core/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Map : public QObject
QString type;
QString unknown;
QString show_location;
QString allowRunning;
QString allowBiking;
QString allowEscapeRope;
QString battle_scene;
MapLayout *layout;
bool isPersistedToFile = true;
Expand Down
4 changes: 4 additions & 0 deletions include/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ private slots:
void on_comboBox_Type_activated(const QString &arg1);
void on_comboBox_BattleScene_activated(const QString &arg1);
void on_checkBox_ShowLocation_clicked(bool checked);
void on_checkBox_AllowRunning_clicked(bool checked);
void on_checkBox_AllowBiking_clicked(bool checked);
void on_checkBox_AllowEscapeRope_clicked(bool checked);

void on_tabWidget_currentChanged(int index);

Expand Down Expand Up @@ -192,6 +195,7 @@ private slots:
void initEditor();
void initMiscHeapObjects();
void initMapSortOrder();
void setProjectSpecificUIVisibility();
void loadUserSettings();
bool openRecentProject();
void updateTilesetEditor();
Expand Down
64 changes: 64 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,29 @@ void MainWindow::initMapSortOrder() {
sortOrder->setChecked(true);
}

void MainWindow::setProjectSpecificUIVisibility()
{
switch (projectConfig.getBaseGameVersion())
{
case BaseGameVersion::pokeruby:
ui->checkBox_AllowRunning->setVisible(false);
ui->checkBox_AllowBiking->setVisible(false);
ui->checkBox_AllowEscapeRope->setVisible(false);
ui->label_AllowRunning->setVisible(false);
ui->label_AllowBiking->setVisible(false);
ui->label_AllowEscapeRope->setVisible(false);
break;
case BaseGameVersion::pokeemerald:
ui->checkBox_AllowRunning->setVisible(true);
ui->checkBox_AllowBiking->setVisible(true);
ui->checkBox_AllowEscapeRope->setVisible(true);
ui->label_AllowRunning->setVisible(true);
ui->label_AllowBiking->setVisible(true);
ui->label_AllowEscapeRope->setVisible(true);
break;
}
}

void MainWindow::mapSortOrder_changed(QAction *action)
{
QList<QAction*> items = ui->toolButton_MapSortOrder->menu()->actions();
Expand Down Expand Up @@ -199,6 +222,8 @@ bool MainWindow::openProject(QString dir) {
projectConfig.setProjectDir(dir);
projectConfig.load();

this->setProjectSpecificUIVisibility();

bool already_open = isProjectOpen() && (editor->project->root == dir);
if (!already_open) {
editor->project = new Project;
Expand Down Expand Up @@ -395,6 +420,9 @@ void MainWindow::displayMapProperties() {
ui->comboBox_PrimaryTileset->clear();
ui->comboBox_SecondaryTileset->clear();
ui->checkBox_ShowLocation->setChecked(false);
ui->checkBox_AllowRunning->setChecked(false);
ui->checkBox_AllowBiking->setChecked(false);
ui->checkBox_AllowEscapeRope->setChecked(false);
if (!editor || !editor->map || !editor->project) {
ui->frame_3->setEnabled(false);
return;
Expand Down Expand Up @@ -428,6 +456,9 @@ void MainWindow::displayMapProperties() {
ui->comboBox_BattleScene->setCurrentText(map->battle_scene);

ui->checkBox_ShowLocation->setChecked(map->show_location.toInt() > 0 || map->show_location == "TRUE");
ui->checkBox_AllowRunning->setChecked(map->allowRunning.toInt() > 0 || map->allowRunning == "TRUE");
ui->checkBox_AllowBiking->setChecked(map->allowBiking.toInt() > 0 || map->allowBiking == "TRUE");
ui->checkBox_AllowEscapeRope->setChecked(map->allowEscapeRope.toInt() > 0 || map->allowEscapeRope == "TRUE");
}

void MainWindow::on_comboBox_Song_activated(const QString &song)
Expand Down Expand Up @@ -494,6 +525,39 @@ void MainWindow::on_checkBox_ShowLocation_clicked(bool checked)
}
}

void MainWindow::on_checkBox_AllowRunning_clicked(bool checked)
{
if (editor && editor->map) {
if (checked) {
editor->map->allowRunning = "1";
} else {
editor->map->allowRunning = "0";
}
}
}

void MainWindow::on_checkBox_AllowBiking_clicked(bool checked)
{
if (editor && editor->map) {
if (checked) {
editor->map->allowBiking = "1";
} else {
editor->map->allowBiking = "0";
}
}
}

void MainWindow::on_checkBox_AllowEscapeRope_clicked(bool checked)
{
if (editor && editor->map) {
if (checked) {
editor->map->allowEscapeRope = "1";
} else {
editor->map->allowEscapeRope = "0";
}
}
}

void MainWindow::loadDataStructures() {
Project *project = editor->project;
project->readMapLayoutsTable();
Expand Down

0 comments on commit ebdab42

Please sign in to comment.