add read misc project values function

This commit is contained in:
garak 2019-07-02 22:08:58 -04:00
parent 267c71d40e
commit 7129510aea
4 changed files with 16 additions and 6 deletions

View file

@ -13,6 +13,7 @@
#include <QVector>
#include <QPair>
#include <QStandardItem>
#include <QVariant>
static QString NONE_MAP_CONSTANT = "MAP_NONE";
static QString NONE_MAP_NAME = "None";
@ -26,6 +27,7 @@ public:
QMap<QString, int> *map_groups;
QList<QStringList> groupedMapNames;
QStringList *mapNames = nullptr;
QMap<QString, QVariant> miscConstants;
QList<HealLocation> flyableMaps;
QMap<QString, QString>* mapConstantsToMapNames;
QMap<QString, QString>* mapNamesToMapConstants;
@ -141,6 +143,7 @@ public:
void readBgEventFacingDirections();
void readMetatileBehaviors();
void readHealLocations();
void readMiscellaneousConstants();
void loadEventPixmaps(QList<Event*> objects);
QMap<QString, int> getEventObjGfxConstants();

View file

@ -618,6 +618,7 @@ void MainWindow::loadDataStructures() {
project->readMetatileBehaviors();
project->readTilesetProperties();
project->readHealLocations();
project->readMiscellaneousConstants();
project->readSpeciesIconPaths();
project->readWildMonData();
}

View file

@ -1758,6 +1758,12 @@ QMap<QString, int> Project::getEventObjGfxConstants() {
return constants;
}
void Project::readMiscellaneousConstants() {
QMap<QString, int> pokemonDefines = parser.readCDefines("include/pokemon.h", QStringList() << "MIN_" << "MAX_");
miscConstants.insert("max_level_define", pokemonDefines.value("MAX_LEVEL"));
miscConstants.insert("min_level_define", pokemonDefines.value("MIN_LEVEL"));
}
QString Project::fixPalettePath(QString path) {
path = path.replace(QRegExp("\\.gbapal$"), ".pal");
return path;

View file

@ -68,7 +68,7 @@ void MonTabWidget::populateTab(int tabIndex, WildMonInfo monInfo, QString fieldN
speciesTable->setColumnCount(6);
QStringList landMonTableHeaders;
landMonTableHeaders << "Index" << "Species" << "Min Level" << "Max Level" << "Index Percentage" << "Encounter Rate";
landMonTableHeaders << "Index" << "Species" << "Min Level" << "Max Level" << "Index Ratio" << "Encounter Rate";
speciesTable->setHorizontalHeaderLabels(landMonTableHeaders);
speciesTable->horizontalHeader()->show();
speciesTable->verticalHeader()->hide();
@ -126,10 +126,10 @@ void MonTabWidget::createSpeciesTableRow(QTableWidget *table, WildPokemon mon, i
QSpinBox *minLevel = new QSpinBox;
QSpinBox *maxLevel = new QSpinBox;
minLevel->setMinimum(1);
minLevel->setMaximum(100);
maxLevel->setMinimum(1);
maxLevel->setMaximum(100);
minLevel->setMinimum(project->miscConstants.value("min_level_define").toInt());
minLevel->setMaximum(project->miscConstants.value("max_level_define").toInt());
maxLevel->setMinimum(project->miscConstants.value("min_level_define").toInt());
maxLevel->setMaximum(project->miscConstants.value("max_level_define").toInt());
minLevel->setValue(mon.minLevel);
maxLevel->setValue(mon.maxLevel);
@ -143,7 +143,7 @@ void MonTabWidget::createSpeciesTableRow(QTableWidget *table, WildPokemon mon, i
if (field.first == fieldName) break;
fieldIndex++;
}
QLabel *percentLabel = new QLabel(QString("%1%").arg(
QLabel *percentLabel = new QLabel(QString("%1").arg(
QString::number(project->wildMonFields[fieldIndex].second[index - 1]
)));