From 690e19e05a693a8a74b99fa73f10544d5ceb1dc0 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Fri, 31 Dec 2021 16:41:28 -0500 Subject: [PATCH] Add header API prototypes --- include/mainwindow.h | 23 +++++++ src/mainwindow_scriptapi.cpp | 126 +++++++++++++++++++++++++++++++++++ 2 files changed, 149 insertions(+) diff --git a/include/mainwindow.h b/include/mainwindow.h index 27403e34..3b0f6529 100644 --- a/include/mainwindow.h +++ b/include/mainwindow.h @@ -181,6 +181,29 @@ public: Q_INVOKABLE void setMainTab(int index); Q_INVOKABLE int getMapViewTab(); Q_INVOKABLE void setMapViewTab(int index); + bool gameStringToBool(QString s); + Q_INVOKABLE QString getSong(); + Q_INVOKABLE void setSong(QString song); + Q_INVOKABLE QString getLocation(); + Q_INVOKABLE void setLocation(QString location); + Q_INVOKABLE bool getRequiresFlash(); + Q_INVOKABLE void setRequiresFlash(bool require); + Q_INVOKABLE QString getWeather(); + Q_INVOKABLE void setWeather(QString weather); + Q_INVOKABLE QString getType(); + Q_INVOKABLE void setType(QString type); + Q_INVOKABLE QString getBattleScene(); + Q_INVOKABLE void setBattleScene(QString battleScene); + Q_INVOKABLE bool getShowLocationName(); + Q_INVOKABLE void setShowLocationName(bool show); + Q_INVOKABLE bool getAllowRunning(); + Q_INVOKABLE void setAllowRunning(bool allow); + Q_INVOKABLE bool getAllowBiking(); + Q_INVOKABLE void setAllowBiking(bool allow); + Q_INVOKABLE bool getAllowEscaping(); + Q_INVOKABLE void setAllowEscaping(bool allow); + Q_INVOKABLE int getFloorNumber(); + Q_INVOKABLE void setFloorNumber(int floorNumber); private slots: diff --git a/src/mainwindow_scriptapi.cpp b/src/mainwindow_scriptapi.cpp index 64db8a89..787899d6 100644 --- a/src/mainwindow_scriptapi.cpp +++ b/src/mainwindow_scriptapi.cpp @@ -1050,3 +1050,129 @@ void MainWindow::setMapViewTab(int index) { return; this->on_mapViewTab_tabBarClicked(index); } + +bool MainWindow::gameStringToBool(QString s) { + return (s.toInt() > 0 || s == "TRUE"); +} + +QString MainWindow::getSong() { + if (!this->editor || !this->editor->map) + return QString(); + return this->editor->map->song; +} + +void MainWindow::setSong(QString song) { + if (!this->editor || !this->editor->map) + return; +} + +QString MainWindow::getLocation() { + if (!this->editor || !this->editor->map) + return QString(); + return this->editor->map->location; +} + +void MainWindow::setLocation(QString location) { + if (!this->editor || !this->editor->map) + return; +} + +bool MainWindow::getRequiresFlash() { + if (!this->editor || !this->editor->map) + return false; + return this->gameStringToBool(this->editor->map->requiresFlash); +} + +void MainWindow::setRequiresFlash(bool require) { + if (!this->editor || !this->editor->map) + return; +} + +QString MainWindow::getWeather() { + if (!this->editor || !this->editor->map) + return QString(); + return this->editor->map->weather; +} + +void MainWindow::setWeather(QString weather) { + if (!this->editor || !this->editor->map) + return; +} + +QString MainWindow::getType() { + if (!this->editor || !this->editor->map) + return QString(); + return this->editor->map->type; +} + +void MainWindow::setType(QString type) { + if (!this->editor || !this->editor->map) + return; +} + +QString MainWindow::getBattleScene() { + if (!this->editor || !this->editor->map) + return QString(); + return this->editor->map->battle_scene; +} + +void MainWindow::setBattleScene(QString battleScene) { + if (!this->editor || !this->editor->map) + return; +} + +bool MainWindow::getShowLocationName() { + if (!this->editor || !this->editor->map) + return false; + return this->gameStringToBool(this->editor->map->show_location); +} + +void MainWindow::setShowLocationName(bool show) { + if (!this->editor || !this->editor->map) + return; +} + +bool MainWindow::getAllowRunning() { + if (!this->editor || !this->editor->map) + return false; + return this->gameStringToBool(this->editor->map->allowRunning); +} + +void MainWindow::setAllowRunning(bool allow) { + if (!this->editor || !this->editor->map) + return; +} + +bool MainWindow::getAllowBiking() { + if (!this->editor || !this->editor->map) + return false; + return this->gameStringToBool(this->editor->map->allowBiking); +} + +void MainWindow::setAllowBiking(bool allow) { + if (!this->editor || !this->editor->map) + return; +} + +bool MainWindow::getAllowEscaping() { + if (!this->editor || !this->editor->map) + return false; + return this->gameStringToBool(this->editor->map->allowEscapeRope); +} + +void MainWindow::setAllowEscaping(bool allow) { + if (!this->editor || !this->editor->map) + return; +} + +int MainWindow::getFloorNumber() { + if (!this->editor || !this->editor->map) + return 0; + return this->editor->map->floorNumber; +} + +void MainWindow::setFloorNumber(int floorNumber) { + if (!this->editor || !this->editor->map) + return; +} +