diff --git a/forms/projectsettingseditor.ui b/forms/projectsettingseditor.ui
index 696df9ac..fe065be9 100644
--- a/forms/projectsettingseditor.ui
+++ b/forms/projectsettingseditor.ui
@@ -6,8 +6,8 @@
0
0
- 631
- 600
+ 642
+ 609
@@ -38,8 +38,8 @@
0
0
- 559
- 589
+ 570
+ 692
@@ -281,44 +281,86 @@
-
-
+
- Player View Size
+ Player View Distance
-
-
-
-
-
- Width
-
-
+
+
-
+
+
-
+
+
+ North
+
+
+
+ -
+
+
+ South
+
+
+
+ -
+
+
+ 0
+
+
+ <html><head/><body><p>The distance (in pixels) that a player is able to see North of their character's position in-game. By default this is the distance from the center 16x16 to the edge of the 160 pixel tall GBA screen.</p></body></html>
+
+
+
+ -
+
+
+ 0
+
+
+ <html><head/><body><p>The distance (in pixels) that a player is able to see South of their character's position in-game. By default this is the distance from the center 16x16 to the edge of the 160 pixel tall GBA screen.</p></body></html>
+
+
+
+
- -
-
-
- <html><head/><body><p>The horizontal size in pixels of the area that the player can see in-game (normally, the full width of the GBA screen).</p></body></html>
-
-
- 16
-
-
-
- -
-
-
- Height
-
-
-
- -
-
-
- <html><head/><body><p>The vertical size in pixels of the area that the player can see in-game (normally, the full height of the GBA screen).</p></body></html>
-
-
- 16
-
-
+
-
+
+
-
+
+
+ West
+
+
+
+ -
+
+
+ East
+
+
+
+ -
+
+
+ 0
+
+
+ <html><head/><body><p>The distance (in pixels) that a player is able to see West of their character's position in-game. By default this is the distance from the center 16x16 to the edge of the 240 pixel wide GBA screen.</p></body></html>
+
+
+
+ -
+
+
+ 0
+
+
+ <html><head/><body><p>The distance (in pixels) that a player is able to see East of their character's position in-game. By default this is the distance from the center 16x16 to the edge of the 240 pixel wide GBA screen.</p></body></html>
+
+
+
+
@@ -421,7 +463,7 @@
0
0
- 559
+ 561
622
@@ -792,7 +834,7 @@
0
0
- 559
+ 561
798
@@ -1134,7 +1176,7 @@
0
0
- 559
+ 561
840
@@ -1516,8 +1558,8 @@
0
0
- 559
- 490
+ 561
+ 593
@@ -1563,8 +1605,8 @@
0
0
- 533
- 428
+ 535
+ 531
@@ -1605,8 +1647,8 @@
0
0
- 559
- 490
+ 561
+ 593
@@ -1652,8 +1694,8 @@
0
0
- 533
- 428
+ 535
+ 531
diff --git a/include/config.h b/include/config.h
index 18422e09..fe62377f 100644
--- a/include/config.h
+++ b/include/config.h
@@ -15,11 +15,11 @@
#include "events.h"
-static const QVersionNumber porymapVersion = QVersionNumber::fromString(PORYMAP_VERSION);
+extern const QVersionNumber porymapVersion;
-// In both versions the default new map border is a generic tree
-#define DEFAULT_BORDER_RSE (QList{0x1D4, 0x1D5, 0x1DC, 0x1DD})
-#define DEFAULT_BORDER_FRLG (QList{0x14, 0x15, 0x1C, 0x1D})
+// Distance in pixels from the edge of a GBA screen (240x160) to the center 16x16 pixels.
+#define GBA_H_DIST_TO_CENTER ((240-16)/2)
+#define GBA_V_DIST_TO_CENTER ((160-16)/2)
#define CONFIG_BACKWARDS_COMPATABILITY
@@ -332,7 +332,7 @@ public:
this->pokemonIconPaths.clear();
this->collisionSheetPath = QString();
this->collisionSheetSize = QSize(2, 16);
- this->playerViewSize = QSize(240, 160);
+ this->playerViewDistance = QMargins(GBA_H_DIST_TO_CENTER, GBA_V_DIST_TO_CENTER, GBA_H_DIST_TO_CENTER, GBA_V_DIST_TO_CENTER);
this->blockMetatileIdMask = 0x03FF;
this->blockCollisionMask = 0x0C00;
this->blockElevationMask = 0xF000;
@@ -409,7 +409,7 @@ public:
bool mapAllowFlagsEnabled;
QString collisionSheetPath;
QSize collisionSheetSize;
- QSize playerViewSize;
+ QMargins playerViewDistance;
QList warpBehaviors;
int maxEventsPerGroup;
diff --git a/include/core/maplayout.h b/include/core/maplayout.h
index 8d1d64bc..8d8bb2e2 100644
--- a/include/core/maplayout.h
+++ b/include/core/maplayout.h
@@ -96,8 +96,7 @@ public:
int getHeight() const { return height; }
int getBorderWidth() const { return border_width; }
int getBorderHeight() const { return border_height; }
- int getBorderDrawWidth() const;
- int getBorderDrawHeight() const;
+ QMargins getBorderMargins() const;
QRect getVisibleRect() const;
bool isWithinBounds(int x, int y) const;
diff --git a/include/editor.h b/include/editor.h
index b1429ef2..4a945daa 100644
--- a/include/editor.h
+++ b/include/editor.h
@@ -119,7 +119,7 @@ public:
void redrawEventPixmapItem(DraggablePixmapItem *item);
qreal getEventOpacity(const Event *event) const;
- void setPlayerViewSize(const QSize &size);
+ void setPlayerViewRect(const QRectF &rect);
void updateCursorRectPos(int x, int y);
void setCursorRectVisible(bool visible);
diff --git a/include/project.h b/include/project.h
index b9a94776..0c67e85d 100644
--- a/include/project.h
+++ b/include/project.h
@@ -256,8 +256,7 @@ public:
static QString getDynamicMapDefineName();
static QString getDynamicMapName();
static QString getEmptySpeciesName();
- static QSize getViewDistance();
- static QSize getMetatileViewDistance();
+ static QMargins getMetatileViewDistance();
static int getNumTilesPrimary() { return num_tiles_primary; }
static int getNumTilesTotal() { return num_tiles_total; }
static int getNumMetatilesPrimary() { return num_metatiles_primary; }
diff --git a/include/ui/movablerect.h b/include/ui/movablerect.h
index a9f15917..21edd21d 100644
--- a/include/ui/movablerect.h
+++ b/include/ui/movablerect.h
@@ -10,7 +10,7 @@
class MovableRect : public QGraphicsRectItem
{
public:
- MovableRect(bool *enabled, int width, int height, QRgb color);
+ MovableRect(bool *enabled, const QRectF &rect, const QRgb &color);
QRectF boundingRect() const override {
qreal penWidth = 4;
return QRectF(-penWidth,
@@ -31,6 +31,7 @@ public:
bool *enabled;
protected:
+ QRectF baseRect;
QRgb color;
};
diff --git a/src/config.cpp b/src/config.cpp
index 8c139942..b8ad1232 100644
--- a/src/config.cpp
+++ b/src/config.cpp
@@ -18,6 +18,12 @@
#include
#include
+const QVersionNumber porymapVersion = QVersionNumber::fromString(PORYMAP_VERSION);
+
+// In both versions the default new map border is a generic tree
+const QList defaultBorder_RSE = {0x1D4, 0x1D5, 0x1DC, 0x1DD};
+const QList defaultBorder_FRLG = {0x14, 0x15, 0x1C, 0x1D};
+
const QList defaultWarpBehaviors_RSE = {
0x0E, // MB_MOSSDEEP_GYM_WARP
0x0F, // MB_MT_PYRE_HOLE
@@ -835,10 +841,14 @@ void ProjectConfig::parseConfigKeyValue(QString key, QString value) {
this->collisionSheetSize.setWidth(getConfigInteger(key, value, 1, Block::maxValue));
} else if (key == "collision_sheet_height") {
this->collisionSheetSize.setHeight(getConfigInteger(key, value, 1, Block::maxValue));
- } else if (key == "player_view_width") {
- this->playerViewSize.setWidth(getConfigInteger(key, value, 16, INT_MAX, 240));
- } else if (key == "player_view_height") {
- this->playerViewSize.setHeight(getConfigInteger(key, value, 16, INT_MAX, 160));
+ } else if (key == "player_view_north") {
+ this->playerViewDistance.setTop(getConfigInteger(key, value, 0, INT_MAX, GBA_V_DIST_TO_CENTER));
+ } else if (key == "player_view_south") {
+ this->playerViewDistance.setBottom(getConfigInteger(key, value, 0, INT_MAX, GBA_V_DIST_TO_CENTER));
+ } else if (key == "player_view_west") {
+ this->playerViewDistance.setLeft(getConfigInteger(key, value, 0, INT_MAX, GBA_H_DIST_TO_CENTER));
+ } else if (key == "player_view_east") {
+ this->playerViewDistance.setRight(getConfigInteger(key, value, 0, INT_MAX, GBA_H_DIST_TO_CENTER));
} else if (key == "warp_behaviors") {
this->warpBehaviors.clear();
value.remove(" ");
@@ -872,7 +882,7 @@ void ProjectConfig::setUnreadKeys() {
if (!readKeys.contains("enable_event_clone_object")) this->eventCloneObjectEnabled = isPokefirered;
if (!readKeys.contains("enable_floor_number")) this->floorNumberEnabled = isPokefirered;
if (!readKeys.contains("create_map_text_file")) this->createMapTextFileEnabled = (this->baseGameVersion != BaseGameVersion::pokeemerald);
- if (!readKeys.contains("new_map_border_metatiles")) this->newMapBorderMetatileIds = isPokefirered ? DEFAULT_BORDER_FRLG : DEFAULT_BORDER_RSE;
+ if (!readKeys.contains("new_map_border_metatiles")) this->newMapBorderMetatileIds = isPokefirered ? defaultBorder_FRLG : defaultBorder_RSE;
if (!readKeys.contains("default_secondary_tileset")) this->defaultSecondaryTileset = isPokefirered ? "gTileset_PalletTown" : "gTileset_Petalburg";
if (!readKeys.contains("metatile_attributes_size")) this->metatileAttributesSize = Metatile::getDefaultAttributesSize(this->baseGameVersion);
if (!readKeys.contains("metatile_behavior_mask")) this->metatileBehaviorMask = Metatile::getDefaultAttributesMask(this->baseGameVersion, Metatile::Attr::Behavior);
@@ -941,8 +951,10 @@ QMap ProjectConfig::getKeyValueMap() {
map.insert("collision_sheet_path", this->collisionSheetPath);
map.insert("collision_sheet_width", QString::number(this->collisionSheetSize.width()));
map.insert("collision_sheet_height", QString::number(this->collisionSheetSize.height()));
- map.insert("player_view_width", QString::number(this->playerViewSize.width()));
- map.insert("player_view_height", QString::number(this->playerViewSize.height()));
+ map.insert("player_view_north", QString::number(this->playerViewDistance.top()));
+ map.insert("player_view_south", QString::number(this->playerViewDistance.bottom()));
+ map.insert("player_view_west", QString::number(this->playerViewDistance.left()));
+ map.insert("player_view_east", QString::number(this->playerViewDistance.right()));
QStringList warpBehaviorStrs;
for (const auto &value : this->warpBehaviors)
warpBehaviorStrs.append("0x" + QString("%1").arg(value, 2, 16, QChar('0')).toUpper());
diff --git a/src/core/map.cpp b/src/core/map.cpp
index 793090c0..b067d6a5 100644
--- a/src/core/map.cpp
+++ b/src/core/map.cpp
@@ -83,17 +83,17 @@ QRect Map::getConnectionRect(const QString &direction, Layout * fromLayout) cons
int x = 0, y = 0;
int w = getWidth(), h = getHeight();
- QSize viewDistance = Project::getMetatileViewDistance();
+ QMargins viewDistance = Project::getMetatileViewDistance();
if (direction == "up") {
- h = qMin(h, viewDistance.height());
+ h = qMin(h, viewDistance.top());
y = getHeight() - h;
} else if (direction == "down") {
- h = qMin(h, viewDistance.height());
+ h = qMin(h, viewDistance.bottom());
} else if (direction == "left") {
- w = qMin(w, viewDistance.width());
+ w = qMin(w, viewDistance.left());
x = getWidth() - w;
} else if (direction == "right") {
- w = qMin(w, viewDistance.width());
+ w = qMin(w, viewDistance.right());
} else if (MapConnection::isDiving(direction)) {
if (fromLayout) {
w = qMin(w, fromLayout->getWidth());
diff --git a/src/core/maplayout.cpp b/src/core/maplayout.cpp
index e70d8040..b8c200af 100644
--- a/src/core/maplayout.cpp
+++ b/src/core/maplayout.cpp
@@ -63,14 +63,6 @@ bool Layout::isWithinBorderBounds(int x, int y) const {
return (x >= 0 && x < this->getBorderWidth() && y >= 0 && y < this->getBorderHeight());
}
-int Layout::getBorderDrawWidth() const {
- return getBorderDrawDistance(border_width, Project::getMetatileViewDistance().width());
-}
-
-int Layout::getBorderDrawHeight() const {
- return getBorderDrawDistance(border_height, Project::getMetatileViewDistance().height());
-}
-
// Calculate the distance away from the layout's edge that we need to start drawing border blocks.
// We need to fulfill two requirements here:
// - We should draw enough to fill the player's in-game view
@@ -83,13 +75,22 @@ int Layout::getBorderDrawDistance(int dimension, qreal minimum) {
// Get first multiple of dimension >= the minimum
return dimension * qCeil(minimum / qMax(dimension, 1));
}
+QMargins Layout::getBorderMargins() const {
+ QMargins minimum = Project::getMetatileViewDistance();
+ QMargins distance;
+ distance.setTop(getBorderDrawDistance(this->border_height, minimum.top()));
+ distance.setBottom(getBorderDrawDistance(this->border_height, minimum.bottom()));
+ distance.setLeft(getBorderDrawDistance(this->border_width, minimum.left()));
+ distance.setRight(getBorderDrawDistance(this->border_width, minimum.right()));
+ return distance;
+}
// Get a rectangle that represents (in pixels) the layout's map area and the visible area of its border.
+// At maximum, this is equal to the map size plus the border margins.
+// If the border is large (and so beyond player the view) it may be smaller than that.
QRect Layout::getVisibleRect() const {
QRect area = QRect(0, 0, this->width * 16, this->height * 16);
- QSize viewDistance = Project::getMetatileViewDistance() * 16;
- area += QMargins(viewDistance.width(), viewDistance.height(), viewDistance.width(), viewDistance.height());
- return area;
+ return area += (Project::getMetatileViewDistance() * 16);
}
bool Layout::getBlock(int x, int y, Block *out) {
diff --git a/src/editor.cpp b/src/editor.cpp
index 54fc9640..d41a33a2 100644
--- a/src/editor.cpp
+++ b/src/editor.cpp
@@ -30,7 +30,6 @@ Editor::Editor(Ui::MainWindow* ui)
{
this->ui = ui;
this->settings = new Settings();
- this->playerViewRect = new MovableRect(&this->settings->playerViewRectEnabled, 30 * 8, 20 * 8, qRgb(255, 255, 255));
this->cursorMapTileRect = new CursorTileRect(&this->settings->cursorTileRectEnabled, qRgb(255, 255, 255));
this->map_ruler = new MapRuler(4);
connect(this->map_ruler, &MapRuler::statusChanged, this, &Editor::mapRulerStatusChanged);
@@ -1061,14 +1060,9 @@ void Editor::scaleMapView(int s) {
ui->graphicsView_Connections->setTransform(transform);
}
-void Editor::setPlayerViewSize(const QSize &size) {
- if (!this->playerViewRect)
- return;
-
- auto rect = this->playerViewRect->rect();
- rect.setWidth(qMax(size.width(), 16));
- rect.setHeight(qMax(size.height(), 16));
- this->playerViewRect->setRect(rect);
+void Editor::setPlayerViewRect(const QRectF &rect) {
+ delete this->playerViewRect;
+ this->playerViewRect = new MovableRect(&this->settings->playerViewRectEnabled, rect, qRgb(255, 255, 255));
if (ui->graphicsView_Map->scene())
ui->graphicsView_Map->scene()->update();
}
@@ -1794,11 +1788,10 @@ void Editor::clearMapBorder() {
void Editor::displayMapBorder() {
clearMapBorder();
- int borderHorzDist = this->layout->getBorderDrawWidth();
- int borderVertDist = this->layout->getBorderDrawHeight();
QPixmap pixmap = this->layout->renderBorder();
- for (int y = -borderVertDist; y < this->layout->getHeight() + borderVertDist; y += this->layout->getBorderHeight())
- for (int x = -borderHorzDist; x < this->layout->getWidth() + borderHorzDist; x += this->layout->getBorderWidth()) {
+ const QMargins borderMargins = layout->getBorderMargins();
+ for (int y = -borderMargins.top(); y < this->layout->getHeight() + borderMargins.bottom(); y += this->layout->getBorderHeight())
+ for (int x = -borderMargins.left(); x < this->layout->getWidth() + borderMargins.right(); x += this->layout->getBorderWidth()) {
QGraphicsPixmapItem *item = new QGraphicsPixmapItem(pixmap);
item->setX(x * 16);
item->setY(y * 16);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 076f8f8f..24495350 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1171,7 +1171,7 @@ bool MainWindow::setProjectUI() {
ui->newEventToolButton->setEventTypeVisible(Event::Type::SecretBase, projectConfig.eventSecretBaseEnabled);
ui->newEventToolButton->setEventTypeVisible(Event::Type::CloneObject, projectConfig.eventCloneObjectEnabled);
- this->editor->setPlayerViewSize(projectConfig.playerViewSize);
+ this->editor->setPlayerViewRect(QRectF(0, 0, 16, 16).marginsAdded(projectConfig.playerViewDistance));
editor->setCollisionGraphics();
ui->spinBox_SelectedElevation->setMaximum(Block::getMaxElevation());
diff --git a/src/project.cpp b/src/project.cpp
index d91d63da..11d7b93c 100644
--- a/src/project.cpp
+++ b/src/project.cpp
@@ -3235,18 +3235,14 @@ QString Project::getEmptySpeciesName() {
return projectConfig.getIdentifier(ProjectIdentifier::define_species_prefix) + projectConfig.getIdentifier(ProjectIdentifier::define_species_empty);
}
-// Get the distance in pixels that the player is able to see from the space they're standing on.
-// For the default size of the view area (i.e. the full 240x160 GBA screen) this is 112x72.
-QSize Project::getViewDistance() {
- return ((projectConfig.playerViewSize) - QSize(16,16)) / 2;
-}
-
-// Get the distance in metatiles that the player is able to see from the space they're standing on, rounded up.
-// For the default size of the view area (i.e. the full 240x160 GBA screen) this is 7x5 metatiles.
-QSize Project::getMetatileViewDistance() {
- QSize viewDistance = getViewDistance();
- viewDistance.setWidth(qCeil(viewDistance.width() / 16.0));
- viewDistance.setHeight(qCeil(viewDistance.height() / 16.0));
+// Get the distance in metatiles (rounded up) that the player is able to see in each direction in-game.
+// For the default view distance (i.e. assuming the player is centered in a 240x160 pixel GBA screen) this is 7x5 metatiles.
+QMargins Project::getMetatileViewDistance() {
+ QMargins viewDistance = projectConfig.playerViewDistance;
+ viewDistance.setTop(qCeil(viewDistance.top() / 16.0));
+ viewDistance.setBottom(qCeil(viewDistance.bottom() / 16.0));
+ viewDistance.setLeft(qCeil(viewDistance.left() / 16.0));
+ viewDistance.setRight(qCeil(viewDistance.right() / 16.0));
return viewDistance;
}
diff --git a/src/ui/mapimageexporter.cpp b/src/ui/mapimageexporter.cpp
index 9a65af8f..acb1f538 100644
--- a/src/ui/mapimageexporter.cpp
+++ b/src/ui/mapimageexporter.cpp
@@ -606,11 +606,7 @@ QPixmap MapImageExporter::getFormattedMapPixmap() {
QMargins MapImageExporter::getMargins(const Map *map) {
QMargins margins;
if (m_settings.showBorder) {
- // When we render map borders we render them in full increments of the border dimensions.
- // This means for large border dimensions the painted area of the border may extend well beyond the area the player can see.
- // When we call paintBorder we will clip the painting to this visible area, so we only need to consider the visible area here.
- QSize viewDistance = m_project->getMetatileViewDistance() * 16;
- margins = QMargins(viewDistance.width(), viewDistance.height(), viewDistance.width(), viewDistance.height());
+ margins = m_project->getMetatileViewDistance() * 16;
} else if (map && connectionsEnabled()) {
for (const auto &connection : map->getConnections()) {
const QString dir = connection->direction();
@@ -654,10 +650,9 @@ void MapImageExporter::paintBorder(QPainter *painter, Layout *layout) {
painter->save();
painter->setClipRect(layout->getVisibleRect());
- int borderHorzDist = layout->getBorderDrawWidth();
- int borderVertDist = layout->getBorderDrawHeight();
- for (int y = -borderVertDist; y < layout->getHeight() + borderVertDist; y += layout->getBorderHeight())
- for (int x = -borderHorzDist; x < layout->getWidth() + borderHorzDist; x += layout->getBorderWidth()) {
+ const QMargins borderMargins = layout->getBorderMargins();
+ for (int y = -borderMargins.top(); y < layout->getHeight() + borderMargins.bottom(); y += layout->getBorderHeight())
+ for (int x = -borderMargins.left(); x < layout->getWidth() + borderMargins.right(); x += layout->getBorderWidth()) {
// Skip border painting if it would be fully covered by the rest of the map
if (layout->isWithinBounds(QRect(x, y, layout->getBorderWidth(), layout->getBorderHeight())))
continue;
diff --git a/src/ui/movablerect.cpp b/src/ui/movablerect.cpp
index fde7f820..4290d1a7 100644
--- a/src/ui/movablerect.cpp
+++ b/src/ui/movablerect.cpp
@@ -5,17 +5,21 @@
#include "movablerect.h"
#include "utility.h"
-MovableRect::MovableRect(bool *enabled, int width, int height, QRgb color)
- : QGraphicsRectItem(0, 0, width, height)
+MovableRect::MovableRect(bool *enabled, const QRectF &rect, const QRgb &color)
+ : QGraphicsRectItem(rect),
+ enabled(enabled),
+ baseRect(rect),
+ color(color)
{
- this->enabled = enabled;
- this->color = color;
this->setVisible(*enabled);
}
/// Center rect on grid position (x, y)
void MovableRect::updateLocation(int x, int y) {
- this->setRect((x * 16) - this->rect().width() / 2 + 8, (y * 16) - this->rect().height() / 2 + 8, this->rect().width(), this->rect().height());
+ this->setRect(this->baseRect.x() + (x * 16),
+ this->baseRect.y() + (y * 16),
+ this->baseRect.width(),
+ this->baseRect.height());
this->setVisible(*this->enabled);
}
@@ -25,7 +29,7 @@ void MovableRect::updateLocation(int x, int y) {
ResizableRect::ResizableRect(QObject *parent, bool *enabled, int width, int height, QRgb color)
: QObject(parent),
- MovableRect(enabled, width * 16, height * 16, color)
+ MovableRect(enabled, QRect(0, 0, width * 16, height * 16), color)
{
setZValue(0xFFFFFFFF); // ensure on top of view
setAcceptHoverEvents(true);
diff --git a/src/ui/projectsettingseditor.cpp b/src/ui/projectsettingseditor.cpp
index 8b47913a..5bcf6399 100644
--- a/src/ui/projectsettingseditor.cpp
+++ b/src/ui/projectsettingseditor.cpp
@@ -138,8 +138,10 @@ void ProjectSettingsEditor::initUi() {
ui->spinBox_MaxEvents->setMaximum(INT_MAX);
ui->spinBox_MapWidth->setMaximum(INT_MAX);
ui->spinBox_MapHeight->setMaximum(INT_MAX);
- ui->spinBox_PlayerViewWidth->setMaximum(INT_MAX);
- ui->spinBox_PlayerViewHeight->setMaximum(INT_MAX);
+ ui->spinBox_PlayerViewDistance_West->setMaximum(INT_MAX);
+ ui->spinBox_PlayerViewDistance_North->setMaximum(INT_MAX);
+ ui->spinBox_PlayerViewDistance_East->setMaximum(INT_MAX);
+ ui->spinBox_PlayerViewDistance_South->setMaximum(INT_MAX);
// The values for some of the settings we provide in this window can be determined using constants in the user's projects.
// If the user has these constants we disable these settings in the UI -- they can modify them using their constants.
@@ -475,8 +477,10 @@ void ProjectSettingsEditor::refresh() {
ui->spinBox_UnusedTileCovered->setValue(projectConfig.unusedTileCovered);
ui->spinBox_UnusedTileSplit->setValue(projectConfig.unusedTileSplit);
ui->spinBox_MaxEvents->setValue(projectConfig.maxEventsPerGroup);
- ui->spinBox_PlayerViewWidth->setValue(projectConfig.playerViewSize.width());
- ui->spinBox_PlayerViewHeight->setValue(projectConfig.playerViewSize.height());
+ ui->spinBox_PlayerViewDistance_West->setValue(projectConfig.playerViewDistance.left());
+ ui->spinBox_PlayerViewDistance_North->setValue(projectConfig.playerViewDistance.top());
+ ui->spinBox_PlayerViewDistance_East->setValue(projectConfig.playerViewDistance.right());
+ ui->spinBox_PlayerViewDistance_South->setValue(projectConfig.playerViewDistance.bottom());
// Set (and sync) border metatile IDs
this->setBorderMetatileIds(false, projectConfig.newMapBorderMetatileIds);
@@ -553,7 +557,10 @@ void ProjectSettingsEditor::save() {
projectConfig.unusedTileCovered = ui->spinBox_UnusedTileCovered->value();
projectConfig.unusedTileSplit = ui->spinBox_UnusedTileSplit->value();
projectConfig.maxEventsPerGroup = ui->spinBox_MaxEvents->value();
- projectConfig.playerViewSize = QSize(ui->spinBox_PlayerViewWidth->value(), ui->spinBox_PlayerViewHeight->value());
+ projectConfig.playerViewDistance = QMargins(ui->spinBox_PlayerViewDistance_West->value(),
+ ui->spinBox_PlayerViewDistance_North->value(),
+ ui->spinBox_PlayerViewDistance_East->value(),
+ ui->spinBox_PlayerViewDistance_South->value());
// Save line edit settings
projectConfig.prefabFilepath = ui->lineEdit_PrefabsPath->text();