mirror of
https://github.com/huderlem/porymap.git
synced 2026-09-08 00:45:39 -05:00
Add events overlay to map view (#678)
This commit is contained in:
@@ -525,17 +525,11 @@ void MainWindow::loadUserSettings() {
|
||||
ui->actionCursor_Tile_Outline->setChecked(porymapConfig.showCursorTile);
|
||||
this->editor->settings->cursorTileRectEnabled = porymapConfig.showCursorTile;
|
||||
|
||||
// Border
|
||||
ui->checkBox_ToggleBorder->setChecked(porymapConfig.showBorder);
|
||||
|
||||
// Grid
|
||||
const QSignalBlocker b_Grid(ui->checkBox_ToggleGrid);
|
||||
ui->actionShow_Grid->setChecked(porymapConfig.showGrid);
|
||||
ui->checkBox_ToggleGrid->setChecked(porymapConfig.showGrid);
|
||||
|
||||
// Mirror connections
|
||||
ui->checkBox_MirrorConnections->setChecked(porymapConfig.mirrorConnectingMaps);
|
||||
|
||||
// Collision opacity/transparency
|
||||
const QSignalBlocker b_CollisionTransparency(ui->horizontalSlider_CollisionTransparency);
|
||||
this->editor->collisionOpacity = static_cast<qreal>(porymapConfig.collisionOpacity) / 100;
|
||||
@@ -555,6 +549,10 @@ void MainWindow::loadUserSettings() {
|
||||
ui->horizontalSlider_MetatileZoom->setValue(porymapConfig.metatilesZoom);
|
||||
ui->horizontalSlider_CollisionZoom->setValue(porymapConfig.collisionZoom);
|
||||
|
||||
ui->checkBox_MirrorConnections->setChecked(porymapConfig.mirrorConnectingMaps);
|
||||
ui->checkBox_ToggleBorder->setChecked(porymapConfig.showBorder);
|
||||
ui->actionShow_Events_In_Map_View->setChecked(porymapConfig.eventOverlayEnabled);
|
||||
|
||||
setTheme(porymapConfig.theme);
|
||||
setDivingMapsVisible(porymapConfig.showDiveEmergeMaps);
|
||||
}
|
||||
@@ -1787,14 +1785,20 @@ void MainWindow::on_mapViewTab_tabBarClicked(int index)
|
||||
if (index != oldIndex)
|
||||
Scripting::cb_MapViewTabChanged(oldIndex, index);
|
||||
|
||||
static const QMap<int, Editor::EditMode> tabIndexToEditMode = {
|
||||
{MapViewTab::Metatiles, Editor::EditMode::Metatiles},
|
||||
{MapViewTab::Collision, Editor::EditMode::Collision},
|
||||
{MapViewTab::Prefabs, Editor::EditMode::Metatiles},
|
||||
};
|
||||
if (tabIndexToEditMode.contains(index)) {
|
||||
editor->setEditMode(tabIndexToEditMode.value(index));
|
||||
}
|
||||
|
||||
if (index == MapViewTab::Metatiles) {
|
||||
editor->setEditingMetatiles();
|
||||
refreshMetatileViews();
|
||||
} else if (index == MapViewTab::Collision) {
|
||||
editor->setEditingCollision();
|
||||
refreshCollisionSelector();
|
||||
} else if (index == MapViewTab::Prefabs) {
|
||||
editor->setEditingMetatiles();
|
||||
if (projectConfig.prefabFilepath.isEmpty() && !projectConfig.prefabImportPrompted) {
|
||||
// User hasn't set up prefabs and hasn't been prompted before.
|
||||
// Ask if they'd like to import the default prefabs file.
|
||||
@@ -1821,19 +1825,26 @@ void MainWindow::on_mainTabBar_tabBarClicked(int index)
|
||||
};
|
||||
ui->mainStackedWidget->setCurrentIndex(tabIndexToStackIndex.value(index));
|
||||
|
||||
static const QMap<int, Editor::EditMode> tabIndexToEditMode = {
|
||||
// MainTab::Map itself has no edit mode, depends on mapViewTab.
|
||||
{MainTab::Events, Editor::EditMode::Events},
|
||||
{MainTab::Header, Editor::EditMode::Header},
|
||||
{MainTab::Connections, Editor::EditMode::Connections},
|
||||
{MainTab::WildPokemon, Editor::EditMode::Encounters},
|
||||
};
|
||||
if (tabIndexToEditMode.contains(index)) {
|
||||
editor->setEditMode(tabIndexToEditMode.value(index));
|
||||
}
|
||||
|
||||
if (index == MainTab::Map) {
|
||||
ui->stackedWidget_MapEvents->setCurrentIndex(0);
|
||||
on_mapViewTab_tabBarClicked(ui->mapViewTab->currentIndex());
|
||||
clickToolButtonFromEditAction(editor->mapEditAction);
|
||||
} else if (index == MainTab::Events) {
|
||||
ui->stackedWidget_MapEvents->setCurrentIndex(1);
|
||||
editor->setEditingEvents();
|
||||
clickToolButtonFromEditAction(editor->eventEditAction);
|
||||
} else if (index == MainTab::Connections) {
|
||||
editor->setEditingConnections();
|
||||
ui->graphicsView_Connections->setFocus(); // Avoid opening tab with focus on something editable
|
||||
} else if (index == MainTab::WildPokemon) {
|
||||
editor->setEditingEncounters();
|
||||
}
|
||||
|
||||
if (!editor->map) return;
|
||||
@@ -1883,6 +1894,11 @@ void MainWindow::on_actionCursor_Tile_Outline_triggered()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionShow_Events_In_Map_View_triggered() {
|
||||
porymapConfig.eventOverlayEnabled = ui->actionShow_Events_In_Map_View->isChecked();
|
||||
this->editor->redrawAllEvents();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionShow_Grid_triggered() {
|
||||
this->editor->toggleGrid(ui->actionShow_Grid->isChecked());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user