Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote use of internal progress bars #2411

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
24.04+ (???)
------------------------------------------------------------------------
- Fix: [#2411] Progress bar windows are not actually rendered.
- Fix: [#2413] Gridlines are hidden when closing construction windows.
- Fix: [#2416] Cursors in embedded text fiels are not rendering in the right position.
- Change: [#2411] Internal progress bars can now be used during the object and scenario indexing processes.
- Change: [#2416] Most text input fields are no longer focused by default, allowing shortcuts to be used.

24.04 (2024-04-07)
Expand Down
4 changes: 2 additions & 2 deletions data/language/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Zu viele Objekte im Spiel
172: Im Uhrzeigersinn drehen
173: Gegen den Uhrzeigersinn drehen
174: "Locomotion: Wird zum ersten Mal gestartet..."
175: "Locomotion: Objektdateien werden geprüft..."
174: "Wird zum ersten Mal gestartet..."
175: "Objektdateien werden geprüft..."
176: Spiel laden
177: Spiel beenden
178: Spiel beenden
Expand Down
5 changes: 3 additions & 2 deletions data/language/en-GB.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Too many objects in game
172: Rotate Clockwise
173: Rotate Anti-Clockwise
174: "OpenLoco: Starting for the first time..."
175: "OpenLoco: Checking object files..."
174: "Starting for the first time..."
175: "Checking object files..."
176: Load Game
177: Quit Game
178: Quit Game
Expand Down Expand Up @@ -2397,3 +2397,4 @@ strings:
2342: "Browse..."
2343: "{COLOUR WINDOW_2}Current heightmap file: {COLOUR BLACK}{STRING}"
2344: "(none selected)"
2345: "Checking scenario files..."
4 changes: 2 additions & 2 deletions data/language/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ strings:
171: Too many objects in game
172: Rotate Clockwise
173: Rotate Anti-Clockwise
174: "OpenLoco: Starting for the first time..."
175: "OpenLoco: Checking object files..."
174: "Starting for the first time..."
175: "Checking object files..."
176: Load Game
177: Quit Game
178: Quit Game
Expand Down
4 changes: 2 additions & 2 deletions data/language/es-ES.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Hay demasiados objetos en el juego
172: Rotar en el sentido de las agujas del reloj
173: Rotar en el sentido contrario al de las agujas del reloj
174: "Locomotion: Iniciando por primera vez..."
175: "Locomotion: Comprobando los archivos de objetos..."
174: "Iniciando por primera vez..."
175: "Comprobando los archivos de objetos..."
176: Cargar partida
177: Salir de la partida
178: Salir de la partida
Expand Down
4 changes: 2 additions & 2 deletions data/language/fr-FR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Trop d'objets dans le jeu
172: Rotation horaire
173: Rotation antihoraire
174: "Locomotion : premier démarrage..."
175: "Locomotion : vérification des fichiers objets..."
174: "Premier démarrage..."
175: "Vérification des fichiers objets..."
176: Charger partie
177: Quitter partie
178: Quitter partie
Expand Down
4 changes: 2 additions & 2 deletions data/language/it-IT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Troppi oggetti presenti nel gioco
172: Ruota in senso orario
173: Ruota in senso antiorario
174: "Locomotion: primo avvio..."
175: "Locomotion: verifica file degli oggetti..."
174: "Primo avvio..."
175: "Verifica file degli oggetti..."
176: Carica partita
177: Esci dal gioco
178: Esci dal gioco
Expand Down
4 changes: 2 additions & 2 deletions data/language/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Too many objects in game
172: Rotate Clockwise
173: Rotate Anti-Clockwise
174: "Locomotion: Starting for the first time..."
175: "Locomotion: Checking object files..."
174: "Starting for the first time..."
175: "Checking object files..."
176: ゲームをロードする
177: ゲームを閉じる
178: ゲームを閉じる
Expand Down
4 changes: 2 additions & 2 deletions data/language/ko-KR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: 게임에 오브젝트가 너무 많습니다
172: 시계 방향으로 회전
173: 반시계 방향으로 회전
174: "로코모션: 처음으로 실행 중입니다..."
175: "로코모션: 오브젝트 파일 체크 중..."
174: "처음으로 실행 중입니다..."
175: "오브젝트 파일 체크 중..."
176: 게임 불러오기
177: 게임 종료
178: 게임 종료
Expand Down
5 changes: 3 additions & 2 deletions data/language/nl-NL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Teveel objecten in het spel
172: Met de klok mee draaien
173: Tegen de klok in draaien
174: 'OpenLoco: Eerste keer starten...'
175: 'OpenLoco: Bezig met checken van objecten...'
174: 'Eerste keer starten...'
175: 'Bezig met checken van objecten...'
176: Spel laden
177: Spel beëindigen
178: Spel beëindigen
Expand Down Expand Up @@ -2397,3 +2397,4 @@ strings:
2342: "Bladeren..."
2343: "{COLOUR WINDOW_2}Huidig hoogtekaart-bestand: {COLOUR BLACK}{STRING}"
2344: "(geen selectie)"
2345: "Bezig met checken van scenario's..."
4 changes: 2 additions & 2 deletions data/language/pl-PL.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ strings:
171: Zbyt wiele obiektów w grze
172: Obróć Widok w Lewo
173: Obróć Widok w Prawo
174: 'OpenLoco: Pierwsze uruchomienie...'
175: 'OpenLoco: Sprawdzanie plików obiektów...'
174: 'Pierwsze uruchomienie...'
175: 'Sprawdzanie plików obiektów...'
176: Wczytaj Grę
177: Zakończ Grę
178: Zakończ Grę
Expand Down
4 changes: 2 additions & 2 deletions data/language/pt-BR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: Muitos objetos em jogo
172: Rotacionar no sentido horário
173: Rotacionar no sentido anti-horário
174: "OpenLoco: Iniciando pela primeira vez..."
175: "OpenLoco: Verificando arquivos de objeto..."
174: "Iniciando pela primeira vez..."
175: "Verificando arquivos de objeto..."
176: Carregar Jogo
177: Sair do Jogo
178: Sair do Jogo
Expand Down
4 changes: 2 additions & 2 deletions data/language/ru-RU.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ strings:
171: "В игре слишком много объектов "
172: "Повернуть по часовой стрелке"
173: "Повернуть против часовой стрелки"
174: "Locomotion: первый запуск..."
175: "Locomotion: проверка файлов объектов..."
174: "Первый запуск..."
175: "Проверка файлов объектов..."
176: "Загрузка игры"
177: "Выход"
178: "Выход"
Expand Down
4 changes: 2 additions & 2 deletions data/language/sk-SK.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ strings:
171: Príliš veľa objektov v hre
172: Otočiť vľavo (CHECK!)
173: Otočiť vpravo (CHECK!)
174: "OpenLoco: Prvé spustenie..."
175: "OpenLoco: Kontrola súborov objektov..."
174: "Prvé spustenie..."
175: "Kontrola súborov objektov..."
176: Načítať hru
177: Ukončiť hru
178: Ukončiť hru
Expand Down
4 changes: 2 additions & 2 deletions data/language/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ strings:
171: 游戏内对象过多
172: 顺时针旋转
173: 逆时针旋转
174: "OpenLoco: 初次启动..."
175: "OpenLoco: 检查对象文件..."
174: "初次启动..."
175: "检查对象文件..."
176: 载入游戏
177: 退出游戏
178: 退出游戏
Expand Down
4 changes: 3 additions & 1 deletion src/OpenLoco/src/Graphics/Gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ namespace OpenLoco::Gfx

if (Ui::dirtyBlocksInitialised())
{
getDrawingEngine().render();
auto& drawingEngine = Gfx::getDrawingEngine();
drawingEngine.render();
drawingEngine.present();
}

if (Input::hasFlag(Input::Flags::rightMousePressed))
Expand Down
4 changes: 2 additions & 2 deletions src/OpenLoco/src/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ namespace OpenLoco::Gui
Windows::Terraform::setAdjustWaterToolSize(1);
Windows::Terraform::setClearAreaToolSize(2);

if (OpenLoco::isTitleMode())
if (isTitleMode())
{
Ui::Windows::TitleMenu::open();
Ui::Windows::TitleExit::open();
Ui::Windows::TitleLogo::open();
Ui::Windows::TitleVersion::open();
Ui::Windows::TitleOptions::open();
}
else
else if (isInitialised())
{
Windows::ToolbarTop::Game::open();

Expand Down
1 change: 1 addition & 0 deletions src/OpenLoco/src/Localisation/StringIds.h
Original file line number Diff line number Diff line change
Expand Up @@ -1975,6 +1975,7 @@ namespace OpenLoco::StringIds
constexpr StringId button_browse = 2342;
constexpr StringId currentHeightmapFile = 2343;
constexpr StringId noneSelected = 2344;
constexpr StringId checkingScenarioFiles = 2345;

constexpr StringId temporary_object_load_str_0 = 8192;
constexpr StringId temporary_object_load_str_1 = 8193;
Expand Down
12 changes: 6 additions & 6 deletions src/OpenLoco/src/Map/MapGenerator/MapGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,23 +834,23 @@ namespace OpenLoco::World::MapGenerator
HeightMap heightMap(512, 512, 512);

generateHeightMap(options, heightMap);
updateProgress(17);
updateProgress(25);

generateLand(heightMap);
updateProgress(17);
updateProgress(35);

generateWater(heightMap);
updateProgress(25);
updateProgress(45);

generateTerrain(heightMap);
updateProgress(35);
updateProgress(55);
}

generateSurfaceVariation();
updateProgress(40);
updateProgress(65);

generateTrees();
updateProgress(45);
updateProgress(75);

generateTowns();
updateProgress(225);
Expand Down
12 changes: 12 additions & 0 deletions src/OpenLoco/src/Map/MapGenerator/SimplexTerrainGenerator.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "SimplexTerrainGenerator.h"
#include "S5/S5.h"
#include "Ui/ProgressBar.h"
#include <algorithm>

using namespace OpenLoco::S5;
Expand Down Expand Up @@ -60,6 +61,8 @@ namespace OpenLoco::World::MapGenerator
void SimplexTerrainGenerator::generate(const SimplexSettings& settings, HeightMapRange heightMap)
{
generateSimplex(settings, heightMap);
Ui::ProgressBar::setProgress(15);

smooth(settings.smooth, heightMap);
}

Expand All @@ -82,6 +85,12 @@ namespace OpenLoco::World::MapGenerator

void SimplexTerrainGenerator::smooth(int32_t iterations, HeightMapRange heightMap)
{
if (iterations == 0)
return;

const auto progressSteps = (25 - 15) / iterations;
auto currentProgress = 15;

for (int32_t i = 0; i < iterations; i++)
{
auto copyHeight = heightMap;
Expand All @@ -100,6 +109,9 @@ namespace OpenLoco::World::MapGenerator
heightMap[{ x, y }] = total / 9;
}
}

currentProgress += progressSteps;
Ui::ProgressBar::setProgress(currentProgress);
}
}

Expand Down
32 changes: 16 additions & 16 deletions src/OpenLoco/src/OpenLoco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,33 +281,35 @@ namespace OpenLoco
std::srand(std::time(nullptr));
addr<0x0050C18C, int32_t>() = addr<0x00525348, int32_t>();
call(0x004078BE); // getSystemTime unused dead code?

World::TileManager::allocateMapElements();
Environment::resolvePaths();
Localisation::enumerateLanguages();
Localisation::loadLanguageFile();
Ui::ProgressBar::begin(StringIds::loading);
Ui::ProgressBar::setProgress(30);
startupChecks();
Ui::ProgressBar::setProgress(40);
Ui::ProgressBar::end();
ObjectManager::loadIndex();
ScenarioManager::loadIndex();
Ui::ProgressBar::begin(StringIds::loading);
Ui::ProgressBar::setProgress(60);

Gfx::loadG1();
Ui::ProgressBar::setProgress(220);
Gfx::initialiseCharacterWidths();
Gfx::initialiseNoiseMaskMap();
Ui::ProgressBar::setProgress(235);
Ui::ProgressBar::setProgress(250);
Ui::initialiseCursors();
Ui::ProgressBar::end();

Ui::initialise();
Ui::initialiseCursors();
initialiseViewports();
Gui::init();

Title::sub_4284C8();
call(0x004969DA); // getLocalTime not used (dead code?)
Scenario::reset();

Gfx::loadDefaultPalette();
auto& drawingCtx = Gfx::getDrawingEngine().getDrawingContext();
drawingCtx.clearSingle(Gfx::getScreenRT(), PaletteIndex::index_0A);

setScreenFlag(ScreenFlags::initialised);

ObjectManager::loadIndex();
ScenarioManager::loadIndex();

const auto& cmdLineOptions = getCommandLineOptions();
if (cmdLineOptions.action == CommandLineAction::intro)
{
Expand All @@ -317,10 +319,8 @@ namespace OpenLoco
{
Intro::state(Intro::State::end);
}

Title::start();
Gui::init();
auto& drawingCtx = Gfx::getDrawingEngine().getDrawingContext();
drawingCtx.clear(Gfx::getScreenRT(), 0x0A0A0A0A);
}

static void loadFile(const fs::path& path)
Expand Down