Pivot map header experience based on base_game_version
This commit is contained in:
parent
6b01d5a942
commit
ebdab421cb
5 changed files with 212 additions and 47 deletions
|
@ -158,7 +158,7 @@
|
|||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="tabsClosable">
|
||||
<bool>false</bool>
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -1826,6 +1826,16 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_Visibility">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Whether or not the map is dark and requires Flash to illuminate.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
|
@ -1860,23 +1870,6 @@
|
|||
</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><html><head/><body><p>Whether or not to display the location name when the player enters the map.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
|
@ -1894,10 +1887,68 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_Visibility">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Show Location Name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_ShowLocation">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Whether or not the map is dark and requires Flash to illuminate.</p></body></html></string>
|
||||
<string><html><head/><body><p>Whether or not to display the location name when the player enters the map.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="label_AllowRunning">
|
||||
<property name="text">
|
||||
<string>Allow Running</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_AllowRunning">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Allows the player to use Running Shoes</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<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><html><head/><body><p>Allows the player to use a Bike</p></body></html></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 & Escape Rope</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="1">
|
||||
<widget class="QCheckBox" name="checkBox_AllowEscapeRope">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Allows the player to use Dig or Escape Rope</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
|
@ -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">
|
||||
|
@ -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">
|
||||
|
|
|
@ -37,6 +37,9 @@ public:
|
|||
QString type;
|
||||
QString unknown;
|
||||
QString show_location;
|
||||
QString allowRunning;
|
||||
QString allowBiking;
|
||||
QString allowEscapeRope;
|
||||
QString battle_scene;
|
||||
MapLayout *layout;
|
||||
bool isPersistedToFile = true;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
@ -192,6 +195,7 @@ private:
|
|||
void initEditor();
|
||||
void initMiscHeapObjects();
|
||||
void initMapSortOrder();
|
||||
void setProjectSpecificUIVisibility();
|
||||
void loadUserSettings();
|
||||
bool openRecentProject();
|
||||
void updateTilesetEditor();
|
||||
|
|
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "project.h"
|
||||
#include "config.h"
|
||||
#include "history.h"
|
||||
#include "historyitem.h"
|
||||
#include "log.h"
|
||||
|
@ -186,8 +187,41 @@ bool Project::readMapHeader(Map* map) {
|
|||
map->weather = header->value(8);
|
||||
map->type = header->value(9);
|
||||
map->unknown = header->value(10);
|
||||
map->show_location = header->value(11);
|
||||
map->battle_scene = header->value(12);
|
||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby) {
|
||||
map->show_location = header->value(11);
|
||||
map->battle_scene = header->value(12);
|
||||
} else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeemerald) {
|
||||
QString allow_bike = header->value(11);
|
||||
if (allow_bike.startsWith("allow_bike")) {
|
||||
map->allowBiking = allow_bike.split("=").last();
|
||||
} else {
|
||||
logError(QString("Expected 'allow_bike', but encountered '%1' in '%2' header").arg(allow_bike).arg(map->name));
|
||||
}
|
||||
|
||||
QString allow_escape_rope = header->value(12);
|
||||
if (allow_escape_rope.startsWith("allow_escape_rope")) {
|
||||
map->allowEscapeRope = allow_escape_rope.split("=").last();
|
||||
} else {
|
||||
logError(QString("Expected 'allow_escape_rope', but encountered '%1' in '%2' header").arg(allow_escape_rope).arg(map->name));
|
||||
}
|
||||
|
||||
QString allow_run = header->value(13);
|
||||
if (allow_run.startsWith("allow_run")) {
|
||||
map->allowRunning = allow_run.split("=").last();
|
||||
} else {
|
||||
logError(QString("Expected 'allow_run', but encountered '%1' in '%2' header").arg(allow_run).arg(map->name));
|
||||
}
|
||||
|
||||
QString show_map_name = header->value(14);
|
||||
if (show_map_name.startsWith("show_map_name")) {
|
||||
map->show_location = show_map_name.split("=").last();
|
||||
} else {
|
||||
logError(QString("Expected 'show_map_name', but encountered '%1' in '%2' header").arg(show_map_name).arg(map->name));
|
||||
}
|
||||
|
||||
map->battle_scene = header->value(15);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -260,7 +294,16 @@ void Project::saveMapHeader(Map *map) {
|
|||
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);
|
||||
text += QString("\t.byte %1\n").arg(map->show_location);
|
||||
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeruby) {
|
||||
text += QString("\t.byte %1\n").arg(map->show_location);
|
||||
} else if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokeemerald) {
|
||||
text += QString("\tmap_header_flags allow_bike=%1, allow_escape_rope=%2, allow_run=%3, show_map_name=%4\n")
|
||||
.arg(map->allowBiking)
|
||||
.arg(map->allowEscapeRope)
|
||||
.arg(map->allowRunning)
|
||||
.arg(map->show_location);
|
||||
}
|
||||
|
||||
text += QString("\t.byte %1\n").arg(map->battle_scene);
|
||||
saveTextFile(header_path, text);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue