Skip to content

Commit

Permalink
Merge pull request #605 from GriffinRichards/encounter-graph
Browse files Browse the repository at this point in the history
Add encounter charts
  • Loading branch information
GriffinRichards authored Sep 3, 2024
2 parents 9ae3360 + 8240cf5 commit d7e41e7
Show file tree
Hide file tree
Showing 23 changed files with 987 additions and 88 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: jurplel/install-qt-action@v2
with:
version: '5.14.2'
modules: 'qtwidgets qtqml'
modules: 'qtwidgets qtqml qtcharts'
cached: ${{ steps.cache-qt.outputs.cache-hit }}

- name: Configure
Expand All @@ -58,7 +58,8 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v3
with:
version: '6.5.*'
version: '6.7.*'
modules: 'qtcharts'
cached: ${{ steps.cache-qt.outputs.cache-hit }}

- name: Configure
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
### Added
- Redesigned the Connections tab, adding a number of new features including the option to open or display diving maps and a list UI for easier edit access.
- Add a `Close Project` option
- Add charts to the `Wild Pokémon` tab that show species and level distributions.
- An alert will be displayed when attempting to open a seemingly invalid project.

### Changed
- Edits to map connections now have Undo/Redo and can be viewed in exported timelapses.
- Changes to the "Mirror to Connecting Maps" setting will now be saved between sessions.
- A notice will be displayed when attempting to open the "Dynamic" map, rather than nothing happening.
- The base game version is now auto-detected if the project name contains only one of "emerald", "firered/leafgreen", or "ruby/sapphire".
- The max encounter rate is now read from the project, rather than assuming the default value from RSE.
- It's now possible to cancel quitting if there are unsaved changes in sub-windows.

### Fixed
Expand All @@ -30,6 +32,8 @@ The **"Breaking Changes"** listed below are changes that have been made in the d
- Fix `About porymap` opening a new window each time it's activated.
- Fix the `Edit History` window not raising to the front when reactivated.
- New maps are now always inserted in map dropdowns at the correct position, rather than at the bottom of the list until the project is reloaded.
- Fix invalid species names clearing from wild pokémon data when revisited.
- Fix editing wild pokémon data not marking the map as edited.
- Fix changes to map connections not marking connected maps as unsaved.
- Fix numerous issues related to connecting a map to itself.
- Fix incorrect map connections getting selected when opening a map by double-clicking a map connection.
Expand Down
4 changes: 3 additions & 1 deletion docsrc/manual/project-files.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The filepath that Porymap expects for each file can be overridden on the ``Files
include/fieldmap.h, yes, no, ``constants_fieldmap``, reads tileset related constants
src/fieldmap.c, yes, no, ``fieldmap``, reads ``symbol_attribute_table``
src/event_object_movement.c, yes, no, ``initial_facing_table``, reads ``symbol_facing_directions``
src/wild_encounter.c, yes, no, ``wild_encounter``, reads ``define_max_encounter_rate``
src/pokemon_icon.c, yes, no, ``pokemon_icon_table``, reads files in ``symbol_pokemon_icon_table``
graphics/pokemon/\*/icon.png, yes, no, ``pokemon_gfx``, to search for Pokémon icons if they aren't found in ``symbol_pokemon_icon_table``

Expand Down Expand Up @@ -96,6 +97,7 @@ In addition to these files, there are some specific symbol and macro names that
``define_obj_event_count``, ``OBJECT_EVENT_TEMPLATES_COUNT``, to limit total Object Events
``define_min_level``, ``MIN_LEVEL``, minimum wild encounters level
``define_max_level``, ``MAX_LEVEL``, maximum wild encounters level
``define_max_encounter_rate``, ``MAX_ENCOUNTER_RATE``, this value / 16 will be the maximum encounter rate on the ``Wild Pokémon`` tab
``define_tiles_primary``, ``NUM_TILES_IN_PRIMARY``,
``define_tiles_total``, ``NUM_TILES_TOTAL``,
``define_metatiles_primary``, ``NUM_METATILES_IN_PRIMARY``, total metatiles are calculated using metatile ID mask
Expand All @@ -120,6 +122,7 @@ In addition to these files, there are some specific symbol and macro names that
``define_map_section_prefix``, ``MAPSEC_``, expected prefix for location macro names
``define_map_section_empty``, ``NONE``, macro name after prefix for empty region map sections
``define_map_section_count``, ``COUNT``, macro name after prefix for total number of region map sections
``define_species_prefix``, ``SPECIES_``, expected prefix for species macro names
``regex_behaviors``, ``\bMB_``, regex to find metatile behavior macro names
``regex_obj_event_gfx``, ``\bOBJ_EVENT_GFX_``, regex to find Object Event graphics ID macro names
``regex_items``, ``\bITEM_(?!(B_)?USE_)``, regex to find item macro names
Expand All @@ -134,4 +137,3 @@ In addition to these files, there are some specific symbol and macro names that
``regex_sign_facing_directions``, ``\bBG_EVENT_PLAYER_FACING_``, regex to find sign facing direction macro names
``regex_trainer_types``, ``\bTRAINER_TYPE_``, regex to find trainer type macro names
``regex_music``, ``\b(SE|MUS)_``, regex to find music macro names
``regex_species``, ``\bSPECIES_``, regex to find species macro names
7 changes: 7 additions & 0 deletions forms/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton_SummaryChart">
<property name="text">
<string>Summary Chart...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_ConfigureEncountersJSON">
<property name="text">
Expand Down
245 changes: 245 additions & 0 deletions forms/wildmonchart.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>WildMonChart</class>
<widget class="QWidget" name="WildMonChart">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>785</width>
<height>492</height>
</rect>
</property>
<property name="windowTitle">
<string>Wild Pokémon Summary</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame_TopBar">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QLabel" name="label_Theme">
<property name="text">
<string>Theme</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_Theme"/>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="button_Help">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="../resources/images.qrc">
<normaloff>:/icons/help.ico</normaloff>:/icons/help.ico</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tabSpecies">
<attribute name="title">
<string>Species Distribution</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QChartView" name="chartView_SpeciesDistribution">
<property name="renderHints">
<set>QPainter::Antialiasing</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabLevels">
<attribute name="title">
<string>Level Distribution</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_Group">
<property name="text">
<string>Group</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_Group">
<property name="editable">
<bool>false</bool>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
</property>
<property name="minimumContentsLength">
<number>8</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox_Species">
<property name="title">
<string>Individual Mode</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="formLayout">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_Species">
<property name="text">
<string>Species</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="comboBox_Species">
<property name="editable">
<bool>true</bool>
</property>
<property name="insertPolicy">
<enum>QComboBox::NoInsert</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLengthWithIcon</enum>
</property>
<property name="minimumContentsLength">
<number>12</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QChartView" name="chartView_LevelDistribution">
<property name="renderHints">
<set>QPainter::Antialiasing</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QChartView</class>
<extends>QGraphicsView</extends>
<header>QtCharts</header>
</customwidget>
</customwidgets>
<resources>
<include location="../resources/images.qrc"/>
</resources>
<connections/>
</ui>
7 changes: 6 additions & 1 deletion include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class PorymapConfig: public KeyValueConfigBase
this->monitorFiles = true;
this->tilesetCheckerboardFill = true;
this->theme = "default";
this->wildMonChartTheme = "";
this->textEditorOpenFolder = "";
this->textEditorGotoLine = "";
this->paletteEditorBitDepth = 24;
Expand Down Expand Up @@ -127,6 +128,7 @@ class PorymapConfig: public KeyValueConfigBase
bool monitorFiles;
bool tilesetCheckerboardFill;
QString theme;
QString wildMonChartTheme;
QString textEditorOpenFolder;
QString textEditorGotoLine;
int paletteEditorBitDepth;
Expand All @@ -136,6 +138,7 @@ class PorymapConfig: public KeyValueConfigBase
QDateTime lastUpdateCheckTime;
QVersionNumber lastUpdateCheckVersion;
QMap<QUrl, QDateTime> rateLimitTimes;
QByteArray wildMonChartGeometry;

protected:
virtual QString getConfigFilepath() override;
Expand Down Expand Up @@ -191,6 +194,7 @@ enum ProjectIdentifier {
define_obj_event_count,
define_min_level,
define_max_level,
define_max_encounter_rate,
define_tiles_primary,
define_tiles_total,
define_metatiles_primary,
Expand All @@ -215,6 +219,7 @@ enum ProjectIdentifier {
define_map_section_prefix,
define_map_section_empty,
define_map_section_count,
define_species_prefix,
regex_behaviors,
regex_obj_event_gfx,
regex_items,
Expand All @@ -229,7 +234,6 @@ enum ProjectIdentifier {
regex_sign_facing_directions,
regex_trainer_types,
regex_music,
regex_species,
};

enum ProjectFilePath {
Expand Down Expand Up @@ -278,6 +282,7 @@ enum ProjectFilePath {
global_fieldmap,
fieldmap,
initial_facing_table,
wild_encounter,
pokemon_icon_table,
pokemon_gfx,
};
Expand Down
Loading

0 comments on commit d7e41e7

Please sign in to comment.