Editable trainer type, minor fixes

This commit is contained in:
GriffinR 2020-03-26 15:11:42 -04:00
parent 8e26f4c3f5
commit 0fb483b5d3
2 changed files with 16 additions and 14 deletions

View file

@ -1364,6 +1364,7 @@ void MainWindow::updateSelectedObjects() {
QList<EventPropertiesFrame *> frames; QList<EventPropertiesFrame *> frames;
bool pokefirered = projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered;
for (DraggablePixmapItem *item : *events) { for (DraggablePixmapItem *item : *events) {
EventPropertiesFrame *frame = new EventPropertiesFrame; EventPropertiesFrame *frame = new EventPropertiesFrame;
// frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); // frame->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
@ -1458,7 +1459,7 @@ void MainWindow::updateSelectedObjects() {
fields << "event_flag"; fields << "event_flag";
fields << "trainer_type"; fields << "trainer_type";
fields << "sight_radius_tree_id"; fields << "sight_radius_tree_id";
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) { if (pokefirered) {
fields << "in_connection"; fields << "in_connection";
} }
} }
@ -1481,7 +1482,7 @@ void MainWindow::updateSelectedObjects() {
else if (event_type == EventType::HiddenItem) { else if (event_type == EventType::HiddenItem) {
fields << "item"; fields << "item";
fields << "flag"; fields << "flag";
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) { if (pokefirered) {
fields << "quantity"; fields << "quantity";
fields << "underfoot"; fields << "underfoot";
} }
@ -1493,7 +1494,7 @@ void MainWindow::updateSelectedObjects() {
// Hide elevation so users don't get impression that editing it is meaningful. // Hide elevation so users don't get impression that editing it is meaningful.
frame->ui->spinBox_z->setVisible(false); frame->ui->spinBox_z->setVisible(false);
frame->ui->label_z->setVisible(false); frame->ui->label_z->setVisible(false);
if (projectConfig.getBaseGameVersion() == BaseGameVersion::pokefirered) { if (pokefirered) {
fields << "respawn_map"; fields << "respawn_map";
fields << "respawn_npc"; fields << "respawn_npc";
} }
@ -1521,10 +1522,8 @@ void MainWindow::updateSelectedObjects() {
combo = new NoScrollComboBox(widget); combo = new NoScrollComboBox(widget);
combo->setEditable(true); combo->setEditable(true);
} }
// trainer_type has custom values, so it has special signal logic. // trainer_type has custom values, so it has special signal logic.
if (key == "trainer_type") { if (key == "trainer_type") {
combo->setEditable(false);
combo->addItem("NONE", "0"); combo->addItem("NONE", "0");
combo->addItem("NORMAL", "1"); combo->addItem("NORMAL", "1");
combo->addItem("SEE ALL DIRECTIONS", "3"); combo->addItem("SEE ALL DIRECTIONS", "3");
@ -1536,6 +1535,8 @@ void MainWindow::updateSelectedObjects() {
int index = combo->findData(value); int index = combo->findData(value);
if (index != -1) { if (index != -1) {
combo->setCurrentIndex(index); combo->setCurrentIndex(index);
} else {
combo->setCurrentText(value);
} }
fl->addRow(new QLabel(field_labels[key], widget), combo); fl->addRow(new QLabel(field_labels[key], widget), combo);
@ -1640,7 +1641,8 @@ void MainWindow::updateSelectedObjects() {
combo->addItems(*editor->project->mapNames); combo->addItems(*editor->project->mapNames);
combo->setToolTip("The map where the player will respawn after whiteout."); combo->setToolTip("The map where the player will respawn after whiteout.");
} else if (key == "respawn_npc") { } else if (key == "respawn_npc") {
spin->setToolTip("event_object ID of the NPC the player interacts with upon respawning after whiteout."); spin->setToolTip("event_object ID of the NPC the player interacts with\n"
"upon respawning after whiteout.");
spin->setMinimum(1); spin->setMinimum(1);
spin->setMaximum(126); spin->setMaximum(126);
} else { } else {

View file

@ -66,8 +66,8 @@ void TilesetEditor::init(Project *project, QString primaryTilesetLabel, QString
this->ui->comboBox_encounterType->setVisible(true); this->ui->comboBox_encounterType->setVisible(true);
this->ui->label_encounterType->setVisible(true); this->ui->label_encounterType->setVisible(true);
this->ui->comboBox_encounterType->addItem("None", 0); this->ui->comboBox_encounterType->addItem("None", 0);
this->ui->comboBox_encounterType->addItem("Grass", 1); this->ui->comboBox_encounterType->addItem("Land", 1);
this->ui->comboBox_encounterType->addItem("Surf", 2); this->ui->comboBox_encounterType->addItem("Water", 2);
this->ui->comboBox_terrainType->setVisible(true); this->ui->comboBox_terrainType->setVisible(true);
this->ui->label_terrainType->setVisible(true); this->ui->label_terrainType->setVisible(true);
this->ui->comboBox_terrainType->addItem("Normal", 0); this->ui->comboBox_terrainType->addItem("Normal", 0);