Merge branch 'develop'

This commit is contained in:
Michał Janiszewski committed 2026-01-04 16:49:19 +01:00
commit cb176c762b
624 files changed
+16768 -15741

No files matched your search

+2
View File
@@ -29,6 +29,8 @@ data/tracks.dat
data/sequence
data/object
data/assetpack
test/tests/testdata/replays
test/tests/testdata/sprites/result.dat
#################
## Eclipse
+2 -2
View File
@@ -82,9 +82,9 @@ set(OPENMSX_VERSION "1.6.1")
set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip")
set(OPENMSX_SHA256 "994b350d3b180ee1cb9619fe27f7ebae3a1a5232840c4bd47a89f33fa89de1a1")
set(REPLAYS_VERSION "0.0.90")
set(REPLAYS_VERSION "0.0.91")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
set(REPLAYS_SHA256 "f8474a927e155056e5729b6fa9f05af2a85ae7e1435f5fa89ba496242f9f255e")
set(REPLAYS_SHA256 "5b99edc3d8445fcd2cb22c204708247f575d0bdd3128561322e3abf01e977c79")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")
+1 -1
View File
@@ -7,7 +7,6 @@ Includes all git commit authors. Aliases are GitHub usernames or community nickn
* Michał Janiszewski (janisozaur) - Programming
* Hielke Morsink (Broxzier) - Programming
* Tulio Paschoalin Leao (tupaschoal) - Programming
* Matthias Moninger (ZehMatt) - Programming
* Karst van Galen Last (AuraSpecs) - Lead OpenSoundEffects & OpenMusic
* Michael Bernardi (mrmbernardi) - Programming
* Michael Steenbeek (Gymnasiast) - Lead Localisation - Programming
@@ -25,6 +24,7 @@ Includes all git commit authors. Aliases are GitHub usernames or community nickn
* Richard Jenkins (rwjuk)
* Rik Smeets (rik-smeets)
* Olivier Wervers (Oli414)
* Matthias Moninger (ZehMatt)
## Long term contributors
Appreciation for long term contributors to the project having provided substantial work.
+5
View File
@@ -3839,3 +3839,8 @@ STR_7004 :Força que es torni a dibuixar
STR_7005 :Dibuixa una àrea de camí
STR_7006 :Dibuixa una vora al voltant de les imatges dels botons
STR_7007 :Tipus d’atracció
STR_7008 :Tipus d’atracció desconegut ({INT32})
STR_7009 :Es reben scripts nous…
STR_7010 :No s’ha pogut iniciar la repetició. El fitxer «{STRING}» no existeix o no és vàlid.
STR_7011 :No s’ha pogut iniciar la repetició.
STR_7012 :Złoty polonès (PLN)
+1
View File
@@ -3831,3 +3831,4 @@ STR_7004 :Erzwinge Neuzeichnung
STR_7005 :Baue eine Fläche aus Fußwegen
STR_7006 :Zeichne Ränder um Bildknöpfe
STR_7007 :Achterbahntyp
STR_7008 :Unbekannter Fahrgeschäftstyp ({INT32})
+8
View File
@@ -3838,3 +3838,11 @@ STR_7005 :Drag an area of footpath
STR_7006 :Draw border around image buttons
STR_7007 :Ride Type
STR_7008 :Unknown ride type ({INT32})
STR_7009 :Receiving scripts…
STR_7010 :Could not start replay, file ‘{STRING}’ doesn’t exist or isn’t valid
STR_7011 :Could not start replay
STR_7012 :Polish Złoty (PLN)
STR_7013 :Drag areas of path
STR_7014 :I own the game on Steam, but I haven’t installed it yet.
STR_7015 :Please close Steam if it’s running, then click ‘OK’.
STR_7016 :OpenRCT2 has tried to trigger a download in Steam. Please open Steam and let it download the game. When Steam is finished, click ‘OK’.
+5
View File
@@ -3834,3 +3834,8 @@ STR_7004 :Devigi redesegnon
STR_7005 :Treni areon de trotuaro
STR_7006 :Desegni borderon ĉirkaŭ bildo-butonoj
STR_7007 :Atrakciotipo
STR_7008 :Nekonata atrakciotipo ({INT32})
STR_7009 :Ricevas skriptojn…
STR_7010 :Ne povas komenci reludigon, la dosiero ‘{STRING}’ ne ekzistas aŭ ne validas
STR_7011 :Ne povas komenci reludigon
STR_7012 :Pola zloto (PLN)
+6
View File
@@ -3839,3 +3839,9 @@ STR_7003 :Le fichier audio « {STRING} » est tronqué. L’échantillon {I
STR_7004 :Forcer le rendu
STR_7005 :Remplir de chemin une zone
STR_7006 :Dessiner une bordure autour des boutons-images
STR_7007 :Type d’attraction
STR_7008 :Type d’attraction inconnu ({INT32})
STR_7012 :Złoty polonais (PLN)
STR_7009 :Réception des scripts…
STR_7010 :Impossible de jouer l’enregistrement, le fichier {SMALLFONT}{STRING}{MEDIUMFONT} n’existe pas ou est invalide
STR_7011 :Impossible de jouer l’enregistrement
+1
View File
@@ -3834,3 +3834,4 @@ STR_7004 :Forzar redeseño
STR_7005 :Arrastra unha área de camiño
STR_7006 :Debuxa un bordo arredor dos botóns de imaxe
STR_7007 :Tipo de atracción
STR_7008 :Tipo de atracción descoñecida ({INT32})
+4
View File
@@ -3835,3 +3835,7 @@ STR_7005 :Útterület építése húzással
STR_7006 :Keret rajzolása a képgombok köré
STR_7007 :Játéktípus
STR_7008 :Ismeretlen játéktípus ({INT32})
STR_7009 :Szkriptek fogadása…
STR_7010 :Nem sikerült elindítani a visszajátszást, „{STRING}” fájl nem létezik vagy érvénytelen
STR_7011 :Nem sikerült elindítani a visszajátszást
STR_7012 :Lengyel złoty (PLN)
+4
View File
@@ -3838,3 +3838,7 @@ STR_7005 :드래그로 보도 건설
STR_7006 :버튼 주위에 경계선 표시
STR_7007 :놀이기구 종류
STR_7008 :알 수 없는 놀이기구 종류 ({INT32})
STR_7009 :스크립트 받는 중…
STR_7010 :리플레이를 시작할 수 없습니다, ‘{STRING}’ 파일이 존재하지 않거나 유효하지 않습니다
STR_7011 :리플레이를 시작할 수 없습니다
STR_7012 :폴란드 즐로티 (PLN)
+5 -1
View File
@@ -3426,7 +3426,7 @@ STR_6396 :Schermbeveiliging en -energiebesparing uitschakelen
STR_6397 :Als dit is ingeschakeld, zal (zolang OpenRCT2 loopt) de schermbeveiliging niet worden ingeschakeld en gaat het scherm ook niet na verloop van tijd op zwart.
STR_6398 :Bestand bevat niet-ondersteunde attractietypes. Update naar een nieuwere versie van OpenRCT2 om dit bestand te openen.
STR_6399 :OpenRCT2 heeft bestanden van een RollerCoaster Tycoon 2-installatie nodig. Voer het pad naar de map waar de bestanden van RollerCoaster Tycoon 2 zich bevinden in bij de variabele “game_path” in config.ini. Start daarna OpenRCT2 opnieuw op.
STR_6400 :Ik heb offline GOG-installer voor RollerCoaster Tycoon 2 gedownload, maar nog niet geïnstalleerd
STR_6400 :Ik heb de offline GOG-installer voor RollerCoaster Tycoon 2 gedownload, maar nog niet geïnstalleerd
STR_6401 :Ik heb RollerCoaster Tycoon 2 al geïnstalleerd
STR_6402 :OpenRCT2-data instellen
STR_6403 :Selecteer de optie die op je situatie van toepassing is:
@@ -3834,3 +3834,7 @@ STR_7005 :Voetpaden aanleggen door te slepen
STR_7006 :Rand tekenen om knoppen met alleen een plaatje
STR_7007 :Attractietype
STR_7008 :Onbekend attractietype ({INT32})
STR_7009 :Scripts ophalen…
STR_7010 :Kon de replay niet starten, bestand ‘{STRING}’ bestaat niet of is ongeldig.
STR_7011 :Kon de replay niet starten.
STR_7012 :Poolse Złoty (PLN)
+72 -2
View File
@@ -1062,7 +1062,7 @@ STR_1676 :Ustaw limit prędkości hamowania
STR_1677 :{WINDOW_COLOUR_2}Popularność: {BLACK}Nieznana
STR_1678 :{WINDOW_COLOUR_2}Popularność: {BLACK}{COMMA16}%
STR_1679 :Spirala w górę (lewo)
STR_1680 :Spirala w dół (prawo)
STR_1680 :Spirala w górę (prawo)
STR_1681 :Spirala w dół (lewo)
STR_1682 :Spirala w dół (prawo)
STR_1683 :Wymiary bazowe 2 × 2
@@ -3081,7 +3081,7 @@ STR_5998 :Dodaj pieniądze
STR_5999 :Ustaw pieniądze
STR_6000 :Wprowadź nową wartość:
STR_6001 :Włącz efekty świetlne (eksperymentalne)
STR_6002 :Lampy i atrakcje będą świeciły w nocy.{NEWLINE}Wymaga włączenia silnika sprzętowego.
STR_6002 :Lampy i atrakcje będą świeciły w nocy.{NEWLINE}Wymaga włączenia renderowania sprzętowego.
STR_6003 :Widok przekroju
STR_6004 :Widok przekroju
STR_6005 :Włącz widok przekroju
@@ -3769,3 +3769,73 @@ STR_6739 :{WINDOW_COLOUR_2}Data: {BLACK}{STRINGID}
STR_6740 :{WINDOW_COLOUR_2}Gotówka: {BLACK}{CURRENCY2DP}
STR_6741 :{WINDOW_COLOUR_2}Liczba atrakcji: {BLACK}{UINT16}
STR_6742 :{WINDOW_COLOUR_2}Liczba gości: {BLACK}{UINT16}
STR_6743 :Klimat
STR_6744 :{WINDOW_COLOUR_2}{UINT16}%
STR_6745 :{WINDOW_COLOUR_2}Preferencje intensywności gości:
STR_6746 :Brak preferencji
STR_6747 :Różne preferencje (domyślne)
STR_6748 :Tylko mniej intensywne przejażdżki
STR_6749 :Tylko bardziej intensywne przejażdżki
STR_6750 :Wybierz preferencje nowych gości dot. intensywności przejażdżek.
STR_6751 :Zakolejkowane ścieżki nie mogą być na przejeździe kolejowym!
STR_6752 :Opcje scenariusza - Cele
STR_6753 :Opcje scenariusza - Szczegóły scenariusza
STR_6754 :Opcje scenariusza - Ograniczenia terenu
STR_6755 :Pokaż opcje celów
STR_6756 :Pokaż opcje szczegółów scenariusza
STR_6757 :Pokaż opcje ograniczenia terenu
STR_6758 :Opcje pożyczki
STR_6759 :Model biznesowy
STR_6760 :Zarobki:
STR_6761 :Szczegóły scenariusza
STR_6762 :Interfejs
STR_6763 :RollerCoaster Tycoon 1
STR_6764 :Zapisywanie i auto. zapisy
STR_6765 :Zaawansowane
STR_6766 :Wyczyść
STR_6767 :Okno
STR_6768 :Renderowanie
STR_6769 :Zachowanie
STR_6770 :Limit klatek/sek.:
STR_6771 :Prędkość wewnętrzna (domyślne)
STR_6772 :Synchronizacja pionowa
STR_6773 :Nielimitowane
STR_6774 :Czas od ostatniej inspekcji
STR_6775 :{COMMA16} minuta
STR_6776 :{COMMA16} minuty
STR_6777 :więcej niż 4 godziny
STR_6778 :Podgląd scenariuszy poprzez:
STR_6779 :Wybierz rodzaj obrazka podglądowego, który będzie używany na ekranie wyboru scenariusza.
STR_6780 :Miniatury map
STR_6781 :Zrzuty ekranu
STR_6782 :Powiadomienia parku
STR_6783 :Powiadomienia przejażdżki
STR_6784 :Powiadomienia gości
STR_6785 :Kontroler
STR_6786 :Martwa strefa:
STR_6787 :Martwa strefa gałki analogowej (minimalny wymagany ruch gałką)
STR_6788 :Czułość:
STR_6789 :Mnożnik czułości gałki analogowej
STR_6790 :Martwa strefa: {COMMA32}%
STR_6791 :Czułość: {COMMA32}%
STR_6792 :Budynki wejściowe
STR_6793 :Goście i pracownicy
STR_6794 :Scenerie i style
STR_6795 :{MOVE_X}{10}{STRINGID}
STR_6796 :•{MOVE_X}{10}{STRINGID}
STR_6797 :Brak podglądu
STR_6798 :Zrzut ekranu
STR_6799 :Miniatura mapy
STR_7000 :lub
STR_7001 :Nazwa przejażdżki
STR_7002 :{STRINGID} {STRINGID}
STR_7003 :Plik audio ‘{STRING}’ jest wybrakowany. Oczekiwano próbki {INT32}, ale jedynie {INT32} jest dostępna. Rozważ przeinstalowanie RCT2.
STR_7004 :Wymuś przerysowanie
STR_7005 :Przeciągnij obszar chodnika
STR_7006 :Rysuj ramkę wokół przycisków
STR_7007 :Rodzaj przejażdżki
STR_7008 :Nieznany rodzaj przejażdżki ({INT32})
STR_7009 :Otrzymywanie skryptów…
STR_7010 :Nie udało się uruchomić powtórki, plik ‘{STRING}’ nie istnieje lub jest nieprawidłowy
STR_7011 :Nie udało się uruchomić powtórki
STR_7012 :Polski Złoty (zł)
+4
View File
@@ -3835,3 +3835,7 @@ STR_7005 :Arrastar uma área de calçada
STR_7006 :Desenhar borda ao redor dos botões com imagens
STR_7007 :Tipo de Atração
STR_7008 :Tipo de atração desconhecido ({INT32})
STR_7009 :Recebendo scripts…
STR_7010 :Não foi possível iniciar o replay, o arquivo ‘{STRING}’ não existe ou é inválido
STR_7011 :Não foi possível iniciar o replay
STR_7012 :Złoty polonês (PLN)
+4
View File
@@ -3822,3 +3822,7 @@ STR_7004 :Полная перерисовка
STR_7006 :Бордюр на кнопках с изображениями
STR_7007 :Тип аттр.
STR_7008 :Неизвестный аттракцион ({INT32})
STR_7009 :Скачиваются скрипты…
STR_7010 :Не могу запустить демо - файл «{STRING}» не существует или повреждён
STR_7011 :Не могу запустить демо
STR_7012 :Польские злотые (PLN)
+40
View File
@@ -1,9 +1,48 @@
0.4.30 (in development)
------------------------------------------------------------------------
- Improved: [#24912] Staff now use an appropriate standing animation while waiting at level crossings.
- Improved: [#25515] Path dragging can now be disabled via multiplayer group permissions.
- Improved: [#25529] The map selection grid no longer redraws every frame if it has not changed.
- Improved: [#25530] Wall dragging can now be cancelled without closing the Scenery window.
- Improved: [#25575] Updated the network protocol to a new format that supports larger packets, allowing clients to connect reliably to servers with many objects or large maps.
- Improved: [#25621] Added the Polish Złoty (PLN) to the list of available currencies.
- Improved: [#25625] Renewing and refurbishing rides now also resets the downtime.
- Improved: [#25662] The sprite build command is faster when building sprites from the same image file.
- Change: [#21912] Toilet income is now categorised as shop sales instead of ride tickets.
- Change: [#25403] Guests will not slide down the Spiral Slide if it's broken, even if they have already entered the ride structure.
- Change: [#25485] Make the enlarged pressed swatch sprite more pronounced.
- Change: [#25544] The default game window size is now 1280×720px instead of 640×480px.
- Fix: [#9895] Stand-up coaster gets wrong intensity boost from the synchronisation bonus.
- Fix: [#11617] Path corner connections are broken when hovering track design ghosts with paths over them in zero clearances.
- Fix: [#22484] Lingering ghost entrance after placing park entrance.
- Fix: [#24952] Duplicate track designs when running via Steam without having RCT1 linked.
- Fix: [#25187] On-ride photo platform does not render as ghost when placing track design.
- Fix: [#25229] Excessive logging of game actions, reduced to top-level game actions and filters ghost related ones.
- Fix: [#25469] Drawing in the ui.imageManager.draw callback causes an assertion.
- Fix: [#25524] The track construction arrow does not immediately change position when deleting track pieces.
- Fix: [#25552] Clear Scenery does not show an error message about insufficient money if cash is negative.
- Fix: [#25565] Chairlift station ends are missing tunnels at certain rotations.
- Fix: [#25569] Placing park entrances in multiplayer does not show for other players, causing desyncs.
- Fix: [#25571] Potential crash due to drawing a Crooked House ride.
- Fix: [#25588] When the master server becomes unreachable the server would not register again until a restart.
- Fix: [#25592] Log flume, river rapids, & splash boats can get control failure breakdown instead of brakes failure.
- Fix: [#25595] Invisible entrance is added to imported SV4 saves.
- Fix: [#25601] Inspection interval of a ride gets reset when opening the construction window.
- Fix: [#25628] Availability of AVX2 and SSE4.1 is not detected correctly.
- Fix: [#25639] Scenery window crashes when a no longer present object is still selected.
- Fix: [#25641] Desync because of mismatching inspection intervals.
- Fix: [#25642] The selection marker for purchasing land rights is not drawn with the correct colours.
- Fix: [#25646] It is possible to remove scenery and paths when setting staff patrol areas and purchasing land.
- Fix: [#25660] After saving a track design with scenery, that ride’s entrances and exits are visible in ‘Highlight path issues’ mode.
- Fix: [#25717] Umbrellas given to guests by means of cheats do not use the full (extended) range of colours.
0.4.29 (2025-11-22)
------------------------------------------------------------------------
- Feature: [#25459] Wall line dragging tool.
- Improved: [#25028] Stalls now support colour presets, just like regular rides.
- Improved: [#25426] Building the track designs index is now quicker.
- Improved: [#25490] The ‘New Ride’ window can now be resized.
- Improved: [#25502] Track height markers on flat rides now more sensible.
- Fix: [#6228] The saved queue line path connections are not preserved when placing track designs (original bug).
- Fix: [#14365] Track designs with scenery below the lowest track piece do not preview correctly.
- Fix: [#25451] Dropdown item tooltips stay open if the mouse is moved over an empty space.
@@ -14,6 +53,7 @@
- Fix: [#25480] The mini track design preview and price are misaligned in Enlarged UI mode.
- Fix: [#25488] Crash in headless mode.
- Fix: [#25494] The Go-Karts steep to flat track does not draw correctly in the flat side tunnel.
- Fix: [#25503] Height markers missing from some maze tiles.
- Fix: [#25518] The virtual floor does not draw correctly if expanded on the positive x and y axes.
- Fix: [#25519] Crackling audio when sampling frequencies do not match.
- Fix: [objects#401] Round tunnels on down slopes glitch.
+2 -2
View File
@@ -224,8 +224,8 @@
<OpenSFXSha256>06b90f3e19c216752df441d551b26a9e3e1ba7755bdd2102504b73bf993608be</OpenSFXSha256>
<OpenMSXUrl>https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6.1/openmusic.zip</OpenMSXUrl>
<OpenMSXSha256>994b350d3b180ee1cb9619fe27f7ebae3a1a5232840c4bd47a89f33fa89de1a1</OpenMSXSha256>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.90/replays.zip</ReplaysUrl>
<ReplaysSha256>f8474a927e155056e5729b6fa9f05af2a85ae7e1435f5fa89ba496242f9f255e</ReplaysSha256>
<ReplaysUrl>https://github.com/OpenRCT2/replays/releases/download/v0.0.91/replays.zip</ReplaysUrl>
<ReplaysSha256>5b99edc3d8445fcd2cb22c204708247f575d0bdd3128561322e3abf01e977c79</ReplaysSha256>
</PropertyGroup>
<!-- Unified Dependency Target -->
+1 -2
View File
@@ -19,7 +19,7 @@
### Download
| Latest release | Latest development build |
|----------------------------------------------------------------------------------------------------------------------|--------------------------|
| [![OpenRCT2.io](https://img.shields.io/badge/master-v0.4.29-green.svg)](https://openrct2.io/download/release/latest) | [![OpenRCT2.io](https://img.shields.io/github/last-commit/OpenRCT2/OpenRCT2/develop)](https://openrct2.io/download/develop/latest) |
| [![OpenRCT2.io](https://img.shields.io/github/v/release/OpenRCT2/OpenRCT2.svg?color=green)](https://openrct2.io/download/release/latest) | [![OpenRCT2.io](https://img.shields.io/github/last-commit/OpenRCT2/OpenRCT2/develop?color=green)](https://openrct2.io/download/develop/latest) |
---
@@ -85,7 +85,6 @@ Some Linux distributions offer native packages:
Some \*BSD operating systems offer native packages:
* FreeBSD: [games/openrct2](https://www.freshports.org/games/openrct2)
* OpenBSD: [games/openrct2](https://openports.se/games/openrct2)
---
Binary file not shown.

Before

Width:  |  Height:  |  Size: 269 B

After

Width:  |  Height:  |  Size: 277 B

@@ -272,6 +272,7 @@ target_include_directories(openrct2-ui PRIVATE "${ORCT2_ROOT}/src/thirdparty/duk
target_include_directories(openrct2-ui PRIVATE "${ORCT2_ROOT}/src")
target_include_directories(openrct2-ui SYSTEM PRIVATE "${ORCT2_ROOT}/src/thirdparty")
target_include_directories(openrct2-cli PRIVATE "${ORCT2_ROOT}/src")
target_include_directories(openrct2-cli SYSTEM PRIVATE "${ORCT2_ROOT}/src/thirdparty")
target_include_directories(openrct2 PRIVATE "/opt/openrct2/include/nlohmann/../")
target_include_directories(openrct2-ui PRIVATE "/opt/openrct2/include/nlohmann/../")
+4 -2
View File
@@ -800,10 +800,12 @@ private:
int32_t width = Config::Get().general.windowWidth;
int32_t height = Config::Get().general.windowHeight;
#endif
// Set defaults if size is invalid
if (width <= 0)
width = 640;
width = 1280;
if (height <= 0)
height = 480;
height = 720;
// Create window in window first rather than fullscreen so we have the display the window is on first
uint32_t flags = SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI;
+12 -12
View File
@@ -862,7 +862,7 @@ public:
{
if (w->flags.has(WindowFlag::dead))
continue;
if (!(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose)))
if (!w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose))
{
Close(*w.get());
break;
@@ -884,7 +884,7 @@ public:
}
}
}
else if (!(flags.has(WindowFlag::stickToFront)))
else if (!flags.has(WindowFlag::stickToFront))
{
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++)
{
@@ -903,7 +903,7 @@ public:
wp->flags = flags;
// Play sounds and flash the window
if (!(flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)))
if (!flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront))
{
wp->flash();
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::windowOpen, 0, pos.x + (windowSize.width / 2));
@@ -964,7 +964,7 @@ public:
{
if (w->flags.has(WindowFlag::dead))
continue;
if (!(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose)))
if (!w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront, WindowFlag::noAutoClose))
{
foundW = w.get();
break;
@@ -1007,7 +1007,7 @@ public:
// Now close the collected windows
for (auto* wnd : windowsToClose)
{
if (!(wnd->flags.has(WindowFlag::dead)))
if (!wnd->flags.has(WindowFlag::dead))
{
Close(*wnd);
}
@@ -1053,7 +1053,7 @@ public:
return;
}
auto pred = [](WindowBase* w) -> bool { return !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); };
auto pred = [](WindowBase* w) -> bool { return !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront); };
CloseByCondition(pred, WindowCloseFlags::CloseSingle);
}
@@ -1066,14 +1066,14 @@ public:
{
CloseByClass(WindowClass::dropdown);
CloseByCondition(
[](WindowBase* w) -> bool { return !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)); });
[](WindowBase* w) -> bool { return !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront); });
}
void CloseAllExceptClass(WindowClass cls) override
{
CloseByClass(WindowClass::dropdown);
CloseByCondition([cls](WindowBase* w) -> bool {
return w->classification != cls && !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront));
return w->classification != cls && !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront);
});
}
@@ -1082,7 +1082,7 @@ public:
*/
void CloseAllExceptFlags(WindowFlags flags) override
{
CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags.hasAny(flags)); });
CloseByCondition([flags](WindowBase* w) -> bool { return !w->flags.hasAny(flags); });
}
/**
@@ -1094,7 +1094,7 @@ public:
CloseByCondition([cls, number](WindowBase* w) -> bool {
return (
!(w->number == number && w->classification == cls)
&& !(w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)));
&& !w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront));
});
}
@@ -1327,7 +1327,7 @@ public:
*/
WindowBase* BringToFront(WindowBase& w) override
{
if (!(w.flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront)))
if (!w.flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront))
{
auto itSourcePos = WindowGetIterator(&w);
if (itSourcePos != gWindowList.end())
@@ -1341,7 +1341,7 @@ public:
{
continue;
}
if (!(w2->flags.has(WindowFlag::stickToFront)))
if (!w2->flags.has(WindowFlag::stickToFront))
{
// base() returns the next element in the list, so we need to decrement it.
itDestPos = std::prev(it.base());
@@ -878,7 +878,7 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
if (rt.zoom_level > ZoomLevel{ 0 })
{
if (g1Element->flags & G1_FLAG_HAS_ZOOM_SPRITE)
if (g1Element->flags.has(G1Flag::hasZoomSprite))
{
RenderTarget zoomedRT;
zoomedRT.bits = rt.bits;
@@ -888,10 +888,10 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
zoomedRT.width = rt.width;
zoomedRT.pitch = rt.pitch;
zoomedRT.zoom_level = rt.zoom_level - 1;
DrawSprite(zoomedRT, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomed_offset), x >> 1, y >> 1);
DrawSprite(zoomedRT, imageId.WithIndex(imageId.GetIndex() - g1Element->zoomedOffset), x >> 1, y >> 1);
return;
}
if (g1Element->flags & G1_FLAG_NO_ZOOM_DRAW)
if (g1Element->flags.has(G1Flag::noZoomDraw))
{
return;
}
@@ -899,8 +899,8 @@ void OpenGLDrawingContext::DrawSprite(RenderTarget& rt, const ImageId imageId, c
auto texture = _textureCache->GetOrLoadImageTexture(imageId);
int32_t left = x + g1Element->x_offset;
int32_t top = y + g1Element->y_offset;
int32_t left = x + g1Element->xOffset;
int32_t top = y + g1Element->yOffset;
int32_t xModifier = 0;
int32_t yModifier = 0;
@@ -1015,8 +1015,8 @@ void OpenGLDrawingContext::DrawSpriteRawMasked(
const auto textureMask = _textureCache->GetOrLoadImageTexture(maskImage);
const auto textureColour = _textureCache->GetOrLoadImageTexture(colourImage);
int32_t drawOffsetX = g1ElementMask->x_offset;
int32_t drawOffsetY = g1ElementMask->y_offset;
int32_t drawOffsetX = g1ElementMask->xOffset;
int32_t drawOffsetY = g1ElementMask->yOffset;
int32_t drawWidth = std::min(g1ElementMask->width, g1ElementColour->width);
int32_t drawHeight = std::min(g1ElementMask->height, g1ElementColour->height);
@@ -1075,8 +1075,8 @@ void OpenGLDrawingContext::DrawSpriteSolid(RenderTarget& rt, const ImageId image
const auto texture = _textureCache->GetOrLoadImageTexture(image);
int32_t drawOffsetX = g1Element->x_offset;
int32_t drawOffsetY = g1Element->y_offset;
int32_t drawOffsetX = g1Element->xOffset;
int32_t drawOffsetY = g1Element->yOffset;
int32_t drawWidth = static_cast<uint16_t>(g1Element->width);
int32_t drawHeight = static_cast<uint16_t>(g1Element->height);
@@ -1127,8 +1127,8 @@ void OpenGLDrawingContext::DrawGlyph(RenderTarget& rt, const ImageId image, int3
const auto texture = _textureCache->GetOrLoadGlyphTexture(image, palette);
int32_t left = x + g1Element->x_offset;
int32_t top = y + g1Element->y_offset;
int32_t left = x + g1Element->xOffset;
int32_t top = y + g1Element->yOffset;
int32_t right = left + static_cast<uint16_t>(g1Element->width);
int32_t bottom = top + static_cast<uint16_t>(g1Element->height);
@@ -1229,7 +1229,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
command.texMaskBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
command.palettes = { 0, 0, 0 };
command.flags = DrawRectCommand::FLAG_TTF_TEXT;
command.colour = info->palette[3];
command.colour = info->palette.shadowOutline;
command.bounds = b;
command.depth = _drawCount++;
command.zoom = 1.0f;
@@ -1245,7 +1245,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
command.texMaskBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
command.palettes = { 0, 0, 0 };
command.flags = DrawRectCommand::FLAG_TTF_TEXT;
command.colour = info->palette[3];
command.colour = info->palette.shadowOutline;
command.bounds = { left + 1, top + 1, right + 1, bottom + 1 };
command.depth = _drawCount++;
command.zoom = 1.0f;
@@ -1259,7 +1259,7 @@ void OpenGLDrawingContext::DrawTTFBitmap(
command.texMaskBounds = { 0.0f, 0.0f, 0.0f, 0.0f };
command.palettes = { 0, 0, 0 };
command.flags = DrawRectCommand::FLAG_TTF_TEXT | (hintingThreshold << 8);
command.colour = info->palette[1];
command.colour = info->palette.fill;
command.bounds = { left, top, right, bottom };
command.depth = _drawCount++;
command.zoom = 1.0f;
@@ -180,7 +180,7 @@ GLuint OpenGLFramebuffer::CreateDepthTexture(int32_t width, int32_t height)
return depth;
}
void OpenGLFramebuffer::GetPixels(RenderTarget& rt) const
void OpenGLFramebuffer::GetPixels(Drawing::RenderTarget& rt) const
{
assert(rt.width == _width && rt.height == _height);
@@ -200,7 +200,7 @@ void OpenGLFramebuffer::GetPixels(RenderTarget& rt) const
}
}
void OpenGLFramebuffer::SetPixels(const RenderTarget& rt)
void OpenGLFramebuffer::SetPixels(const Drawing::RenderTarget& rt)
{
assert(rt.width == _width && rt.height == _height);
@@ -58,12 +58,12 @@ namespace OpenRCT2::Ui
void Bind() const;
void BindDraw() const;
void BindRead() const;
void GetPixels(RenderTarget& rt) const;
void GetPixels(Drawing::RenderTarget& rt) const;
void SwapColourBuffer(OpenGLFramebuffer& other);
GLuint SwapDepthTexture(GLuint depth);
void Copy(OpenGLFramebuffer& src, GLenum filter);
void SetPixels(const RenderTarget& rt);
void SetPixels(const Drawing::RenderTarget& rt);
static GLuint CreateDepthTexture(int32_t width, int32_t height);
};
@@ -226,7 +226,7 @@ void TextureCache::GeneratePaletteTexture()
const auto* element = GfxGetG1Element(g1Index.value());
if (element != nullptr)
{
GfxDrawSpriteSoftware(rt, ImageId(g1Index.value()), { -element->x_offset, y - element->y_offset });
GfxDrawSpriteSoftware(rt, ImageId(g1Index.value()), { -element->xOffset, y - element->yOffset });
}
}
}
@@ -361,7 +361,7 @@ RenderTarget TextureCache::GetImageAsDPI(const ImageId imageId)
int32_t height = g1Element->height;
RenderTarget rt = CreateDPI(width, height);
GfxDrawSpriteSoftware(rt, imageId, { -g1Element->x_offset, -g1Element->y_offset });
GfxDrawSpriteSoftware(rt, imageId, { -g1Element->xOffset, -g1Element->yOffset });
return rt;
}
@@ -373,7 +373,7 @@ RenderTarget TextureCache::GetGlyphAsDPI(const ImageId imageId, const PaletteMap
RenderTarget rt = CreateDPI(width, height);
const auto glyphCoords = ScreenCoordsXY{ -g1Element->x_offset, -g1Element->y_offset };
const auto glyphCoords = ScreenCoordsXY{ -g1Element->xOffset, -g1Element->yOffset };
GfxDrawSpritePaletteSetSoftware(rt, imageId, glyphCoords, palette);
return rt;
}
@@ -20,9 +20,13 @@
#include <unordered_map>
#include <vector>
struct RenderTarget;
struct PaletteMap;
enum class FilterPaletteID : int32_t;
namespace OpenRCT2::Drawing
{
enum class FilterPaletteID : int32_t;
struct RenderTarget;
} // namespace OpenRCT2::Drawing
namespace OpenRCT2::Ui
{
@@ -211,7 +215,7 @@ namespace OpenRCT2::Ui
GLuint GetAtlasesTexture();
GLuint GetPaletteTexture();
GLuint GetBlendPaletteTexture();
static GLint PaletteToY(FilterPaletteID palette);
static GLint PaletteToY(Drawing::FilterPaletteID palette);
private:
void CreateTextures();
@@ -221,11 +225,11 @@ namespace OpenRCT2::Ui
AtlasTextureInfo LoadGlyphTexture(const ImageId image, const PaletteMap& paletteMap);
AtlasTextureInfo AllocateImage(int32_t imageWidth, int32_t imageHeight);
AtlasTextureInfo LoadBitmapTexture(ImageIndex image, const void* pixels, size_t width, size_t height);
static RenderTarget GetImageAsDPI(const ImageId imageId);
static RenderTarget GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap);
static Drawing::RenderTarget GetImageAsDPI(const ImageId imageId);
static Drawing::RenderTarget GetGlyphAsDPI(const ImageId imageId, const PaletteMap& paletteMap);
void FreeTextures();
static RenderTarget CreateDPI(int32_t width, int32_t height);
static void DeleteDPI(RenderTarget rt);
static Drawing::RenderTarget CreateDPI(int32_t width, int32_t height);
static void DeleteDPI(Drawing::RenderTarget rt);
};
} // namespace OpenRCT2::Ui
+8 -10
View File
@@ -220,7 +220,7 @@ namespace OpenRCT2
if (scroll.flags & VSCROLLBAR_VISIBLE)
{
int16_t size = widget.height() - 1;
int16_t size = widget.height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll.contentHeight - size);
@@ -397,7 +397,7 @@ namespace OpenRCT2
break;
if (w->classification != _dragWidget.windowClassification || w->number != _dragWidget.windowNumber
|| !(gInputFlags.has(InputFlag::toolActive)))
|| !gInputFlags.has(InputFlag::toolActive))
{
break;
}
@@ -490,9 +490,7 @@ namespace OpenRCT2
static void InputWindowPositionContinue(
WindowBase& w, const ScreenCoordsXY& lastScreenCoords, const ScreenCoordsXY& newScreenCoords)
{
int32_t snapProximity;
snapProximity = (w.flags.has(WindowFlag::noSnapping)) ? 0 : Config::Get().general.windowSnapProximity;
int32_t snapProximity = w.flags.has(WindowFlag::noSnapping) ? 0 : Config::Get().general.windowSnapProximity;
WindowMoveAndSnap(w, newScreenCoords - lastScreenCoords, snapProximity);
}
@@ -591,7 +589,7 @@ namespace OpenRCT2
}
else if (differentialCoords.x != 0 || differentialCoords.y != 0)
{
if (!(w->flags.has(WindowFlag::noScrolling)))
if (!w->flags.has(WindowFlag::noScrolling))
{
// User dragged a scrollable viewport
@@ -834,7 +832,7 @@ namespace OpenRCT2
int32_t newTop;
newTop = scroll.contentHeight;
newTop *= y;
y = widget.height() - 21;
y = widget.height() - 22;
if (scroll.flags & HSCROLLBAR_VISIBLE)
y -= kScrollBarWidth + 1;
newTop /= y;
@@ -844,7 +842,7 @@ namespace OpenRCT2
newTop += y;
if (newTop < 0)
newTop = 0;
y = widget.height() - 1;
y = widget.height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
y -= kScrollBarWidth + 1;
y *= -1;
@@ -937,7 +935,7 @@ namespace OpenRCT2
auto& scroll = w.scrolls[scroll_id];
scroll.flags |= VSCROLLBAR_DOWN_PRESSED;
scroll.contentOffsetY += 3;
int32_t newTop = widget.height() - 1;
int32_t newTop = widget.height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
newTop -= kScrollBarWidth + 1;
newTop *= -1;
@@ -1603,7 +1601,7 @@ namespace OpenRCT2
mainWindow = WindowGetMain();
if (mainWindow == nullptr)
return;
if ((mainWindow->flags.has(WindowFlag::noScrolling))
if (mainWindow->flags.has(WindowFlag::noScrolling)
|| (gLegacyScene == LegacyScene::trackDesignsManager || gLegacyScene == LegacyScene::titleSequence))
return;
if (mainWindow->viewport == nullptr)
+3 -3
View File
@@ -68,7 +68,7 @@ namespace OpenRCT2::Graph
}
};
void DrawFinanceGraph(RenderTarget& rt, const GraphProperties<money64>& p);
void DrawRatingGraph(RenderTarget& rt, const GraphProperties<uint16_t>& p);
void DrawGuestGraph(RenderTarget& rt, const GraphProperties<uint32_t>& p);
void DrawFinanceGraph(Drawing::RenderTarget& rt, const GraphProperties<money64>& p);
void DrawRatingGraph(Drawing::RenderTarget& rt, const GraphProperties<uint16_t>& p);
void DrawGuestGraph(Drawing::RenderTarget& rt, const GraphProperties<uint32_t>& p);
} // namespace OpenRCT2::Graph
+1 -1
View File
@@ -69,7 +69,7 @@ namespace OpenRCT2::Ui
void Scroll(int32_t linesToScroll);
void Update();
void Draw(RenderTarget& rt) const;
void Draw(Drawing::RenderTarget& rt) const;
private:
void ClearInput();
+3 -3
View File
@@ -78,8 +78,8 @@ void LandTool::ShowSurfaceStyleDropdown(WindowBase* w, Widget* widget, ObjectEnt
uint32_t surfaceCount = itemIndex;
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, surfaceCount, 47, 36,
DropdownGetAppropriateImageDropdownItemsPerRow(surfaceCount));
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() - 1, w->colours[2], 0, surfaceCount, 47,
36, DropdownGetAppropriateImageDropdownItemsPerRow(surfaceCount));
gDropdown.hasTooltips = true;
gDropdown.defaultIndex = defaultIndex;
@@ -129,7 +129,7 @@ void LandTool::ShowEdgeStyleDropdown(WindowBase* w, Widget* widget, ObjectEntryI
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(edgeCount);
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), w->colours[2], 0, edgeCount, 47, 36,
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() - 1, w->colours[2], 0, edgeCount, 47, 36,
itemsPerRow);
gDropdown.hasTooltips = true;
@@ -467,7 +467,7 @@ namespace OpenRCT2::Ui
break;
}
if (!gInputFlags.has(InputFlag::unk6) || !gInputFlags.has(InputFlag::toolActive))
if (!gInputFlags.has(InputFlag::allowRightMouseRemoval) || !gInputFlags.has(InputFlag::toolActive))
{
auto* windowMgr = GetWindowManager();
if (windowMgr->FindByClass(WindowClass::rideConstruction) == nullptr
+10 -9
View File
@@ -622,12 +622,13 @@ namespace OpenRCT2::Ui
if (widget.string == nullptr)
return;
topLeft = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, std::max<int32_t>(widget.top, widget.midY() - 5) };
const auto closeButtonTextOffset = Config::Get().interface.enlargedUi ? 5 : 6;
auto crossMidPoint = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, widget.midY() - closeButtonTextOffset };
if (widgetIsDisabled(w, widgetIndex))
colour.flags.set(ColourFlag::inset, true);
DrawText(rt, topLeft, { colour, TextAlignment::centre }, widget.string);
DrawText(rt, crossMidPoint, { colour, TextAlignment::centre }, widget.string);
}
/**
@@ -709,7 +710,7 @@ namespace OpenRCT2::Ui
bottomRight.y--;
bool hScrollNeeded = scroll.contentWidth > (widget.width() - 1) && (scroll.flags & HSCROLLBAR_VISIBLE);
bool vScrollNeeded = scroll.contentHeight > widget.height() && (scroll.flags & VSCROLLBAR_VISIBLE);
bool vScrollNeeded = scroll.contentHeight > widget.height() - 1 && (scroll.flags & VSCROLLBAR_VISIBLE);
// Horizontal scrollbar
if (hScrollNeeded)
@@ -856,7 +857,7 @@ namespace OpenRCT2::Ui
const auto& widget = w.widgets[widgetIndex];
// Get the image
if (widget.image.GetIndex() == kSpriteIdNull)
if (widget.image.GetIndex() == kImageIndexUndefined)
return;
auto image = widget.image;
@@ -1020,7 +1021,7 @@ namespace OpenRCT2::Ui
}
}
else if (
(scroll.flags & VSCROLLBAR_VISIBLE) && scroll.contentHeight > widget->height()
(scroll.flags & VSCROLLBAR_VISIBLE) && scroll.contentHeight > widget->height() - 1
&& (screenCoords.x >= w.windowPos.x + widget->right - (kScrollBarWidth + 1)))
{
// vertical scrollbar
@@ -1208,7 +1209,7 @@ namespace OpenRCT2::Ui
if (OpenRCT2::Ui::Windows::TextBoxCaretIsFlashed())
{
auto colour = ColourMapA[w.colours[1].colour].mid_light;
auto y = topLeft.y + 1 + widget.height() - 4;
auto y = topLeft.y + 1 + widget.height() - 5;
Rectangle::fill(rt, { { curX, y }, { curX + width, y } }, colour + 5);
}
}
@@ -1241,7 +1242,7 @@ namespace OpenRCT2::Ui
if (fillSize > 0)
{
Rectangle::fillInset(
rt, { topLeft + ScreenCoordsXY{ 1, 1 }, topLeft + ScreenCoordsXY{ fillSize + 1, widget.height() - 1 } },
rt, { topLeft + ScreenCoordsXY{ 1, 1 }, topLeft + ScreenCoordsXY{ fillSize + 1, widget.height() - 2 } },
{ widget.colour });
}
}
@@ -1312,7 +1313,7 @@ namespace OpenRCT2::Ui
if (scroll.flags & VSCROLLBAR_VISIBLE)
{
int32_t view_size = widget.height() - 21;
int32_t view_size = widget.height() - 22;
if (scroll.flags & HSCROLLBAR_VISIBLE)
view_size -= 11;
int32_t y = scroll.contentOffsetY * view_size;
@@ -1320,7 +1321,7 @@ namespace OpenRCT2::Ui
y /= scroll.contentHeight;
scroll.vThumbTop = y + 11;
y = widget.height() - 2;
y = widget.height() - 3;
if (scroll.flags & HSCROLLBAR_VISIBLE)
y -= 11;
y += scroll.contentOffsetY;
+2 -2
View File
@@ -78,7 +78,7 @@ namespace OpenRCT2::Ui
const ScreenCoordsXY& origin, const ScreenSize& size, WidgetType type, WindowColour colour, ImageIndex content,
StringId tooltip = kStringIdNone)
{
return makeWidget(origin, size, type, colour, ImageId(content, FilterPaletteID::paletteNull), tooltip);
return makeWidget(origin, size, type, colour, ImageId(content, Drawing::FilterPaletteID::paletteNull), tooltip);
}
constexpr Widget makeTab(const ScreenCoordsXY& origin, StringId tooltip = kStringIdNone)
@@ -248,7 +248,7 @@ namespace OpenRCT2::Ui
makeDropdownButtonWidget(origin, size, type, colour, content, tooltip));
};
void widgetDraw(RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex);
void widgetDraw(Drawing::RenderTarget& rt, WindowBase& w, WidgetIndex widgetIndex);
bool widgetIsDisabled(const WindowBase& w, WidgetIndex widgetIndex);
bool widgetIsHoldable(const WindowBase& w, WidgetIndex widgetIndex);
+2 -2
View File
@@ -94,7 +94,7 @@ namespace OpenRCT2::Ui
if (scroll.flags & VSCROLLBAR_VISIBLE)
{
int32_t size = widget->height() - 1;
int32_t size = widget->height() - 2;
if (scroll.flags & HSCROLLBAR_VISIBLE)
size -= 11;
size = std::max(0, scroll.contentHeight - size);
@@ -1024,7 +1024,7 @@ namespace OpenRCT2::Ui::Windows
*/
void WindowDrawWidgets(WindowBase& w, RenderTarget& rt)
{
if ((w.flags.has(WindowFlag::transparent)) && !(w.flags.has(WindowFlag::noBackground)))
if (w.flags.has(WindowFlag::transparent) && !w.flags.has(WindowFlag::noBackground))
Rectangle::filter(
rt, { w.windowPos, w.windowPos + ScreenCoordsXY{ w.width - 1, w.height - 1 } }, FilterPaletteID::palette51);
+5 -5
View File
@@ -23,8 +23,8 @@ namespace OpenRCT2::Ui
struct Window : WindowBase
{
void onDraw(RenderTarget& rt) override;
void onDrawWidget(WidgetIndex widgetIndex, RenderTarget& rt) override;
void onDraw(Drawing::RenderTarget& rt) override;
void onDrawWidget(WidgetIndex widgetIndex, Drawing::RenderTarget& rt) override;
void scrollToViewport();
void initScrollWidgets();
@@ -36,7 +36,7 @@ namespace OpenRCT2::Ui
void setWidgetDisabledAndInvalidate(WidgetIndex widgetIndex, bool value);
void setWidgetPressed(WidgetIndex widgetIndex, bool value);
void setCheckboxValue(WidgetIndex widgetIndex, bool value);
void drawWidgets(RenderTarget& rt);
void drawWidgets(Drawing::RenderTarget& rt);
void close();
void closeOthers();
void closeOthersOfThisClass();
@@ -86,8 +86,8 @@ namespace OpenRCT2::Ui::Windows
void InvalidateAllWindowsAfterInput();
void WindowDrawWidgets(WindowBase& w, RenderTarget& rt);
void WindowDrawViewport(RenderTarget& rt, WindowBase& w);
void WindowDrawWidgets(WindowBase& w, Drawing::RenderTarget& rt);
void WindowDrawViewport(Drawing::RenderTarget& rt, WindowBase& w);
void WindowZoomIn(WindowBase& w, bool atCursor);
void WindowZoomOut(WindowBase& w, bool atCursor);
+138 -135
View File
@@ -13,6 +13,7 @@
#include <openrct2/GameState.h>
#include <openrct2/actions/RideCreateAction.h>
#include <openrct2/config/Config.h>
#include <openrct2/ride/Ride.h>
#include <openrct2/ride/RideConstruction.h>
#include <openrct2/ride/RideData.h>
@@ -25,200 +26,200 @@ using namespace OpenRCT2::TrackMetaData;
namespace OpenRCT2
{
constexpr auto kSeparator = TrackElemType::None;
constexpr auto kSeparator = TrackElemType::none;
/**
* Order of special track elements dropdown. Elements with the same name string must be sequential or they show up twice.
*/
constexpr std::array kSpecialElementsDropdownOrder = {
TrackElemType::EndStation,
TrackElemType::endStation,
// Brakes
TrackElemType::Brakes,
TrackElemType::DiagBrakes,
TrackElemType::Down25Brakes,
TrackElemType::DiagDown25Brakes,
TrackElemType::BlockBrakes,
TrackElemType::DiagBlockBrakes,
TrackElemType::brakes,
TrackElemType::diagBrakes,
TrackElemType::down25Brakes,
TrackElemType::diagDown25Brakes,
TrackElemType::blockBrakes,
TrackElemType::diagBlockBrakes,
// Boosters
TrackElemType::Booster,
TrackElemType::DiagBooster,
TrackElemType::booster,
TrackElemType::diagBooster,
// Photo sections
TrackElemType::OnRidePhoto,
TrackElemType::onRidePhoto,
// Rotation control
TrackElemType::RotationControlToggle,
TrackElemType::rotationControlToggle,
// (Curved) lift (hills) pieces
TrackElemType::LeftCurvedLiftHill,
TrackElemType::RightCurvedLiftHill,
TrackElemType::CableLiftHill,
TrackElemType::PoweredLift,
TrackElemType::leftCurvedLiftHill,
TrackElemType::rightCurvedLiftHill,
TrackElemType::cableLiftHill,
TrackElemType::poweredLift,
kSeparator,
// Heart Line pieces
TrackElemType::HeartLineTransferUp,
TrackElemType::HeartLineTransferDown,
TrackElemType::LeftHeartLineRoll,
TrackElemType::RightHeartLineRoll,
TrackElemType::heartLineTransferUp,
TrackElemType::heartLineTransferDown,
TrackElemType::leftHeartLineRoll,
TrackElemType::rightHeartLineRoll,
kSeparator,
// Brake for drop
TrackElemType::BrakeForDrop,
TrackElemType::brakeForDrop,
kSeparator,
// Tower
TrackElemType::TowerBase,
TrackElemType::TowerSection,
TrackElemType::towerBase,
TrackElemType::towerSection,
kSeparator,
// Mini Golf pieces
TrackElemType::MinigolfHoleA,
TrackElemType::MinigolfHoleB,
TrackElemType::MinigolfHoleC,
TrackElemType::MinigolfHoleD,
TrackElemType::MinigolfHoleE,
TrackElemType::minigolfHoleA,
TrackElemType::minigolfHoleB,
TrackElemType::minigolfHoleC,
TrackElemType::minigolfHoleD,
TrackElemType::minigolfHoleE,
kSeparator,
// S-Bends
TrackElemType::SBendLeft,
TrackElemType::SBendRight,
TrackElemType::sBendLeft,
TrackElemType::sBendRight,
kSeparator,
// Helixes
TrackElemType::LeftHalfBankedHelixUpSmall,
TrackElemType::RightHalfBankedHelixUpSmall,
TrackElemType::LeftHalfBankedHelixDownSmall,
TrackElemType::RightHalfBankedHelixDownSmall,
TrackElemType::LeftHalfBankedHelixUpLarge,
TrackElemType::RightHalfBankedHelixUpLarge,
TrackElemType::LeftHalfBankedHelixDownLarge,
TrackElemType::RightHalfBankedHelixDownLarge,
TrackElemType::LeftQuarterBankedHelixLargeUp,
TrackElemType::RightQuarterBankedHelixLargeUp,
TrackElemType::LeftQuarterBankedHelixLargeDown,
TrackElemType::RightQuarterBankedHelixLargeDown,
TrackElemType::LeftQuarterHelixLargeUp,
TrackElemType::RightQuarterHelixLargeUp,
TrackElemType::LeftQuarterHelixLargeDown,
TrackElemType::RightQuarterHelixLargeDown,
TrackElemType::leftHalfBankedHelixUpSmall,
TrackElemType::rightHalfBankedHelixUpSmall,
TrackElemType::leftHalfBankedHelixDownSmall,
TrackElemType::rightHalfBankedHelixDownSmall,
TrackElemType::leftHalfBankedHelixUpLarge,
TrackElemType::rightHalfBankedHelixUpLarge,
TrackElemType::leftHalfBankedHelixDownLarge,
TrackElemType::rightHalfBankedHelixDownLarge,
TrackElemType::leftQuarterBankedHelixLargeUp,
TrackElemType::rightQuarterBankedHelixLargeUp,
TrackElemType::leftQuarterBankedHelixLargeDown,
TrackElemType::rightQuarterBankedHelixLargeDown,
TrackElemType::leftQuarterHelixLargeUp,
TrackElemType::rightQuarterHelixLargeUp,
TrackElemType::leftQuarterHelixLargeDown,
TrackElemType::rightQuarterHelixLargeDown,
kSeparator,
// (Wooden) water splash
TrackElemType::Watersplash,
TrackElemType::watersplash,
kSeparator,
// River Rapids
TrackElemType::Waterfall,
TrackElemType::Rapids, // Also used for Monster Trucks
TrackElemType::Whirlpool,
TrackElemType::waterfall,
TrackElemType::rapids, // Also used for Monster Trucks
TrackElemType::whirlpool,
kSeparator,
// Spinning tunnel
TrackElemType::SpinningTunnel,
TrackElemType::spinningTunnel,
kSeparator,
// Reverser pieces
TrackElemType::LeftReverser,
TrackElemType::RightReverser,
TrackElemType::LogFlumeReverser,
TrackElemType::leftReverser,
TrackElemType::rightReverser,
TrackElemType::logFlumeReverser,
kSeparator,
// Reverse freefall pieces
TrackElemType::ReverseFreefallSlope,
TrackElemType::ReverseFreefallVertical,
TrackElemType::reverseFreefallSlope,
TrackElemType::reverseFreefallVertical,
// Air thrust pieces
TrackElemType::AirThrustTopCap,
TrackElemType::AirThrustVerticalDown,
TrackElemType::AirThrustVerticalDownToLevel,
TrackElemType::airThrustTopCap,
TrackElemType::airThrustVerticalDown,
TrackElemType::airThrustVerticalDownToLevel,
kSeparator,
// Corkscrews
TrackElemType::LeftCorkscrewUp,
TrackElemType::LeftCorkscrewDown,
TrackElemType::RightCorkscrewUp,
TrackElemType::RightCorkscrewDown,
TrackElemType::LeftFlyerCorkscrewUp,
TrackElemType::LeftFlyerCorkscrewDown,
TrackElemType::RightFlyerCorkscrewUp,
TrackElemType::RightFlyerCorkscrewDown,
TrackElemType::LeftLargeCorkscrewUp,
TrackElemType::LeftLargeCorkscrewDown,
TrackElemType::RightLargeCorkscrewUp,
TrackElemType::RightLargeCorkscrewDown,
TrackElemType::leftCorkscrewUp,
TrackElemType::leftCorkscrewDown,
TrackElemType::rightCorkscrewUp,
TrackElemType::rightCorkscrewDown,
TrackElemType::leftFlyerCorkscrewUp,
TrackElemType::leftFlyerCorkscrewDown,
TrackElemType::rightFlyerCorkscrewUp,
TrackElemType::rightFlyerCorkscrewDown,
TrackElemType::leftLargeCorkscrewUp,
TrackElemType::leftLargeCorkscrewDown,
TrackElemType::rightLargeCorkscrewUp,
TrackElemType::rightLargeCorkscrewDown,
kSeparator,
// Loops
TrackElemType::LeftVerticalLoop,
TrackElemType::RightVerticalLoop,
TrackElemType::HalfLoopUp,
TrackElemType::HalfLoopDown,
TrackElemType::FlyerHalfLoopUninvertedUp,
TrackElemType::FlyerHalfLoopInvertedDown,
TrackElemType::FlyerHalfLoopInvertedUp,
TrackElemType::FlyerHalfLoopUninvertedDown,
TrackElemType::LeftMediumHalfLoopUp,
TrackElemType::LeftMediumHalfLoopDown,
TrackElemType::RightMediumHalfLoopUp,
TrackElemType::RightMediumHalfLoopDown,
TrackElemType::LeftLargeHalfLoopUp,
TrackElemType::LeftLargeHalfLoopDown,
TrackElemType::RightLargeHalfLoopUp,
TrackElemType::RightLargeHalfLoopDown,
TrackElemType::LeftFlyerLargeHalfLoopUninvertedUp,
TrackElemType::LeftFlyerLargeHalfLoopInvertedDown,
TrackElemType::LeftFlyerLargeHalfLoopInvertedUp,
TrackElemType::LeftFlyerLargeHalfLoopUninvertedDown,
TrackElemType::RightFlyerLargeHalfLoopUninvertedUp,
TrackElemType::RightFlyerLargeHalfLoopInvertedDown,
TrackElemType::RightFlyerLargeHalfLoopInvertedUp,
TrackElemType::RightFlyerLargeHalfLoopUninvertedDown,
TrackElemType::MultiDimInvertedFlatToDown90QuarterLoop,
TrackElemType::Up90ToInvertedFlatQuarterLoop,
TrackElemType::InvertedFlatToDown90QuarterLoop,
TrackElemType::MultiDimUp90ToInvertedFlatQuarterLoop,
TrackElemType::MultiDimFlatToDown90QuarterLoop,
TrackElemType::MultiDimInvertedUp90ToFlatQuarterLoop,
TrackElemType::leftVerticalLoop,
TrackElemType::rightVerticalLoop,
TrackElemType::halfLoopUp,
TrackElemType::halfLoopDown,
TrackElemType::flyerHalfLoopUninvertedUp,
TrackElemType::flyerHalfLoopInvertedDown,
TrackElemType::flyerHalfLoopInvertedUp,
TrackElemType::flyerHalfLoopUninvertedDown,
TrackElemType::leftMediumHalfLoopUp,
TrackElemType::leftMediumHalfLoopDown,
TrackElemType::rightMediumHalfLoopUp,
TrackElemType::rightMediumHalfLoopDown,
TrackElemType::leftLargeHalfLoopUp,
TrackElemType::leftLargeHalfLoopDown,
TrackElemType::rightLargeHalfLoopUp,
TrackElemType::rightLargeHalfLoopDown,
TrackElemType::leftFlyerLargeHalfLoopUninvertedUp,
TrackElemType::leftFlyerLargeHalfLoopInvertedDown,
TrackElemType::leftFlyerLargeHalfLoopInvertedUp,
TrackElemType::leftFlyerLargeHalfLoopUninvertedDown,
TrackElemType::rightFlyerLargeHalfLoopUninvertedUp,
TrackElemType::rightFlyerLargeHalfLoopInvertedDown,
TrackElemType::rightFlyerLargeHalfLoopInvertedUp,
TrackElemType::rightFlyerLargeHalfLoopUninvertedDown,
TrackElemType::multiDimInvertedFlatToDown90QuarterLoop,
TrackElemType::up90ToInvertedFlatQuarterLoop,
TrackElemType::invertedFlatToDown90QuarterLoop,
TrackElemType::multiDimUp90ToInvertedFlatQuarterLoop,
TrackElemType::multiDimFlatToDown90QuarterLoop,
TrackElemType::multiDimInvertedUp90ToFlatQuarterLoop,
kSeparator,
// Zero-G Rolls, Dive Loops
TrackElemType::LeftZeroGRollUp,
TrackElemType::LeftZeroGRollDown,
TrackElemType::RightZeroGRollUp,
TrackElemType::RightZeroGRollDown,
TrackElemType::LeftLargeZeroGRollUp,
TrackElemType::LeftLargeZeroGRollDown,
TrackElemType::RightLargeZeroGRollUp,
TrackElemType::RightLargeZeroGRollDown,
TrackElemType::LeftEighthDiveLoopUpToOrthogonal,
TrackElemType::LeftEighthDiveLoopDownToDiag,
TrackElemType::RightEighthDiveLoopUpToOrthogonal,
TrackElemType::RightEighthDiveLoopDownToDiag,
TrackElemType::leftZeroGRollUp,
TrackElemType::leftZeroGRollDown,
TrackElemType::rightZeroGRollUp,
TrackElemType::rightZeroGRollDown,
TrackElemType::leftLargeZeroGRollUp,
TrackElemType::leftLargeZeroGRollDown,
TrackElemType::rightLargeZeroGRollUp,
TrackElemType::rightLargeZeroGRollDown,
TrackElemType::leftEighthDiveLoopUpToOrthogonal,
TrackElemType::leftEighthDiveLoopDownToDiag,
TrackElemType::rightEighthDiveLoopUpToOrthogonal,
TrackElemType::rightEighthDiveLoopDownToDiag,
kSeparator,
// Barrel Rolls
TrackElemType::LeftBarrelRollUpToDown,
TrackElemType::LeftBarrelRollDownToUp,
TrackElemType::RightBarrelRollUpToDown,
TrackElemType::RightBarrelRollDownToUp,
TrackElemType::leftBarrelRollUpToDown,
TrackElemType::leftBarrelRollDownToUp,
TrackElemType::rightBarrelRollUpToDown,
TrackElemType::rightBarrelRollDownToUp,
kSeparator,
// Twists
TrackElemType::LeftTwistDownToUp,
TrackElemType::LeftTwistUpToDown,
TrackElemType::RightTwistDownToUp,
TrackElemType::RightTwistUpToDown,
TrackElemType::LeftFlyerTwistUp,
TrackElemType::LeftFlyerTwistDown,
TrackElemType::RightFlyerTwistUp,
TrackElemType::RightFlyerTwistDown,
TrackElemType::leftTwistDownToUp,
TrackElemType::leftTwistUpToDown,
TrackElemType::rightTwistDownToUp,
TrackElemType::rightTwistUpToDown,
TrackElemType::leftFlyerTwistUp,
TrackElemType::leftFlyerTwistDown,
TrackElemType::rightFlyerTwistUp,
TrackElemType::rightFlyerTwistDown,
};
// Update the magic number with the current number of track elements to silence
static_assert(EnumValue(TrackElemType::Count) == 350, "Reminder to add new track element to special dropdown list");
static_assert(EnumValue(TrackElemType::count) == 350, "Reminder to add new track element to special dropdown list");
/**
*
@@ -231,12 +232,13 @@ namespace OpenRCT2
int32_t colour2 = RideGetUnusedPresetVehicleColour(rideEntryIndex);
auto gameAction = GameActions::RideCreateAction(
listItem.Type, listItem.EntryIndex, colour1, colour2, getGameState().lastEntranceStyle);
listItem.Type, listItem.EntryIndex, colour1, colour2, getGameState().lastEntranceStyle,
Config::Get().general.defaultInspectionInterval);
gameAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
return;
const auto rideIndex = result->GetData<RideId>();
const auto rideIndex = result->getData<RideId>();
auto ride = GetRide(rideIndex);
RideConstructionStart(*ride);
});
@@ -278,7 +280,7 @@ namespace OpenRCT2
}
// Additional tower bases can only be built if the ride allows for it (elevator)
if (trackType == TrackElemType::TowerBase
if (trackType == TrackElemType::towerBase
&& !currentRide.getRideTypeDescriptor().HasFlag(RtdFlag::allowExtraTowerBases))
entryIsDisabled = true;
@@ -341,7 +343,7 @@ namespace OpenRCT2
break;
auto trackPiece = elements[list.PreferredNumRows + i].TrackType;
if (trackPiece == TrackElemType::None)
if (trackPiece == TrackElemType::none)
{
list.PreferredNumRows += i + 1;
break;
@@ -377,9 +379,9 @@ namespace OpenRCT2
if (trackElement->GetRideIndex() == gRideEntranceExitPlaceRideIndex)
{
const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType());
if (ted.sequences[0].flags & TRACK_SEQUENCE_FLAG_ORIGIN)
if (ted.sequences[0].flags.has(SequenceFlag::trackOrigin))
{
if (trackElement->GetTrackType() == TrackElemType::Maze)
if (trackElement->GetTrackType() == TrackElemType::maze)
{
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
}
@@ -457,7 +459,7 @@ namespace OpenRCT2
auto* trackElement = tileElement->AsTrack();
if (trackElement->GetRideIndex() != gRideEntranceExitPlaceRideIndex)
continue;
if (trackElement->GetTrackType() == TrackElemType::Maze)
if (trackElement->GetTrackType() == TrackElemType::maze)
{
// if it's a maze, it can place the entrance and exit immediately
entranceExitCoords.direction = DirectionReverse(entranceExitCoords.direction);
@@ -472,7 +474,8 @@ namespace OpenRCT2
// get the ride entrance's side relative to the TrackElement
Direction direction = (DirectionReverse(entranceExitCoords.direction) - tileElement->GetDirection()) & 3;
const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType());
if (ted.sequences[trackElement->GetSequenceIndex()].flags & (1 << direction))
auto connectionSides = ted.sequences[trackElement->GetSequenceIndex()].getEntranceConnectionSides();
if (connectionSides & (1 << direction))
{
// if that side of the TrackElement supports stations, the ride entrance is valid and faces away from
// the station
+15 -13
View File
@@ -151,18 +151,18 @@ namespace OpenRCT2::Scripting
DukObject obj(ctx);
obj.Set("id", id);
obj.Set("offset", ToDuk<ScreenCoordsXY>(ctx, { g1->x_offset, g1->y_offset }));
obj.Set("offset", ToDuk<ScreenCoordsXY>(ctx, { g1->xOffset, g1->yOffset }));
obj.Set("width", g1->width);
obj.Set("height", g1->height);
obj.Set("hasTransparent", (g1->flags & G1_FLAG_HAS_TRANSPARENCY) != 0);
obj.Set("isRLE", (g1->flags & G1_FLAG_RLE_COMPRESSION) != 0);
obj.Set("isPalette", (g1->flags & G1_FLAG_PALETTE) != 0);
obj.Set("noZoom", (g1->flags & G1_FLAG_NO_ZOOM_DRAW) != 0);
obj.Set("hasTransparent", g1->flags.has(G1Flag::hasTransparency));
obj.Set("isRLE", g1->flags.has(G1Flag::hasRLECompression));
obj.Set("isPalette", g1->flags.has(G1Flag::isPalette));
obj.Set("noZoom", g1->flags.has(G1Flag::noZoomDraw));
if (g1->flags & G1_FLAG_HAS_ZOOM_SPRITE)
if (g1->flags.has(G1Flag::hasZoomSprite))
{
obj.Set("nextZoomId", id - g1->zoomed_offset);
obj.Set("nextZoomId", id - g1->zoomedOffset);
}
else
{
@@ -173,9 +173,9 @@ namespace OpenRCT2::Scripting
static const char* GetPixelDataTypeForG1(const G1Element& g1)
{
if (g1.flags & G1_FLAG_RLE_COMPRESSION)
if (g1.flags.has(G1Flag::hasRLECompression))
return "rle";
else if (g1.flags & G1_FLAG_PALETTE)
else if (g1.flags.has(G1Flag::isPalette))
return "palette";
return "raw";
}
@@ -405,10 +405,10 @@ namespace OpenRCT2::Scripting
el.offset = newData;
el.width = pixelData.Width;
el.height = pixelData.Height;
el.flags = 0;
el.flags = {};
if (pixelData.Type == PixelDataKind::Rle)
{
el.flags |= G1_FLAG_RLE_COMPRESSION;
el.flags.set(G1Flag::hasRLECompression);
}
GfxSetG1Element(id, &el);
DrawingEngineInvalidateImage(id);
@@ -441,7 +441,7 @@ namespace OpenRCT2::Scripting
auto createNewImage = false;
auto g1 = GfxGetG1Element(id);
if (g1 == nullptr || g1->width != size.width || g1->height != size.height || (g1->flags & G1_FLAG_RLE_COMPRESSION))
if (g1 == nullptr || g1->width != size.width || g1->height != size.height || g1->flags.has(G1Flag::hasRLECompression))
{
createNewImage = true;
}
@@ -465,7 +465,9 @@ namespace OpenRCT2::Scripting
}
auto dukG = GetObjectAsDukValue(ctx, std::make_shared<ScGraphicsContext>(ctx, rt));
drawingEngine->BeginDraw();
scriptEngine.ExecutePluginCall(plugin, callback, { dukG }, false);
drawingEngine->EndDraw();
if (createNewImage)
{
@@ -478,7 +480,7 @@ namespace OpenRCT2::Scripting
newg1.offset = rt.bits;
newg1.width = size.width;
newg1.height = size.height;
newg1.flags = 0;
newg1.flags = {};
GfxSetG1Element(id, &newg1);
}
+7 -5
View File
@@ -138,15 +138,17 @@ namespace OpenRCT2::Ui::Windows
void MouseOver(const ScreenCoordsXY& pos, bool isMouseDown);
void MouseDown(const ScreenCoordsXY& pos);
void MouseUp(const ScreenCoordsXY& pos);
void Paint(WindowBase* w, RenderTarget& rt, const ScrollArea* scroll) const;
void Paint(WindowBase* w, Drawing::RenderTarget& rt, const ScrollArea* scroll) const;
private:
void PaintHeading(
WindowBase* w, RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const std::string& text,
ColumnSortOrder sortOrder, bool isPressed) const;
void PaintSeparator(RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const;
WindowBase* w, Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size,
const std::string& text, ColumnSortOrder sortOrder, bool isPressed) const;
void PaintSeparator(
Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text) const;
void PaintCell(
RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text, bool isHighlighted) const;
Drawing::RenderTarget& rt, const ScreenCoordsXY& pos, const ScreenSize& size, const char* text,
bool isHighlighted) const;
std::optional<RowColumn> GetItemIndexAt(const ScreenCoordsXY& pos);
Widget* GetWidget() const;
void Invalidate();
+6 -6
View File
@@ -520,7 +520,7 @@ namespace OpenRCT2::Ui::Windows
{
auto& listView = _info.ListViews[scrollIndex];
auto wwidth = widget.width() - 2;
auto wheight = widget.height() + 1 - 2;
auto wheight = widget.height() - 2;
if (listView.GetScrollbars() == ScrollbarType::Horizontal
|| listView.GetScrollbars() == ScrollbarType::Both)
{
@@ -536,7 +536,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
DrawTabImages(rt);
@@ -562,7 +562,7 @@ namespace OpenRCT2::Ui::Windows
RenderTarget widgetDpi;
if (ClipDrawPixelInfo(
widgetDpi, rt, { windowPos.x + widget.left, windowPos.y + widget.top }, widget.width() - 1,
widget.height()))
widget.height() - 1))
{
auto ctx = onDraw.context();
auto dukWidget = ScWidget::ToDukValue(ctx, this, widgetIndex);
@@ -653,8 +653,8 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(items[i].c_str());
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1,
colours[widget->colour], 0, Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[widget->colour], 0,
Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
if (selectedIndex >= 0 && selectedIndex < static_cast<int32_t>(numItems))
gDropdown.items[selectedIndex].setChecked(true);
@@ -810,7 +810,7 @@ namespace OpenRCT2::Ui::Windows
auto left = windowPos.x + viewportWidget->left + 1;
auto top = windowPos.y + viewportWidget->top + 1;
auto wwidth = viewportWidget->width() - 2;
auto wheight = viewportWidget->height() - 1;
auto wheight = viewportWidget->height() - 2;
if (viewport == nullptr)
{
ViewportCreate(*this, { left, top }, wwidth, wheight, Focus(CoordsXYZ(0, 0, 0)));
@@ -51,7 +51,6 @@ namespace OpenRCT2::Scripting
void range_set(DukValue value)
{
MapInvalidateSelectionRect();
if (value.type() == DukValue::Type::OBJECT)
{
auto range = GetMapRange(value);
@@ -69,7 +68,6 @@ namespace OpenRCT2::Scripting
{
gMapSelectFlags.unset(MapSelectFlag::enable);
}
MapInvalidateSelectionRect();
}
DukValue tiles_get() const
@@ -78,7 +76,7 @@ namespace OpenRCT2::Scripting
if (gMapSelectFlags.has(MapSelectFlag::enableConstruct))
{
duk_uarridx_t index = 0;
for (const auto& tile : gMapSelectionTiles)
for (const auto& tile : MapSelection::getSelectedTiles())
{
duk_push_object(_ctx);
duk_push_int(_ctx, tile.x);
@@ -94,8 +92,7 @@ namespace OpenRCT2::Scripting
void tiles_set(DukValue value)
{
MapInvalidateMapSelectionTiles();
gMapSelectionTiles.clear();
MapSelection::clearSelectedTiles();
if (value.is_array())
{
value.push();
@@ -108,14 +105,14 @@ namespace OpenRCT2::Scripting
auto coords = GetCoordsXY(dukElement);
if (coords)
{
gMapSelectionTiles.push_back(*coords);
MapSelection::addSelectedTile(*coords);
}
}
}
duk_pop(_ctx);
}
if (gMapSelectionTiles.empty())
if (MapSelection::getSelectedTiles().empty())
{
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::green);
@@ -124,7 +121,6 @@ namespace OpenRCT2::Scripting
{
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
}
MapInvalidateMapSelectionTiles();
}
static void Register(duk_context* ctx)
+2 -2
View File
@@ -250,7 +250,7 @@ namespace OpenRCT2::Scripting
auto widget = GetWidget();
if (widget != nullptr)
{
return widget->height() + 1;
return widget->height();
}
return 0;
}
@@ -371,7 +371,7 @@ namespace OpenRCT2::Scripting
if (IsCustomWindow())
{
auto widget = GetWidget();
if (widget != nullptr && (widget->flags.has(WidgetFlag::textIsString)) && widget->string != nullptr)
if (widget != nullptr && widget->flags.has(WidgetFlag::textIsString) && widget->string != nullptr)
{
return widget->string;
}
+1 -1
View File
@@ -208,7 +208,7 @@ namespace OpenRCT2::Scripting
auto w = GetWindow();
if (w != nullptr)
{
return (w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront));
return w->flags.hasAny(WindowFlag::stickToBack, WindowFlag::stickToFront);
}
return false;
}
+3 -3
View File
@@ -147,7 +147,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -219,7 +219,7 @@ namespace OpenRCT2::Ui::Windows
}
}
int32_t DrawOpenRCT2Info(RenderTarget& rt)
int32_t DrawOpenRCT2Info(Drawing::RenderTarget& rt)
{
// Draw logo on placeholder widget
const auto& logoWidget = widgets[WIDX_OPENRCT2_LOGO];
@@ -252,7 +252,7 @@ namespace OpenRCT2::Ui::Windows
return textCoords.y - windowPos.y;
}
int32_t DrawRCT2Info(RenderTarget& rt)
int32_t DrawRCT2Info(Drawing::RenderTarget& rt)
{
auto& backgroundWidget = widgets[WIDX_PAGE_BACKGROUND];
auto textCoords = windowPos + ScreenCoordsXY{ backgroundWidget.midX(), backgroundWidget.top + kPadding };
+6 -6
View File
@@ -155,7 +155,7 @@ namespace OpenRCT2::Ui::Windows
{
auto& list = widgets[WIDX_LIST];
list.left = 6;
list.top = widgets[WIDX_TITLE].height() + 8 + 11 + 3;
list.top = widgets[WIDX_TITLE].height() - 1 + 8 + 11 + 3;
list.right = width - 2 - 24 - 1;
list.bottom = height - 6 - 11 - 3;
@@ -168,7 +168,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_LOW_LABEL].left = list.left;
widgets[WIDX_LOW_LABEL].right = list.right;
auto toolstripY = widgets[WIDX_TITLE].height() + 8;
auto toolstripY = widgets[WIDX_TITLE].height() - 1 + 8;
auto toolstripRight = width - 2;
auto toolstripLeft = toolstripRight - 24;
for (WidgetIndex i = WIDX_MOVE_UP; i <= WIDX_APPLY; i++)
@@ -187,12 +187,12 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_APPLY].top = widgets[WIDX_APPLY].bottom - 24;
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
@@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
void PaintItem(RenderTarget& rt, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted)
void PaintItem(Drawing::RenderTarget& rt, int32_t y, Formatter& ft, bool isChecked, bool isSelected, bool isHighlighted)
{
auto listWidth = widgets[WIDX_LIST].right - widgets[WIDX_LIST].left;
auto stringId = STR_BLACK_STRING;
@@ -258,7 +258,7 @@ namespace OpenRCT2::Ui::Windows
PaintCheckbox(rt, { { 2, y + 1 }, { 2 + checkboxSize + 1, y + 1 + checkboxSize } }, isChecked);
}
void PaintCheckbox(RenderTarget& rt, const ScreenRect& rect, bool checked)
void PaintCheckbox(Drawing::RenderTarget& rt, const ScreenRect& rect, bool checked)
{
Rectangle::fillInset(
rt, rect, colours[1], Rectangle::BorderStyle::inset, Rectangle::FillBrightness::dark,
+3 -3
View File
@@ -88,7 +88,7 @@ namespace OpenRCT2::Ui::Windows
const auto& viewportWidget = widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 },
viewportWidget.width() - 2, (viewportWidget.height()) - 1, Focus(_bannerViewPos));
viewportWidget.width() - 2, viewportWidget.height() - 2, Focus(_bannerViewPos));
if (viewport != nullptr)
viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
@@ -176,7 +176,7 @@ namespace OpenRCT2::Ui::Windows
widget--;
WindowDropdownShowTextCustomWidth(
{ widget->left + windowPos.x, widget->top + windowPos.y }, widget->height() + 1, colours[1], 0,
{ widget->left + windowPos.x, widget->top + windowPos.y }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, numItems, widget->width() - 1 + 3);
gDropdown.items[EnumValue(banner->textColour) - 1].setChecked(true);
@@ -269,7 +269,7 @@ namespace OpenRCT2::Ui::Windows
createViewport();
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
+1 -1
View File
@@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
const int32_t lineHeight = FontGetLineHeight(FontStyle::medium);
+6 -6
View File
@@ -593,7 +593,7 @@ static StringId window_cheats_page_titles[] = {
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -775,7 +775,7 @@ static StringId window_cheats_page_titles[] = {
}
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
// Money tab
if (!isWidgetDisabled(WIDX_TAB_1))
@@ -848,12 +848,12 @@ static StringId window_cheats_page_titles[] = {
switch (widgetIndex)
{
case WIDX_MONEY_SPINNER_INCREMENT:
_moneySpinnerValue = AddClamp<money64>(
_moneySpinnerValue = AddClamp(
kCheatsMoneyIncrement * (_moneySpinnerValue / kCheatsMoneyIncrement), kCheatsMoneyIncrement);
invalidateWidget(WIDX_MONEY_SPINNER);
break;
case WIDX_MONEY_SPINNER_DECREMENT:
_moneySpinnerValue = AddClamp<money64>(
_moneySpinnerValue = AddClamp(
kCheatsMoneyIncrement * (_moneySpinnerValue / kCheatsMoneyIncrement), -kCheatsMoneyIncrement);
invalidateWidget(WIDX_MONEY_SPINNER);
break;
@@ -994,7 +994,7 @@ static StringId window_cheats_page_titles[] = {
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 4);
gDropdown.items[EnumValue(gameState.cheats.selectedStaffSpeed)].setChecked(true);
}
@@ -1016,7 +1016,7 @@ static StringId window_cheats_page_titles[] = {
gDropdown.items[i] = Dropdown::MenuLabel(WeatherTypes[i]);
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, std::size(WeatherTypes), dropdownWidget->width() - 4);
auto currentWeather = gameState.weatherCurrent.weatherType;
+5 -8
View File
@@ -171,7 +171,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -218,7 +218,6 @@ namespace OpenRCT2::Ui::Windows
{
uint8_t state_changed = 0;
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
@@ -228,7 +227,7 @@ namespace OpenRCT2::Ui::Windows
return state_changed;
}
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -275,7 +274,6 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
MapInvalidateSelectionRect();
return state_changed;
}
@@ -290,7 +288,7 @@ namespace OpenRCT2::Ui::Windows
auto action = GetClearAction();
auto result = GameActions::Query(&action, getGameState());
auto cost = (result.Error == GameActions::Status::Ok ? result.Cost : kMoney64Undefined);
auto cost = (result.error == GameActions::Status::ok ? result.cost : kMoney64Undefined);
if (_clearSceneryCost != cost)
{
_clearSceneryCost = cost;
@@ -331,7 +329,7 @@ namespace OpenRCT2::Ui::Windows
case WIDX_BACKGROUND:
{
auto* windowMgr = GetWindowManager();
if (windowMgr->FindByClass(WindowClass::error) == nullptr && (gMapSelectFlags.has(MapSelectFlag::enable)))
if (windowMgr->FindByClass(WindowClass::error) == nullptr && gMapSelectFlags.has(MapSelectFlag::enable))
{
auto action = GetClearAction();
GameActions::Execute(&action, getGameState());
@@ -347,7 +345,6 @@ namespace OpenRCT2::Ui::Windows
switch (widgetIndex)
{
case WIDX_BACKGROUND:
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
gCurrentToolId = Tool::bulldozer;
break;
@@ -387,7 +384,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::clearScenery);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::bulldozer);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
}
} // namespace OpenRCT2::Ui::Windows
+3 -3
View File
@@ -91,7 +91,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::MenuLabel(STR_SUFFIX);
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, 2, widget->width() - 4);
if (CurrencyDescriptors[EnumValue(CurrencyType::custom)].affix_unicode == CurrencyAffix::prefix)
@@ -187,14 +187,14 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
auto ft = Formatter::Common();
ft.Add<money64>(10.00_GBP);
drawWidgets(rt);
auto screenCoords = windowPos + ScreenCoordsXY{ 10, 18 + widgets[WIDX_TITLE].height() };
auto screenCoords = windowPos + ScreenCoordsXY{ 10, 18 + widgets[WIDX_TITLE].height() - 1 };
DrawTextBasic(rt, screenCoords, STR_RATE, {}, { colours[1] });
+1 -1
View File
@@ -154,7 +154,7 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_TOGGLE_FORCE_REDRAW, gPaintForceRedraw);
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
+2 -2
View File
@@ -104,7 +104,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, { screenCoords.x + 2, screenCoords.y + yOffset }, width - 7, format, ft, { colour });
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -640,7 +640,7 @@ namespace OpenRCT2::Ui::Windows
// Show dropdown
auto squareSize = DropdownWindow::GetDefaultRowHeight();
WindowDropdownShowImage(
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour,
w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height(), dropdownColour,
Dropdown::Flag::StayOpen, numColours, squareSize, squareSize,
DropdownGetAppropriateImageDropdownItemsPerRow(static_cast<uint32_t>(numColours)));
@@ -125,7 +125,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
auto drawPreviousButton = widgets[WIDX_PREVIOUS_STEP_BUTTON].type != WidgetType::empty;
auto drawNextButton = widgets[WIDX_NEXT_STEP_BUTTON].type != WidgetType::empty;
@@ -334,7 +334,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_NEXT_IMAGE].type = WidgetType::empty;
}
void DrawLeftButtonBack(RenderTarget& rt)
void DrawLeftButtonBack(Drawing::RenderTarget& rt)
{
const auto& previousWidget = widgets[WIDX_PREVIOUS_IMAGE];
auto leftTop = windowPos + ScreenCoordsXY{ previousWidget.left, previousWidget.top };
@@ -342,7 +342,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51);
}
void DrawLeftButton(RenderTarget& rt)
void DrawLeftButton(Drawing::RenderTarget& rt)
{
const auto topLeft = windowPos
+ ScreenCoordsXY{ widgets[WIDX_PREVIOUS_IMAGE].left + 1, widgets[WIDX_PREVIOUS_IMAGE].top + 1 };
@@ -374,7 +374,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre });
}
void DrawRightButtonBack(RenderTarget& rt)
void DrawRightButtonBack(Drawing::RenderTarget& rt)
{
auto nextWidget = widgets[WIDX_NEXT_IMAGE];
auto leftTop = windowPos + ScreenCoordsXY{ nextWidget.left, nextWidget.top };
@@ -382,7 +382,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::filter(rt, { leftTop, rightBottom }, FilterPaletteID::palette51);
}
void DrawRightButton(RenderTarget& rt)
void DrawRightButton(Drawing::RenderTarget& rt)
{
const auto topLeft = windowPos
+ ScreenCoordsXY{ widgets[WIDX_NEXT_IMAGE].left + 1, widgets[WIDX_NEXT_IMAGE].top + 1 };
@@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, { textX, textY + 10 }, stringId, {}, { textColour, TextAlignment::centre });
}
void DrawStepText(RenderTarget& rt)
void DrawStepText(Drawing::RenderTarget& rt)
{
int16_t stateX = (widgets[WIDX_PREVIOUS_IMAGE].right + widgets[WIDX_NEXT_IMAGE].left) / 2 + windowPos.x;
int16_t stateY = height - 0x0C + windowPos.y;
@@ -269,7 +269,7 @@ namespace OpenRCT2::Ui::Windows
WindowEditorInventionsListDragOpen(researchItem, windowPos, widgets[WIDX_PRE_RESEARCHED_SCROLL].right);
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
const auto& gameState = getGameState();
@@ -354,7 +354,7 @@ namespace OpenRCT2::Ui::Windows
return fallback;
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -403,7 +403,7 @@ namespace OpenRCT2::Ui::Windows
RenderTarget clipDPI;
screenPos = windowPos + ScreenCoordsXY{ bkWidget.left + 1, bkWidget.top + 1 };
const auto clipWidth = bkWidget.width() - 2;
const auto clipHeight = bkWidget.height() - 1;
const auto clipHeight = bkWidget.height() - 2;
if (ClipDrawPixelInfo(clipDPI, rt, screenPos, clipWidth, clipHeight))
{
object->DrawPreview(clipDPI, clipWidth, clipHeight);
@@ -655,7 +655,7 @@ namespace OpenRCT2::Ui::Windows
close();
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
auto screenCoords = windowPos + ScreenCoordsXY{ 0, 2 };
@@ -533,7 +533,7 @@ namespace OpenRCT2::Ui::Windows
auto& ddWidget = widgets[WIDX_FILTER_DROPDOWN];
WindowDropdownShowText(
{ windowPos.x + ddWidget.left, windowPos.y + ddWidget.top }, ddWidget.height() + 1,
{ windowPos.x + ddWidget.left, windowPos.y + ddWidget.top }, ddWidget.height(),
colours[ddWidget.colour], Dropdown::Flag::StayOpen, _numSourceGameItems + numSelectionItems);
for (int32_t i = 0; i < _numSourceGameItems; i++)
@@ -655,8 +655,8 @@ namespace OpenRCT2::Ui::Windows
const auto objectSelectResult = WindowEditorObjectSelectionSelectObject(0, inputFlags, listItem->repositoryItem);
if (!objectSelectResult.Successful)
{
StringId error_title = (inputFlags.has(EditorInputFlag::select)) ? STR_UNABLE_TO_SELECT_THIS_OBJECT
: STR_UNABLE_TO_DE_SELECT_THIS_OBJECT;
StringId error_title = inputFlags.has(EditorInputFlag::select) ? STR_UNABLE_TO_SELECT_THIS_OBJECT
: STR_UNABLE_TO_DE_SELECT_THIS_OBJECT;
ContextShowError(error_title, objectSelectResult.Message, {});
return;
@@ -725,7 +725,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
// ScrollPaint
ScreenCoordsXY screenCoords;
@@ -917,7 +917,7 @@ namespace OpenRCT2::Ui::Windows
for (size_t i = 0; i < std::size(ObjectSelectionPages); i++)
{
auto& widget = widgets[WIDX_TAB_1 + i];
if (ObjectSelectionPages[i].Image != kSpriteIdNull)
if (ObjectSelectionPages[i].Image != kImageIndexUndefined)
{
widget.type = WidgetType::tab;
widget.left = x;
@@ -1008,7 +1008,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].right = widgets[WIDX_PREVIEW].left + kPreviewSize;
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -1112,7 +1112,7 @@ namespace OpenRCT2::Ui::Windows
RenderTarget clipDPI;
auto screenPos = windowPos + ScreenCoordsXY{ previewWidget.left + 1, previewWidget.top + 1 };
int32_t previewWidth = previewWidget.width() - 2;
int32_t previewHeight = previewWidget.height() - 1;
int32_t previewHeight = previewWidget.height() - 2;
if (ClipDrawPixelInfo(clipDPI, rt, screenPos, previewWidth, previewHeight))
{
_loadedObject->DrawPreview(clipDPI, previewWidth, previewHeight);
@@ -1248,7 +1248,7 @@ namespace OpenRCT2::Ui::Windows
_listItems.shrink_to_fit();
}
void DrawDescriptions(RenderTarget& rt)
void DrawDescriptions(Drawing::RenderTarget& rt)
{
auto screenPos = windowPos + ScreenCoordsXY{ widgets[WIDX_PREVIEW].midX(), widgets[WIDX_PREVIEW].bottom + 3 };
auto descriptionWidth = width - widgets[WIDX_LIST].right - 12;
@@ -1356,7 +1356,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawDebugData(RenderTarget& rt)
void DrawDebugData(Drawing::RenderTarget& rt)
{
ObjectListItem* listItem = &_listItems[selectedListItem];
auto screenPos = windowPos + ScreenCoordsXY{ width - 5, height - (kListRowHeight * 6) };
+25 -16
View File
@@ -30,6 +30,7 @@
#include <openrct2/world/tile_element/SurfaceElement.h>
using namespace OpenRCT2::Drawing;
using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Ui::Windows
{
@@ -41,12 +42,13 @@ namespace OpenRCT2::Ui::Windows
static constexpr int32_t kScrollWidth = (kImageSize * kNumColumns) + kScrollBarWidth + 4;
static constexpr int32_t kScrollHeight = (kImageSize * kNumRows);
static constexpr ScreenSize kWindowSize = { kScrollWidth + 28, kScrollHeight + 51 };
static bool _placingEntrance = false;
struct EntranceSelection
{
ObjectEntryIndex entryIndex = kObjectEntryIndexNull;
StringId stringId = kStringIdNone;
ImageIndex imageId = kSpriteIdNull;
ImageIndex imageId = kImageIndexUndefined;
};
enum WindowEditorParkEntranceListWidgetIdx
@@ -103,7 +105,7 @@ namespace OpenRCT2::Ui::Windows
return numRows;
}
void PaintPreview(RenderTarget& rt, ImageIndex imageStart, ScreenCoordsXY screenCoords, Direction direction)
void PaintPreview(Drawing::RenderTarget& rt, ImageIndex imageStart, ScreenCoordsXY screenCoords, Direction direction)
{
imageStart += (direction * 3);
@@ -166,8 +168,11 @@ namespace OpenRCT2::Ui::Windows
void PlaceParkEntranceToolUpdate(const ScreenCoordsXY& screenCoords)
{
MapInvalidateSelectionRect();
MapInvalidateMapSelectionTiles();
if (_placingEntrance)
{
return;
}
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow, MapSelectFlag::enableConstruct);
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
if (parkEntrancePosition.IsNull())
@@ -177,12 +182,12 @@ namespace OpenRCT2::Ui::Windows
}
int32_t sideDirection = (parkEntrancePosition.direction + 1) & 3;
gMapSelectionTiles.clear();
gMapSelectionTiles.push_back({ parkEntrancePosition.x, parkEntrancePosition.y });
gMapSelectionTiles.push_back(
MapSelection::clearSelectedTiles();
MapSelection::addSelectedTile({ parkEntrancePosition.x, parkEntrancePosition.y });
MapSelection::addSelectedTile(
{ parkEntrancePosition.x + CoordsDirectionDelta[sideDirection].x,
parkEntrancePosition.y + CoordsDirectionDelta[sideDirection].y });
gMapSelectionTiles.push_back(
MapSelection::addSelectedTile(
{ parkEntrancePosition.x - CoordsDirectionDelta[sideDirection].x,
parkEntrancePosition.y - CoordsDirectionDelta[sideDirection].y });
@@ -190,7 +195,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectArrowDirection = parkEntrancePosition.direction;
gMapSelectFlags.set(MapSelectFlag::enableConstruct, MapSelectFlag::enableArrow);
MapInvalidateMapSelectionTiles();
if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition)
{
return;
@@ -202,10 +206,10 @@ namespace OpenRCT2::Ui::Windows
auto pathIndex = isLegacyPath ? gFootpathSelection.LegacyPath : gFootpathSelection.NormalSurface;
auto gameAction = GameActions::ParkEntrancePlaceAction(
parkEntrancePosition, pathIndex, _selectedEntranceType, isLegacyPath);
gameAction.SetFlags(GAME_COMMAND_FLAG_GHOST);
gameAction.SetFlags({ CommandFlag::ghost });
auto result = GameActions::Execute(&gameAction, getGameState());
if (result.Error == GameActions::Status::Ok)
if (result.error == GameActions::Status::ok)
{
gParkEntranceGhostPosition = parkEntrancePosition;
gParkEntranceGhostExists = true;
@@ -214,6 +218,8 @@ namespace OpenRCT2::Ui::Windows
void PlaceParkEntranceToolDown(const ScreenCoordsXY& screenCoords)
{
_placingEntrance = true;
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow, MapSelectFlag::enableConstruct);
ParkEntranceRemoveGhost();
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
@@ -223,10 +229,12 @@ namespace OpenRCT2::Ui::Windows
auto pathIndex = isLegacyPath ? gFootpathSelection.LegacyPath : gFootpathSelection.NormalSurface;
auto gameAction = GameActions::ParkEntrancePlaceAction(
parkEntrancePosition, pathIndex, _selectedEntranceType, isLegacyPath);
gameAction.SetCallback(
[&](const GameActions::GameAction*, const GameActions::Result* result) { _placingEntrance = false; });
auto result = GameActions::Execute(&gameAction, getGameState());
if (result.Error == GameActions::Status::Ok)
if (result.error == GameActions::Status::ok)
{
Audio::Play3D(Audio::SoundId::placeItem, result.Position);
Audio::Play3D(Audio::SoundId::placeItem, result.position);
}
}
}
@@ -264,7 +272,7 @@ namespace OpenRCT2::Ui::Windows
pressedWidgets |= 1LL << WIDX_TAB;
ToolSet(*this, WIDX_LIST, Tool::entranceDown);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
void onMouseUp(WidgetIndex widgetIndex) override
@@ -299,7 +307,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_LIST].bottom = height - 5;
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
GfxDrawSprite(
@@ -307,7 +315,7 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ widgets[WIDX_TAB].left, widgets[WIDX_TAB].top });
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
GfxClear(rt, ColourMapA[colours[1].colour].mid_light);
@@ -415,6 +423,7 @@ namespace OpenRCT2::Ui::Windows
window = windowMgr->Create<EditorParkEntrance>(
WindowClass::editorParkEntrance, kWindowSize, { WindowFlag::higherContrastOnPress, WindowFlag::resizable });
_placingEntrance = false;
return window;
}
} // namespace OpenRCT2::Ui::Windows
@@ -457,7 +457,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -515,7 +515,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (page == WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_RIDES)
{
@@ -590,7 +590,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(WIDX_TAB_1 + page, true);
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
Widget* widget;
int32_t spriteIndex;
@@ -766,8 +766,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = &widgets[WIDX_OBJECTIVE];
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 4);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 4);
}
void ShowCategoryDropdown()
@@ -779,8 +779,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = &widgets[WIDX_CATEGORY];
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 4);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, Dropdown::Flag::StayOpen, 5, dropdownWidget->width() - 4);
gDropdown.items[EnumValue(getGameState().scenarioOptions.category)].setChecked(true);
}
@@ -1141,7 +1141,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x0067161C
*/
void ObjectiveOnDraw(RenderTarget& rt)
void ObjectiveOnDraw(Drawing::RenderTarget& rt)
{
const auto& gameState = getGameState();
const auto& scenarioOptions = gameState.scenarioOptions;
@@ -1272,7 +1272,7 @@ namespace OpenRCT2::Ui::Windows
SetPressedTab();
}
void ScenarioDetailsOnDraw(RenderTarget& rt)
void ScenarioDetailsOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1561,7 +1561,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[2] = Dropdown::MenuLabel(STR_PAID_ENTRY_PAID_RIDES);
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() - 2,
colours[1], 0, Dropdown::Flag::StayOpen, 3, dropdownWidget->width() - 4);
if (gameState.park.flags & PARK_FLAGS_UNLOCK_ALL_PRICES)
@@ -1684,7 +1684,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox;
}
void FinancialDraw(RenderTarget& rt)
void FinancialDraw(Drawing::RenderTarget& rt)
{
ScreenCoordsXY screenCoords{};
@@ -1899,7 +1899,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[3] = Dropdown::MenuLabel(STR_GUESTS_PREFER_INTENSITY_MORE_INTENSE_RIDES);
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() - 1,
{ windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() - 2,
colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget.width() - 4);
const auto preferLess = gameState.park.flags & PARK_FLAGS_PREF_LESS_INTENSE_RIDES;
@@ -1970,7 +1970,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(WIDX_HARD_GUEST_GENERATION, gameState.park.flags & PARK_FLAGS_DIFFICULT_GUEST_GENERATION);
}
void GuestsDraw(RenderTarget& rt)
void GuestsDraw(Drawing::RenderTarget& rt)
{
ScreenCoordsXY screenCoords{};
@@ -2173,7 +2173,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_CLOSE].type = gLegacyScene == LegacyScene::scenarioEditor ? WidgetType::empty : WidgetType::closeBox;
}
void LandDraw(RenderTarget& rt)
void LandDraw(Drawing::RenderTarget& rt)
{
ScreenCoordsXY screenCoords{};
@@ -2327,7 +2327,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x00672340
*/
void RidesOnDraw(RenderTarget& rt)
void RidesOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -2337,7 +2337,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x0067236F
*/
void RidesOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
void RidesOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
int32_t colour = ColourMapA[colours[1].colour].mid_light;
Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour);
+1 -1
View File
@@ -67,7 +67,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
+7 -7
View File
@@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::Windows
onPrepareDrawGraph(graphPageWidget, centredGraph);
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -395,7 +395,7 @@ namespace OpenRCT2::Ui::Windows
return {};
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (page != WINDOW_FINANCES_PAGE_SUMMARY)
return;
@@ -588,7 +588,7 @@ namespace OpenRCT2::Ui::Windows
initialiseScrollPosition(WIDX_SUMMARY_SCROLL, 0);
}
void onDrawSummary(RenderTarget& rt)
void onDrawSummary(Drawing::RenderTarget& rt)
{
auto titleBarBottom = widgets[WIDX_TITLE].bottom;
auto screenCoords = windowPos + ScreenCoordsXY{ 8, titleBarBottom + 37 };
@@ -706,7 +706,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDrawMarketing(RenderTarget& rt)
void onDrawMarketing(Drawing::RenderTarget& rt)
{
auto screenCoords = windowPos + ScreenCoordsXY{ 8, widgets[WIDX_TAB_1].top + 45 };
int32_t noCampaignsActive = 1;
@@ -785,7 +785,7 @@ namespace OpenRCT2::Ui::Windows
#pragma region Graph Events
void onDrawGraph(RenderTarget& rt, const money64 currentValue, const StringId fmt) const
void onDrawGraph(Drawing::RenderTarget& rt, const money64 currentValue, const StringId fmt) const
{
Formatter ft;
ft.Add<money64>(currentValue);
@@ -852,7 +852,7 @@ namespace OpenRCT2::Ui::Windows
widgetScrollUpdateThumbs(*this, widgetIndex);
}
void DrawTabImage(RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage;
@@ -870,7 +870,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_FINANCES_PAGE_SUMMARY, SPR_TAB_FINANCES_SUMMARY_0);
DrawTabImage(rt, WINDOW_FINANCES_PAGE_FINANCIAL_GRAPH, SPR_TAB_FINANCES_FINANCIAL_GRAPH_0);
+47 -46
View File
@@ -29,6 +29,7 @@
#include <openrct2/audio/Audio.h>
#include <openrct2/core/FlagHolder.hpp>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/network/NetworkAction.h>
#include <openrct2/object/FootpathObject.h>
#include <openrct2/object/FootpathRailingsObject.h>
#include <openrct2/object/FootpathSurfaceObject.h>
@@ -47,6 +48,7 @@
#include <openrct2/world/tile_element/SurfaceElement.h>
using namespace OpenRCT2::Numerics;
using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Ui::Windows
{
@@ -240,7 +242,7 @@ namespace OpenRCT2::Ui::Windows
ToolCancel();
_footpathConstructionMode = PathConstructionMode::onLand;
ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
@@ -254,7 +256,6 @@ namespace OpenRCT2::Ui::Windows
{
FootpathUpdateProvisional();
ViewportSetVisibility(ViewportVisibility::standard);
MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
auto* windowMgr = Ui::GetWindowManager();
@@ -345,11 +346,10 @@ namespace OpenRCT2::Ui::Windows
_windowFootpathCost = kMoney64Undefined;
ToolCancel();
FootpathUpdateProvisional();
MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
_footpathConstructionMode = PathConstructionMode::dragArea;
ToolSet(*this, WIDX_CONSTRUCT_DRAG_AREA, Tool::pathDown);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
}
@@ -370,11 +370,10 @@ namespace OpenRCT2::Ui::Windows
_windowFootpathCost = kMoney64Undefined;
ToolCancel();
FootpathUpdateProvisional();
MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
_footpathConstructionMode = PathConstructionMode::onLand;
ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
break;
@@ -395,11 +394,10 @@ namespace OpenRCT2::Ui::Windows
_windowFootpathCost = kMoney64Undefined;
ToolCancel();
FootpathUpdateProvisional();
MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
_footpathConstructionMode = PathConstructionMode::bridgeOrTunnelPick;
ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::crosshair);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
_footpathErrorOccured = false;
WindowFootpathSetEnabledAndPressedWidgets();
break;
@@ -535,6 +533,18 @@ namespace OpenRCT2::Ui::Windows
? WidgetType::imgBtn
: WidgetType::empty;
#ifndef DISABLE_NETWORK
bool canDrag = true;
if (Network::GetMode() == Network::Mode::client)
{
canDrag = Network::CanPerformAction(Network::GetCurrentPlayerGroupIndex(), Network::Permission::dragPathArea);
}
if (canDrag)
disabledWidgets &= ~(1uLL << WIDX_CONSTRUCT_DRAG_AREA);
else
disabledWidgets |= (1uLL << WIDX_CONSTRUCT_DRAG_AREA);
#endif
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull)
{
widgets[WIDX_RAILINGS_TYPE].type = WidgetType::flatBtn;
@@ -545,7 +555,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
ScreenCoordsXY screenCoords;
WindowDrawWidgets(*this, rt);
@@ -633,7 +643,7 @@ namespace OpenRCT2::Ui::Windows
}
// Update provisional bridge mode path
if (!(_provisionalFootpath.flags.has(ProvisionalPathFlag::placed)))
if (!_provisionalFootpath.flags.has(ProvisionalPathFlag::placed))
{
ObjectEntryIndex type;
ObjectEntryIndex railings = gFootpathSelection.Railings;
@@ -670,17 +680,16 @@ namespace OpenRCT2::Ui::Windows
{
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
}
MapInvalidateTileFull(footpathLoc);
}
}
void WindowFootpathDrawDropdownButtons(RenderTarget& rt)
void WindowFootpathDrawDropdownButtons(Drawing::RenderTarget& rt)
{
if (gFootpathSelection.LegacyPath == kObjectEntryIndexNull)
{
// Set footpath and queue type button images
auto pathImage = kSpriteIdNull;
auto queueImage = kSpriteIdNull;
auto pathImage = kImageIndexUndefined;
auto queueImage = kImageIndexUndefined;
auto pathEntry = GetPathSurfaceEntry(gFootpathSelection.NormalSurface);
if (pathEntry != nullptr)
{
@@ -697,7 +706,7 @@ namespace OpenRCT2::Ui::Windows
WindowFootpathDrawDropdownButton(rt, WIDX_QUEUELINE_TYPE, queueImage);
// Set railing
auto railingsImage = kSpriteIdNull;
auto railingsImage = kImageIndexUndefined;
auto railingsEntry = GetPathRailingsEntry(gFootpathSelection.Railings);
if (railingsEntry != nullptr)
{
@@ -710,8 +719,8 @@ namespace OpenRCT2::Ui::Windows
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
// Set footpath and queue type button images
auto pathImage = kSpriteIdNull;
auto queueImage = kSpriteIdNull;
auto pathImage = kImageIndexUndefined;
auto queueImage = kImageIndexUndefined;
const auto* pathObj = objManager.GetLoadedObject<FootpathObject>(gFootpathSelection.LegacyPath);
if (pathObj != nullptr)
{
@@ -725,7 +734,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void WindowFootpathDrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageIndex image)
void WindowFootpathDrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageIndex image)
{
const auto& widget = widgets[widgetIndex];
GfxDrawSprite(rt, ImageId(image), { windowPos.x + widget.left, windowPos.y + widget.top });
@@ -809,8 +818,8 @@ namespace OpenRCT2::Ui::Windows
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numPathTypes);
WindowDropdownShowImage(
windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numPathTypes, 47,
36, itemsPerRow);
windowPos.x + widget->left, windowPos.y + widget->top, widget->height(), colours[1], 0, numPathTypes, 47, 36,
itemsPerRow);
gDropdown.hasTooltips = true;
@@ -845,8 +854,8 @@ namespace OpenRCT2::Ui::Windows
auto itemsPerRow = DropdownGetAppropriateImageDropdownItemsPerRow(numRailingsTypes);
WindowDropdownShowImage(
windowPos.x + widget->left, windowPos.y + widget->top, widget->height() + 1, colours[1], 0, numRailingsTypes,
47, 36, itemsPerRow);
windowPos.x + widget->left, windowPos.y + widget->top, widget->height(), colours[1], 0, numRailingsTypes, 47,
36, itemsPerRow);
gDropdown.hasTooltips = true;
@@ -1040,7 +1049,6 @@ namespace OpenRCT2::Ui::Windows
*/
void WindowFootpathSetProvisionalPathAtPoint(const ScreenCoordsXY& screenCoords)
{
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
// Get current map pos and handle key modifier state
@@ -1049,7 +1057,7 @@ namespace OpenRCT2::Ui::Windows
return;
// Check for change
if ((_provisionalFootpath.flags.has(ProvisionalPathFlag::placed)) && _provisionalFootpath.positionA == mapPos
if (_provisionalFootpath.flags.has(ProvisionalPathFlag::placed) && _provisionalFootpath.positionA == mapPos
&& _provisionalFootpath.startZ == _footpathPlaceZ)
{
return;
@@ -1107,11 +1115,10 @@ namespace OpenRCT2::Ui::Windows
void WindowFootpathSetProvisionalPathDragArea(MapRange range, int32_t baseZ)
{
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
// Check for change
if ((_provisionalFootpath.flags.has(ProvisionalPathFlag::placed)) && range.Point1 == _provisionalFootpath.positionA
if (_provisionalFootpath.flags.has(ProvisionalPathFlag::placed) && range.Point1 == _provisionalFootpath.positionA
&& range.Point2 == _provisionalFootpath.positionB && baseZ == _provisionalFootpath.startZ)
{
return;
@@ -1146,7 +1153,6 @@ namespace OpenRCT2::Ui::Windows
int32_t direction;
TileElement* tileElement;
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
@@ -1174,8 +1180,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, z };
gMapSelectArrowDirection = direction;
MapInvalidateSelectionRect();
}
FootpathPlacementResult WindowFootpathGetPlacementFromScreenCoords(const ScreenCoordsXY& screenCoords)
@@ -1285,10 +1289,10 @@ namespace OpenRCT2::Ui::Windows
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
tile.position, tile.slope, selectedType, gFootpathSelection.Railings, kInvalidDirection, constructFlags);
auto result = GameActions::Execute(&footpathPlaceAction, getGameState());
if (result.Error == GameActions::Status::Ok)
if (result.error == GameActions::Status::ok)
{
anySuccess = true;
cost += result.Cost;
cost += result.cost;
}
lastLocation = tile.position;
}
@@ -1335,12 +1339,12 @@ namespace OpenRCT2::Ui::Windows
{ *mapPos, placement.baseZ }, placement.slope, selectedType, gFootpathSelection.Railings, kInvalidDirection,
constructFlags);
footpathPlaceAction.SetCallback([this](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
// Don't play sound if it is no cost to prevent multiple sounds. TODO: make this work in no money scenarios
if (result->Cost != 0)
if (result->cost != 0)
{
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->Position);
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->position);
}
}
else
@@ -1429,9 +1433,9 @@ namespace OpenRCT2::Ui::Windows
footpathPlaceAction.SetCallback(
[footpathLoc](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->Position);
Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->position);
}
auto* windowMgr = GetWindowManager();
@@ -1441,7 +1445,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
if (_footpathConstructSlope == SlopePitch::flat)
{
@@ -1602,15 +1606,13 @@ namespace OpenRCT2::Ui::Windows
{
if (_footpathConstructionMode == PathConstructionMode::bridgeOrTunnel)
{
MapInvalidateMapSelectionTiles();
gMapSelectFlags.set(MapSelectFlag::enableConstruct, MapSelectFlag::green);
int32_t direction = _footpathConstructDirection;
gMapSelectionTiles.clear();
gMapSelectionTiles.push_back(
MapSelection::clearSelectedTiles();
MapSelection::addSelectedTile(
{ _footpathConstructFromPosition.x + CoordsDirectionDelta[direction].x,
_footpathConstructFromPosition.y + CoordsDirectionDelta[direction].y });
MapInvalidateMapSelectionTiles();
}
uint64_t newPressedWidgets = pressedWidgets
@@ -1949,14 +1951,14 @@ namespace OpenRCT2::Ui::Windows
{
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
tile.position, tile.slope, type, railingsType, kInvalidDirection, constructFlags);
footpathPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
footpathPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
res = GameActions::Execute(&footpathPlaceAction, getGameState());
// The latter status will be returned if there is already path at the tile in question, to prevent a ghost
// from glitching through the existing path.
if (res.Error == GameActions::Status::Ok || res.Error == GameActions::Status::ItemAlreadyPlaced)
if (res.error == GameActions::Status::ok || res.error == GameActions::Status::itemAlreadyPlaced)
{
succesfulTiles.emplace_back(tile);
cost += res.Cost;
cost += res.cost;
}
}
@@ -2020,7 +2022,7 @@ namespace OpenRCT2::Ui::Windows
for (const auto& tile : _provisionalFootpath.tiles)
{
auto action = GameActions::FootpathRemoveAction(tile.position);
action.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
action.SetFlags({ CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost });
GameActions::Execute(&action, getGameState());
}
}
@@ -2036,7 +2038,6 @@ namespace OpenRCT2::Ui::Windows
_provisionalFootpath.flags.unset(ProvisionalPathFlag::showArrow);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
MapInvalidateTileFull(_footpathConstructFromPosition);
}
FootpathRemoveProvisional();
}
@@ -89,7 +89,7 @@ namespace OpenRCT2::Ui::Windows
: colours[0].colour);
}
void DrawLeftPanel(RenderTarget& rt)
void DrawLeftPanel(Drawing::RenderTarget& rt)
{
const auto& leftPanelWidget = widgets[WIDX_LEFT_OUTSET];
@@ -154,7 +154,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawParkRating(RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor)
void DrawParkRating(Drawing::RenderTarget& rt, int32_t colour, const ScreenCoordsXY& coords, uint8_t factor)
{
int16_t bar_width = (factor * 114) / 255;
Rectangle::fillInset(
@@ -175,7 +175,7 @@ namespace OpenRCT2::Ui::Windows
GfxDrawSprite(rt, ImageId(SPR_RATING_HIGH), coords + ScreenCoordsXY{ 114, 0 });
}
void DrawRightPanel(RenderTarget& rt)
void DrawRightPanel(Drawing::RenderTarget& rt)
{
const auto& rightPanelWidget = widgets[WIDX_RIGHT_OUTSET];
@@ -237,7 +237,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawNewsItem(RenderTarget& rt)
void DrawNewsItem(Drawing::RenderTarget& rt)
{
const auto& middleOutsetWidget = widgets[WIDX_MIDDLE_OUTSET];
auto* newsItem = News::GetItem(0);
@@ -353,7 +353,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawMiddlePanel(RenderTarget& rt)
void DrawMiddlePanel(Drawing::RenderTarget& rt)
{
Widget* middleOutsetWidget = &widgets[WIDX_MIDDLE_OUTSET];
@@ -620,7 +620,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
const auto& leftWidget = widgets[WIDX_LEFT_OUTSET];
const auto& rightWidget = widgets[WIDX_RIGHT_OUTSET];
+24 -27
View File
@@ -356,7 +356,7 @@ namespace OpenRCT2::Ui::Windows
onViewportRotateOverview();
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -419,7 +419,7 @@ namespace OpenRCT2::Ui::Windows
onScrollMouseDownRides(scrollIndex, screenCoords);
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (page == WINDOW_GUEST_RIDES)
{
@@ -543,14 +543,14 @@ namespace OpenRCT2::Ui::Windows
#pragma region Overview
void OverviewTabDraw(RenderTarget& rt)
void OverviewTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_1))
return;
const auto& widget = widgets[WIDX_TAB_1];
int32_t widgWidth = widget.width() - 2;
int32_t widgHeight = widget.height() - 1;
int32_t widgHeight = widget.height() - 2;
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
if (page == WINDOW_GUEST_OVERVIEW)
widgHeight++;
@@ -625,7 +625,7 @@ namespace OpenRCT2::Ui::Windows
{
const auto& widget = widgets[WIDX_VIEWPORT];
const auto reqViewportWidth = widget.width() - 2;
const auto reqViewportHeight = widget.height() - 1;
const auto reqViewportHeight = widget.height() - 2;
viewport->pos = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight)
{
@@ -661,7 +661,7 @@ namespace OpenRCT2::Ui::Windows
Network::GetCurrentPlayerId() };
pickupAction.SetCallback(
[peepnum = number](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
return;
auto* windowMgr = GetWindowManager();
WindowBase* wind = windowMgr->FindByNumber(WindowClass::peep, peepnum);
@@ -728,7 +728,7 @@ namespace OpenRCT2::Ui::Windows
};
WindowDropdownShowText(
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, dropdownItems);
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, dropdownItems);
gDropdown.defaultIndex = 0;
}
@@ -767,7 +767,7 @@ namespace OpenRCT2::Ui::Windows
const auto& viewWidget = widgets[WIDX_VIEWPORT];
auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y };
int32_t widgWidth = viewWidget.width() - 2;
int32_t widgHeight = viewWidget.height() - 1;
int32_t widgHeight = viewWidget.height() - 2;
ViewportCreate(*this, screenPos, widgWidth, widgHeight, focus.value());
if (viewport != nullptr && reCreateViewport)
@@ -780,7 +780,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
void onDrawOverview(RenderTarget& rt)
void onDrawOverview(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -823,7 +823,7 @@ namespace OpenRCT2::Ui::Windows
auto marqWidth = marqueeWidget.width() - 4;
int32_t left = marqueeWidget.left + 2 + windowPos.x;
int32_t top = marqueeWidget.top + windowPos.y;
int32_t marqHeight = marqueeWidget.height();
int32_t marqHeight = marqueeWidget.height() - 1;
RenderTarget rtMarquee;
if (!ClipDrawPixelInfo(rtMarquee, rt, { left, top }, marqWidth, marqHeight))
{
@@ -977,8 +977,6 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex != WIDX_PICKUP)
return;
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
@@ -988,7 +986,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectType = MapSelectType::full;
gMapSelectPositionA = mapCoords;
gMapSelectPositionB = mapCoords;
MapInvalidateSelectionRect();
}
gPickupPeepImage = ImageId();
@@ -1030,7 +1027,7 @@ namespace OpenRCT2::Ui::Windows
{ destCoords, tileElement->GetBaseZ() },
Network::GetCurrentPlayerId() };
pickupAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
return;
ToolCancel();
gPickupPeepImage = ImageId();
@@ -1053,7 +1050,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Stats
void StatsTabDraw(RenderTarget& rt)
void StatsTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_2))
return;
@@ -1110,7 +1107,7 @@ namespace OpenRCT2::Ui::Windows
return std::clamp(newValue, newMin, 100);
}
void onDrawStats(RenderTarget& rt)
void onDrawStats(Drawing::RenderTarget& rt)
{
// ebx
const auto peep = GetGuest();
@@ -1209,7 +1206,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Rides
void RidesTabDraw(RenderTarget& rt)
void RidesTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_3))
return;
@@ -1318,7 +1315,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_RIDE_SCROLL].bottom = height - 15;
}
void onDrawRides(RenderTarget& rt)
void onDrawRides(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1355,7 +1352,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, screenCoords, width - 14, STR_FAVOURITE_RIDE, ft);
}
void onScrollDrawRides(int32_t scrollIndex, RenderTarget& rt)
void onScrollDrawRides(int32_t scrollIndex, Drawing::RenderTarget& rt)
{
auto colour = ColourMapA[colours[1].colour].mid_light;
Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, colour);
@@ -1382,7 +1379,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Finance
void FinanceTabDraw(RenderTarget& rt)
void FinanceTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_4))
return;
@@ -1408,7 +1405,7 @@ namespace OpenRCT2::Ui::Windows
invalidateWidget(WIDX_TAB_4);
}
void onDrawFinance(RenderTarget& rt)
void onDrawFinance(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1520,7 +1517,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Thoughts
void ThoughtsTabDraw(RenderTarget& rt)
void ThoughtsTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_5))
return;
@@ -1557,7 +1554,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDrawThoughts(RenderTarget& rt)
void onDrawThoughts(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1598,7 +1595,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Inventory
void InventoryTabDraw(RenderTarget& rt)
void InventoryTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_6))
return;
@@ -1738,7 +1735,7 @@ namespace OpenRCT2::Ui::Windows
return std::make_pair(itemImage, ft);
}
void onDrawInventory(RenderTarget& rt)
void onDrawInventory(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
OverviewTabDraw(rt);
@@ -1788,7 +1785,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Debug
void DebugTabDraw(RenderTarget& rt)
void DebugTabDraw(Drawing::RenderTarget& rt)
{
if (widgetIsDisabled(*this, WIDX_TAB_7))
return;
@@ -1811,7 +1808,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
void onDrawDebug(RenderTarget& rt)
void onDrawDebug(Drawing::RenderTarget& rt)
{
char buffer[512]{};
char buffer2[512]{};
+7 -7
View File
@@ -335,7 +335,7 @@ namespace OpenRCT2::Ui::Windows
auto* widget = &widgets[widgetIndex - 1];
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, _numPages, widget->width() - 4);
for (size_t i = 0; i < _numPages; i++)
@@ -354,7 +354,7 @@ namespace OpenRCT2::Ui::Windows
auto* widget = &widgets[widgetIndex - 1];
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, 2, widget->width() - 4);
gDropdown.items[static_cast<int32_t>(_selectedView)].setChecked(true);
@@ -427,7 +427,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -573,7 +573,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
Rectangle::fill(
rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light);
@@ -626,7 +626,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
// Tab 1 image
auto i = (_selectedTab == TabId::Individual ? _tabAnimationIndex & ~3 : 0);
@@ -643,7 +643,7 @@ namespace OpenRCT2::Ui::Windows
windowPos + ScreenCoordsXY{ widgets[WIDX_TAB_2].left, widgets[WIDX_TAB_2].top });
}
void DrawScrollIndividual(RenderTarget& rt)
void DrawScrollIndividual(Drawing::RenderTarget& rt)
{
size_t index = 0;
auto y = static_cast<int32_t>(_selectedPage) * -kGuestPageHeight;
@@ -710,7 +710,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawScrollSummarised(RenderTarget& rt)
void DrawScrollSummarised(Drawing::RenderTarget& rt)
{
size_t index = 0;
auto y = 0;
+2 -2
View File
@@ -149,7 +149,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -163,7 +163,7 @@ namespace OpenRCT2::Ui::Windows
g1temp.offset = _trackDesignPreviewPixels.data() + (_currentTrackPieceDirection * kTrackPreviewImageSize);
g1temp.width = 370;
g1temp.height = 217;
g1temp.flags = G1_FLAG_HAS_TRANSPARENCY;
g1temp.flags = { G1Flag::hasTransparency };
GfxSetG1Element(SPR_TEMP, &g1temp);
DrawingEngineInvalidateImage(SPR_TEMP);
GfxDrawSprite(rt, ImageId(SPR_TEMP), screenPos);
+38 -37
View File
@@ -32,6 +32,8 @@
#include <openrct2/world/MapSelection.h>
#include <openrct2/world/Park.h>
using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Ui::Windows
{
static constexpr StringId kWindowTitle = STR_LAND;
@@ -51,6 +53,12 @@ namespace OpenRCT2::Ui::Windows
WIDX_WALL,
};
enum class SelectionMode
{
query,
apply,
};
// clang-format off
static constexpr auto window_land_widgets = makeWidgets(
makeWindowShim(kWindowTitle, kWindowSize),
@@ -251,7 +259,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
ScreenCoordsXY screenCoords;
int32_t numTiles;
@@ -331,7 +339,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006644DD
*/
money64 SelectionRaiseLand(uint8_t flag)
money64 SelectionRaiseLand(const SelectionMode mode)
{
int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
@@ -346,25 +354,25 @@ namespace OpenRCT2::Ui::Windows
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gMapSelectType, false);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction, gameState)
: GameActions::Query(&landSmoothAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landSmoothAction, gameState)
: GameActions::Query(&landSmoothAction, gameState);
return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
auto landRaiseAction = GameActions::LandRaiseAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landRaiseAction, gameState)
: GameActions::Query(&landRaiseAction, gameState);
auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landRaiseAction, gameState)
: GameActions::Query(&landRaiseAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
/**
*
* rct2: 0x006645B3
*/
money64 SelectionLowerLand(uint8_t flag)
money64 SelectionLowerLand(const SelectionMode mode)
{
int32_t centreX = (gMapSelectPositionA.x + gMapSelectPositionB.x) / 2;
int32_t centreY = (gMapSelectPositionA.y + gMapSelectPositionB.y) / 2;
@@ -379,18 +387,18 @@ namespace OpenRCT2::Ui::Windows
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y },
gMapSelectType, true);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landSmoothAction, gameState)
: GameActions::Query(&landSmoothAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landSmoothAction, gameState)
: GameActions::Query(&landSmoothAction, gameState);
return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
auto landLowerAction = GameActions::LandLowerAction(
{ centreX, centreY },
{ gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, gMapSelectType);
auto res = (flag & GAME_COMMAND_FLAG_APPLY) ? GameActions::Execute(&landLowerAction, gameState)
: GameActions::Query(&landLowerAction, gameState);
auto res = (mode == SelectionMode::apply) ? GameActions::Execute(&landLowerAction, gameState)
: GameActions::Query(&landLowerAction, gameState);
return res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
return res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
/**
@@ -424,7 +432,7 @@ namespace OpenRCT2::Ui::Windows
{
gInputDragLast.y += tile_height;
SelectionRaiseLand(GAME_COMMAND_FLAG_APPLY);
SelectionRaiseLand(SelectionMode::apply);
_landToolRaiseCost = kMoney64Undefined;
_landToolLowerCost = kMoney64Undefined;
@@ -433,7 +441,7 @@ namespace OpenRCT2::Ui::Windows
{
gInputDragLast.y -= tile_height;
SelectionLowerLand(GAME_COMMAND_FLAG_APPLY);
SelectionLowerLand(SelectionMode::apply);
_landToolRaiseCost = kMoney64Undefined;
_landToolLowerCost = kMoney64Undefined;
@@ -444,7 +452,6 @@ namespace OpenRCT2::Ui::Windows
{
uint8_t state_changed = 0;
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
@@ -454,7 +461,7 @@ namespace OpenRCT2::Ui::Windows
return state_changed;
}
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -501,7 +508,6 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
MapInvalidateSelectionRect();
return state_changed;
}
@@ -582,7 +588,6 @@ namespace OpenRCT2::Ui::Windows
switch (widgetIndex)
{
case WIDX_BACKGROUND:
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
gCurrentToolId = Tool::digDown;
break;
@@ -609,15 +614,13 @@ namespace OpenRCT2::Ui::Windows
const bool mapCtrlPressed = GetInputManager().isModifierKeyPressed(ModifierKey::ctrl);
auto* windowMgr = Ui::GetWindowManager();
MapInvalidateSelectionRect();
if (gCurrentToolId == Tool::upDownArrow)
{
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
if (!gMapSelectFlags.has(MapSelectFlag::enable))
return;
money64 lower_cost = SelectionLowerLand(0);
money64 raise_cost = SelectionRaiseLand(0);
money64 lower_cost = SelectionLowerLand(SelectionMode::query);
money64 raise_cost = SelectionRaiseLand(SelectionMode::query);
if (_landToolRaiseCost != raise_cost || _landToolLowerCost != lower_cost)
{
@@ -657,7 +660,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t state_changed = 0;
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -700,12 +703,11 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
MapInvalidateSelectionRect();
if (!state_changed)
return;
money64 lower_cost = SelectionLowerLand(0);
money64 raise_cost = SelectionRaiseLand(0);
money64 lower_cost = SelectionLowerLand(SelectionMode::query);
money64 raise_cost = SelectionRaiseLand(SelectionMode::query);
if (_landToolRaiseCost != raise_cost || _landToolLowerCost != lower_cost)
{
@@ -735,7 +737,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t state_changed = 0;
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -827,12 +829,11 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
MapInvalidateSelectionRect();
if (!state_changed)
return;
money64 lower_cost = SelectionLowerLand(0);
money64 raise_cost = SelectionRaiseLand(0);
money64 lower_cost = SelectionLowerLand(SelectionMode::query);
money64 raise_cost = SelectionRaiseLand(SelectionMode::query);
if (_landToolRaiseCost != raise_cost || _landToolLowerCost != lower_cost)
{
@@ -842,7 +843,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawDropdownButtons(RenderTarget& rt)
void DrawDropdownButtons(Drawing::RenderTarget& rt)
{
auto& objManager = GetContext()->GetObjectManager();
const auto* surfaceObj = objManager.GetLoadedObject<TerrainSurfaceObject>(_selectedFloorTexture);
@@ -865,7 +866,7 @@ namespace OpenRCT2::Ui::Windows
DrawDropdownButton(rt, WIDX_WALL, edgeImage);
}
void DrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
void DrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
{
const auto& widget = widgets[widgetIndex];
GfxDrawSprite(rt, image, { windowPos.x + widget.left, windowPos.y + widget.top });
@@ -894,7 +895,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
auto* toolWindow = ContextOpenWindow(WindowClass::land);
ToolSet(*toolWindow, WIDX_BACKGROUND, Tool::digDown);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
}
} // namespace OpenRCT2::Ui::Windows
+4 -7
View File
@@ -109,7 +109,6 @@ namespace OpenRCT2::Ui::Windows
_landRightsMode = mode;
ToolSet(*this, widgetIndex, Tool::upArrow);
gInputFlags.set(InputFlag::unk6);
if (kLandRightsVisibleByMode[EnumValue(mode)])
ShowLandRights();
@@ -393,7 +392,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
auto screenCoords = ScreenCoordsXY{ windowPos.x + widgets[WIDX_PREVIEW].midX(),
windowPos.y + widgets[WIDX_PREVIEW].midY() };
@@ -459,7 +458,6 @@ namespace OpenRCT2::Ui::Windows
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
{
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto info = GetMapCoordinatesFromPos(
@@ -479,7 +477,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t state_changed = 0;
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
if (!gMapSelectFlags.has(MapSelectFlag::enable))
{
gMapSelectFlags.set(MapSelectFlag::enable);
state_changed++;
@@ -529,7 +527,6 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
MapInvalidateSelectionRect();
if (!state_changed)
return;
@@ -538,13 +535,13 @@ namespace OpenRCT2::Ui::Windows
{
auto landSetRightsAction = GetLandSetAction();
auto res = GameActions::Query(&landSetRightsAction, gameState);
_landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
_landRightsCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
else
{
auto landBuyRightsAction = GetLandBuyAction();
auto res = GameActions::Query(&landBuyRightsAction, gameState);
_landRightsCost = res.Error == GameActions::Status::Ok ? res.Cost : kMoney64Undefined;
_landRightsCost = res.error == GameActions::Status::ok ? res.cost : kMoney64Undefined;
}
}
+4 -4
View File
@@ -404,7 +404,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawPreview(RenderTarget& rt)
void DrawPreview(Drawing::RenderTarget& rt)
{
// Find preview image to draw
PreviewImage* image = nullptr;
@@ -731,7 +731,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -919,7 +919,7 @@ namespace OpenRCT2::Ui::Windows
Widget* widget = &widgets[WIDX_SORT_CUSTOMISE];
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left - 70, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
{ windowPos.x + widget->left - 70, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, 7, 90);
auto& config = Config::Get().general;
@@ -1077,7 +1077,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
Rectangle::fill(
rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, ColourMapA[colours[1].colour].mid_light);
+1 -1
View File
@@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows
WindowFootpathResetSelectedPath();
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
ViewportRender(rt, viewport);
}
+11 -13
View File
@@ -449,7 +449,6 @@ namespace OpenRCT2::Ui::Windows
{
int32_t direction;
TileElement* tileElement;
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
if (mapCoords.IsNull())
@@ -470,7 +469,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectPositionB = mapCoords;
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, mapZ };
gMapSelectArrowDirection = DirectionReverse(direction);
MapInvalidateSelectionRect();
}
void SetPeepSpawnToolDown(const ScreenCoordsXY& screenCoords)
@@ -486,9 +484,9 @@ namespace OpenRCT2::Ui::Windows
auto gameAction = GameActions::PeepSpawnPlaceAction({ mapCoords, mapZ, static_cast<Direction>(direction) });
auto result = GameActions::Execute(&gameAction, getGameState());
if (result.Error == GameActions::Status::Ok)
if (result.error == GameActions::Status::ok)
{
Audio::Play3D(Audio::SoundId::placeItem, result.Position);
Audio::Play3D(Audio::SoundId::placeItem, result.position);
}
}
@@ -535,7 +533,7 @@ namespace OpenRCT2::Ui::Windows
auto& mapArea = widgets[WIDX_MAP];
if (size.width >= mapArea.width() - 1)
size.width -= kScrollBarWidth;
if (size.height >= mapArea.height())
if (size.height >= mapArea.height() - 1)
size.height -= kScrollBarWidth;
return size;
@@ -568,7 +566,7 @@ namespace OpenRCT2::Ui::Windows
onScrollMouseDown(scrollIndex, screenCoords);
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
GfxClear(rt, PaletteIndex::pi10);
@@ -663,7 +661,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -739,7 +737,7 @@ namespace OpenRCT2::Ui::Windows
// calculate width and height of minimap
auto& widget = widgets[WIDX_MAP];
auto mapWidth = widget.width() - 1 - kScrollBarWidth - 1;
auto mapHeight = widget.height() - kScrollBarWidth - 1;
auto mapHeight = widget.height() - 1 - kScrollBarWidth - 1;
centreX = std::max(centreX - (mapWidth >> 1), 0);
centreY = std::max(centreY - (mapHeight >> 1), 0);
@@ -949,7 +947,7 @@ namespace OpenRCT2::Ui::Windows
return colourB;
}
void PaintPeepOverlay(RenderTarget& rt, const ScreenCoordsXY& offset)
void PaintPeepOverlay(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
auto flashColour = GetGuestFlashColour();
for (auto guest : EntityList<Guest>())
@@ -963,7 +961,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, RenderTarget& rt, const ScreenCoordsXY& offset)
void DrawMapPeepPixel(Peep* peep, const uint8_t flashColour, Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
if (peep->x == kLocationNull)
return;
@@ -1009,7 +1007,7 @@ namespace OpenRCT2::Ui::Windows
return colour;
}
void PaintTrainOverlay(RenderTarget& rt, const ScreenCoordsXY& offset)
void PaintTrainOverlay(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
for (auto train : TrainManager::View())
{
@@ -1031,7 +1029,7 @@ namespace OpenRCT2::Ui::Windows
* The call to Rectangle::fill was originally wrapped in Sub68DABD which made sure that arguments were ordered
* correctly, but it doesn't look like it's ever necessary here so the call was removed.
*/
void PaintHudRectangle(RenderTarget& rt, const ScreenCoordsXY& widgetOffset)
void PaintHudRectangle(Drawing::RenderTarget& rt, const ScreenCoordsXY& widgetOffset)
{
WindowBase* mainWindow = WindowGetMain();
if (mainWindow == nullptr)
@@ -1069,7 +1067,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::fill(rt, { rightBottom - ScreenCoordsXY{ 0, 3 }, rightBottom }, PaletteIndex::pi56);
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
// Guest tab image (animated)
uint32_t guestTabImage = SPR_TAB_GUESTS_0;
+12 -12
View File
@@ -299,7 +299,7 @@ namespace OpenRCT2::Ui::Windows
pressedWidgets |= 1LL << (WIDX_TAB_1 + page);
}
void DrawTabImage(RenderTarget& rt, int32_t newPage, int32_t spriteIndex)
void DrawTabImage(Drawing::RenderTarget& rt, int32_t newPage, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + newPage;
@@ -317,7 +317,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_MAPGEN_PAGE_BASE, SPR_TAB_GEARS_0);
DrawTabImage(rt, WINDOW_MAPGEN_PAGE_TERRAIN, SPR_G2_MAP_GEN_TERRAIN_TAB);
@@ -461,7 +461,7 @@ namespace OpenRCT2::Ui::Windows
Widget* ddWidget = &widgets[widgetIndex - 1];
WindowDropdownShowTextCustomWidth(
{ windowPos.x + ddWidget->left, windowPos.y + ddWidget->top }, ddWidget->height() + 1, colours[1], 0,
{ windowPos.x + ddWidget->left, windowPos.y + ddWidget->top }, ddWidget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, std::size(items), ddWidget->width() - 3);
gDropdown.items[EnumValue(_settings.algorithm)].setChecked(true);
@@ -597,7 +597,7 @@ namespace OpenRCT2::Ui::Windows
// clang-format on
}
void BaseDraw(RenderTarget& rt)
void BaseDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -759,7 +759,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetDisabled(WIDX_TREE_ALTITUDE_MAX_DOWN, !_settings.trees || isFlatland);
}
void ForestsDraw(RenderTarget& rt)
void ForestsDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -863,7 +863,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void SimplexDraw(RenderTarget& rt)
void SimplexDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -973,7 +973,7 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_HEIGHTMAP_NORMALIZE, _settings.normalize_height);
}
void HeightmapDraw(RenderTarget& rt)
void HeightmapDraw(Drawing::RenderTarget& rt)
{
const auto enabledColour = colours[1];
const auto disabledColour = enabledColour.withFlag(ColourFlag::inset, true);
@@ -1159,7 +1159,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawDropdownButton(RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
void DrawDropdownButton(Drawing::RenderTarget& rt, WidgetIndex widgetIndex, ImageId image)
{
const auto& widget = widgets[widgetIndex];
ScreenCoordsXY pos = { windowPos.x + widget.left, windowPos.y + widget.top };
@@ -1181,7 +1181,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawDropdownButtons(RenderTarget& rt, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex)
void DrawDropdownButtons(Drawing::RenderTarget& rt, WidgetIndex floorWidgetIndex, WidgetIndex edgeWidgetIndex)
{
auto& objManager = GetContext()->GetObjectManager();
const auto* surfaceObj = objManager.GetLoadedObject<TerrainSurfaceObject>(_settings.landTexture);
@@ -1223,7 +1223,7 @@ namespace OpenRCT2::Ui::Windows
SetPressedTab();
}
void TerrainDraw(RenderTarget& rt)
void TerrainDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1334,7 +1334,7 @@ namespace OpenRCT2::Ui::Windows
SetPressedTab();
}
void WaterDraw(RenderTarget& rt)
void WaterDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1446,7 +1446,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
+2 -2
View File
@@ -46,7 +46,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
StringId stringId;
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId));
@@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows
// Check for cursor movement
_cursorHoldDuration++;
if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || (gInputFlags.has(InputFlag::rightMousePressed))
if (abs(cursorChange.x) > 5 || abs(cursorChange.y) > 5 || gInputFlags.has(InputFlag::rightMousePressed)
|| InputGetState() == InputState::ViewportRight)
_cursorHoldDuration = 0;
+17 -14
View File
@@ -32,6 +32,10 @@
#include <openrct2/world/MapSelection.h>
#include <openrct2/world/tile_element/EntranceElement.h>
using OpenRCT2::GameActions::CommandFlag;
using OpenRCT2::GameActions::CommandFlags;
using OpenRCT2::GameActions::MazeBuildMode;
namespace OpenRCT2::Ui::Windows
{
#pragma region Widgets
@@ -118,7 +122,6 @@ namespace OpenRCT2::Ui::Windows
RideConstructionInvalidateCurrentTrack();
ViewportSetVisibility(ViewportVisibility::standard);
MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -134,7 +137,7 @@ namespace OpenRCT2::Ui::Windows
if (currentRide->overallView.IsNull())
{
auto gameAction = GameActions::RideDemolishAction(currentRide->id, GameActions::RideModifyType::demolish);
gameAction.SetFlags(GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
gameAction.SetFlags({ CommandFlag::allowDuringPaused });
GameActions::Execute(&gameAction, getGameState());
}
else
@@ -302,7 +305,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
@@ -317,7 +320,7 @@ namespace OpenRCT2::Ui::Windows
: ENTRANCE_TYPE_RIDE_EXIT;
gRideEntranceExitPlaceRideIndex = rideId;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
RideConstructionInvalidateCurrentTrack();
@@ -344,8 +347,6 @@ namespace OpenRCT2::Ui::Windows
{
RideConstructionInvalidateCurrentTrack();
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
@@ -364,10 +365,10 @@ namespace OpenRCT2::Ui::Windows
rideEntranceExitPlaceAction.SetCallback([=, this](
const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
return;
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->Position);
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::placeItem, result->position);
auto* windowMgr = Ui::GetWindowManager();
@@ -399,7 +400,9 @@ namespace OpenRCT2::Ui::Windows
void WindowMazeConstructionConstruct(int32_t direction)
{
int32_t x, y, z, actionFlags = 0, mode;
int32_t x, y, z;
MazeBuildMode mode;
CommandFlags actionFlags = {};
_currentTrackSelectionFlags.clearAll();
_rideConstructionNextArrowPulse = 0;
@@ -412,15 +415,15 @@ namespace OpenRCT2::Ui::Windows
switch (_rideConstructionState)
{
case RideConstructionState::MazeBuild:
mode = GC_SET_MAZE_TRACK_BUILD;
mode = MazeBuildMode::build;
break;
case RideConstructionState::MazeMove:
mode = GC_SET_MAZE_TRACK_MOVE;
actionFlags = GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED;
mode = MazeBuildMode::move;
actionFlags = { CommandFlag::allowDuringPaused };
break;
default:
case RideConstructionState::MazeFill:
mode = GC_SET_MAZE_TRACK_FILL;
mode = MazeBuildMode::fill;
break;
}
@@ -428,7 +431,7 @@ namespace OpenRCT2::Ui::Windows
auto action = GameActions::MazeSetTrackAction(loc, false, _currentRideIndex, mode);
action.SetFlags(actionFlags);
const auto res = GameActions::Execute(&action, getGameState());
if (res.Error != GameActions::Status::Ok)
if (res.error != GameActions::Status::ok)
{
return;
}
+11 -11
View File
@@ -166,8 +166,8 @@ namespace OpenRCT2::Ui::Windows
auto numItems = Network::GetNumGroups();
WindowDropdownShowTextCustomWidth(
windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
windowPos + ScreenCoordsXY{ dropdownWidget->left, dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, 0, numItems, widget->right - dropdownWidget->left);
for (auto i = 0; i < Network::GetNumGroups(); i++)
{
@@ -183,7 +183,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void informationPaint(RenderTarget& rt)
void informationPaint(Drawing::RenderTarget& rt)
{
RenderTarget clippedDPI;
if (ClipDrawPixelInfo(clippedDPI, rt, windowPos, width, height))
@@ -236,7 +236,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void playersPaint(RenderTarget& rt)
void playersPaint(Drawing::RenderTarget& rt)
{
// Number of players
StringId stringId = numListItems == 1 ? STR_MULTIPLAYER_PLAYER_COUNT : STR_MULTIPLAYER_PLAYER_COUNT_PLURAL;
@@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, screenCoords, stringId, ft, { colours[2] });
}
void playersScrollPaint(int32_t scrollIndex, RenderTarget& rt) const
void playersScrollPaint(int32_t scrollIndex, Drawing::RenderTarget& rt) const
{
ScreenCoordsXY screenCoords;
screenCoords.y = 0;
@@ -346,7 +346,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void groupsPaint(RenderTarget& rt)
void groupsPaint(Drawing::RenderTarget& rt)
{
thread_local std::string _buffer;
@@ -389,7 +389,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void groupsScrollPaint(int32_t scrollIndex, RenderTarget& rt) const
void groupsScrollPaint(int32_t scrollIndex, Drawing::RenderTarget& rt) const
{
auto screenCoords = ScreenCoordsXY{ 0, 0 };
@@ -432,7 +432,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void drawTabImage(RenderTarget& rt, int32_t page_number, int32_t spriteIndex)
void drawTabImage(Drawing::RenderTarget& rt, int32_t page_number, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB1 + page_number;
@@ -454,7 +454,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void drawTabImages(RenderTarget& rt)
void drawTabImages(Drawing::RenderTarget& rt)
{
drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_INFORMATION, SPR_TAB_KIOSKS_AND_FACILITIES_0);
drawTabImage(rt, WINDOW_MULTIPLAYER_PAGE_PLAYERS, SPR_TAB_GUESTS_0);
@@ -704,7 +704,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
drawTabImages(rt);
@@ -900,7 +900,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
switch (page)
{
+1 -1
View File
@@ -86,7 +86,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
thread_local std::string _buffer;
+5 -6
View File
@@ -220,7 +220,7 @@ namespace OpenRCT2::Ui::Windows
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top },
dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems,
dropdownWidget->height(), colours[1], 0, Dropdown::Flag::StayOpen, numItems,
dropdownWidget->width() - 4);
}
}
@@ -240,9 +240,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top },
dropdownWidget->height() + 1, colours[1], 0, Dropdown::Flag::StayOpen, numItems,
dropdownWidget->width() - 4);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 4);
}
break;
// In RCT2, the maximum was 6 weeks
@@ -269,7 +268,7 @@ namespace OpenRCT2::Ui::Windows
auto gameAction = GameActions::ParkMarketingAction(
Campaign.campaign_type, Campaign.RideId.ToUnderlying(), Campaign.no_weeks);
gameAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
auto* windowMgr = Ui::GetWindowManager();
windowMgr->CloseByClass(WindowClass::newCampaign);
@@ -354,7 +353,7 @@ namespace OpenRCT2::Ui::Windows
widgetSetDisabled(*this, WIDX_START_BUTTON, true);
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
ScreenCoordsXY screenCoords{};
+6 -5
View File
@@ -430,7 +430,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_GROUP_BY_TRACK_TYPE].left = width - 8 - localizedGroupByTrackTypeWidth;
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -488,7 +488,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
if (_currentTab == RESEARCH_TAB)
{
@@ -941,7 +941,8 @@ namespace OpenRCT2::Ui::Windows
widgetScrollUpdateThumbs(*this, WIDX_RIDE_LIST);
}
void DrawRideInformation(RenderTarget& rt, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth)
void DrawRideInformation(
Drawing::RenderTarget& rt, RideSelection item, const ScreenCoordsXY& screenPos, int32_t textWidth)
{
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
const auto* rideObj = objMgr.GetLoadedObject<RideObject>(item.EntryIndex);
@@ -1027,7 +1028,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImage(RenderTarget& rt, NewRideTabId tab, int32_t spriteIndex)
void DrawTabImage(Drawing::RenderTarget& rt, NewRideTabId tab, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast<int32_t>(tab);
@@ -1045,7 +1046,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, TRANSPORT_TAB, SPR_TAB_RIDES_TRANSPORT_0);
DrawTabImage(rt, GENTLE_TAB, SPR_TAB_RIDES_GENTLE_0);
+6 -6
View File
@@ -128,7 +128,7 @@ namespace OpenRCT2::Ui::Windows
auto& widget = widgets[WIDX_SCROLL];
ScreenSize scrollSize = onScrollGetSize(0);
scrolls[0].contentOffsetY = std::max(0, scrollSize.height - (widget.height() - 1));
scrolls[0].contentOffsetY = std::max(0, scrollSize.height - (widget.height() - 2));
widgetScrollUpdateThumbs(*this, WIDX_SCROLL);
}
@@ -178,7 +178,7 @@ namespace OpenRCT2::Ui::Windows
groupWidgetsToInsert.emplace_back(groupWidget);
lastGroup = def.group;
y += groupWidget.height();
y += groupWidget.height() - 1;
}
// Create checkbox widgets
@@ -260,7 +260,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(WIDX_TAB_OPTIONS, page == optionsTab);
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
if (!isWidgetDisabled(WIDX_TAB_NEWS))
{
@@ -308,7 +308,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -441,7 +441,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
int32_t lineHeight = FontGetLineHeight(FontStyle::small);
int32_t itemHeight = CalculateNewsItemHeight();
@@ -450,7 +450,7 @@ namespace OpenRCT2::Ui::Windows
const auto backgroundPaletteIndex = ColourMapA[colours[3].colour].light;
// Fill the scrollbar gap if no scrollbar is visible
const bool scrollbarVisible = scrolls[0].contentHeight > widgets[WIDX_SCROLL].height();
const bool scrollbarVisible = scrolls[0].contentHeight > widgets[WIDX_SCROLL].height() - 1;
const auto scrollbarFill = scrollbarVisible ? 0 : kScrollBarWidth;
for (const auto& newsItem : getGameState().newsItems.GetArchived())
+2 -2
View File
@@ -492,7 +492,7 @@ namespace OpenRCT2::Ui::Windows
invalidateWidget(WIDX_SCROLL);
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
@@ -510,7 +510,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, screenPos + ScreenCoordsXY{ 0, 29 }, kWindowSize.width - 5, STR_BLACK_STRING, ft);
}
void onScrollDraw(const int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(const int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
+17 -15
View File
@@ -31,6 +31,7 @@
#include <openrct2/core/File.h>
#include <openrct2/core/String.hpp>
#include <openrct2/drawing/IDrawingEngine.h>
#include <openrct2/drawing/ScrollingText.h>
#include <openrct2/localisation/Currency.h>
#include <openrct2/localisation/Formatter.h>
#include <openrct2/localisation/Language.h>
@@ -627,7 +628,7 @@ namespace OpenRCT2::Ui::Windows
CommonPrepareDrawAfter();
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1018,7 +1019,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_FRAME_RATE_LIMIT].text = kFrameRateLimitStringIds[activeItem];
}
void DisplayDraw(RenderTarget& rt)
void DisplayDraw(Drawing::RenderTarget& rt)
{
auto ft = Formatter();
ft.Add<int32_t>(static_cast<int32_t>(Config::Get().general.windowScale * 100));
@@ -1072,7 +1073,7 @@ namespace OpenRCT2::Ui::Windows
Config::Get().general.upperCaseBanners ^= 1;
Config::Save();
invalidate();
ScrollingTextInvalidate();
Drawing::ScrollingText::invalidate();
break;
case WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX:
Config::Get().general.disableLightningEffect ^= 1;
@@ -1802,7 +1803,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
gDropdown.items[static_cast<int32_t>(ThemeManagerGetAvailableThemeIndex())].setChecked(true);
@@ -1916,7 +1917,7 @@ namespace OpenRCT2::Ui::Windows
numItems++;
WindowDropdownShowText(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1],
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1],
Dropdown::Flag::StayOpen, numItems);
auto selectedIndex = Config::Get().interface.randomTitleSequence
@@ -1933,7 +1934,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::MenuLabel(STR_SCENARIO_PREVIEWS_SCREENSHOTS);
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, numItems, widget->width() - 4);
gDropdown.items[Config::Get().interface.scenarioPreviewScreenshots].setChecked(true);
@@ -1946,7 +1947,8 @@ namespace OpenRCT2::Ui::Windows
}
ShowDropdown(widget, 7);
gDropdown.items[Config::Get().general.defaultInspectionInterval].setChecked(true);
auto selectedIndex = EnumValue(Config::Get().general.defaultInspectionInterval);
gDropdown.items[selectedIndex].setChecked(true);
break;
}
}
@@ -1974,9 +1976,9 @@ namespace OpenRCT2::Ui::Windows
break;
}
case WIDX_DEFAULT_INSPECTION_INTERVAL_DROPDOWN:
if (dropdownIndex != Config::Get().general.defaultInspectionInterval)
if (dropdownIndex != EnumValue(Config::Get().general.defaultInspectionInterval))
{
Config::Get().general.defaultInspectionInterval = static_cast<uint8_t>(dropdownIndex);
Config::Get().general.defaultInspectionInterval = static_cast<RideInspection>(dropdownIndex);
Config::Save();
invalidate();
}
@@ -2039,8 +2041,8 @@ namespace OpenRCT2::Ui::Windows
setCheckboxValue(WIDX_SCENARIO_UNLOCKING, Config::Get().general.scenarioUnlockingEnabled);
widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames
[Config::Get().general.defaultInspectionInterval];
auto selectedIndex = EnumValue(Config::Get().general.defaultInspectionInterval);
widgets[WIDX_DEFAULT_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames[selectedIndex];
}
#pragma endregion
@@ -2223,7 +2225,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_ASSET_PACKS].bottom = widgets[WIDX_GROUP_ADVANCED].bottom - 6;
}
void AdvancedDraw(RenderTarget& rt)
void AdvancedDraw(Drawing::RenderTarget& rt)
{
auto ft = Formatter();
ft.Add<int32_t>(static_cast<int32_t>(Config::Get().general.autosaveAmount));
@@ -2296,11 +2298,11 @@ namespace OpenRCT2::Ui::Windows
{
// helper function, all dropdown boxes have similar properties
WindowDropdownShowTextCustomWidth(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0,
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0,
Dropdown::Flag::StayOpen, num_items, widget->width() - 4);
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_OPTIONS_PAGE_DISPLAY, SPR_G2_MONITOR_TAB_START);
DrawTabImage(rt, WINDOW_OPTIONS_PAGE_RENDERING, SPR_G2_TAB_TREE);
@@ -2312,7 +2314,7 @@ namespace OpenRCT2::Ui::Windows
DrawTabImage(rt, WINDOW_OPTIONS_PAGE_ADVANCED, SPR_TAB_WRENCH_0);
}
void DrawTabImage(RenderTarget& rt, int32_t p, int32_t spriteIndex)
void DrawTabImage(Drawing::RenderTarget& rt, int32_t p, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_FIRST_TAB + p;
Widget* widget = &widgets[widgetIndex];
+1 -1
View File
@@ -85,7 +85,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
+11 -11
View File
@@ -357,7 +357,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -451,7 +451,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[0] = Dropdown::MenuLabel(STR_CLOSE_PARK);
gDropdown.items[1] = Dropdown::MenuLabel(STR_OPEN_PARK);
WindowDropdownShowText(
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() + 1, colours[1], 0, 2);
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, 2);
if (Park::IsOpen(getGameState().park))
{
@@ -585,7 +585,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDrawEntrance(RenderTarget& rt)
void onDrawEntrance(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -646,7 +646,7 @@ namespace OpenRCT2::Ui::Windows
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
viewportWidget->width() - 2, viewportWidget->height() - 1, focus.value());
viewportWidget->width() - 2, viewportWidget->height() - 2, focus.value());
flags |= WindowFlag::noScrolling;
invalidate();
}
@@ -700,7 +700,7 @@ namespace OpenRCT2::Ui::Windows
kGraphNumYLabels, kParkRatingHistorySize);
}
void onDrawRating(RenderTarget& rt)
void onDrawRating(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -781,7 +781,7 @@ namespace OpenRCT2::Ui::Windows
kGraphNumYLabels, kGuestsInParkHistorySize);
}
void onDrawGuests(RenderTarget& rt)
void onDrawGuests(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -882,7 +882,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
void onDrawPrice(RenderTarget& rt)
void onDrawPrice(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -942,7 +942,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
void onDrawStats(RenderTarget& rt)
void onDrawStats(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1068,7 +1068,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
void onDrawObjective(RenderTarget& rt)
void onDrawObjective(Drawing::RenderTarget& rt)
{
auto& gameState = getGameState();
drawWidgets(rt);
@@ -1134,7 +1134,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_7);
}
void onDrawAwards(RenderTarget& rt)
void onDrawAwards(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -1208,7 +1208,7 @@ namespace OpenRCT2::Ui::Windows
pressedWidgets |= 1LL << (WIDX_TAB_1 + page);
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
// Entrance tab
if (!widgetIsDisabled(*this, WIDX_TAB_1))
+2 -8
View File
@@ -136,7 +136,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gLandToolSize));
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -159,7 +159,7 @@ namespace OpenRCT2::Ui::Windows
return;
auto stateChanged = false;
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
if (!gMapSelectFlags.has(MapSelectFlag::enable))
stateChanged = true;
if (gMapSelectType != MapSelectType::full)
@@ -181,15 +181,10 @@ namespace OpenRCT2::Ui::Windows
if (stateChanged)
{
// Invalidate previous area
MapInvalidateSelectionRect();
// Update and invalidate new area
gMapSelectFlags.set(MapSelectFlag::enable);
gMapSelectType = MapSelectType::full;
gMapSelectPositionA = posA;
gMapSelectPositionB = posB;
MapInvalidateSelectionRect();
}
}
@@ -254,7 +249,6 @@ namespace OpenRCT2::Ui::Windows
if (!ToolSet(*this, 0, Tool::walkDown))
{
ShowGridlines();
gInputFlags.set(InputFlag::unk6);
SetPatrolAreaToRender(_staffId);
GfxInvalidateScreen();
}
+8 -8
View File
@@ -151,7 +151,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
Widget* widget;
@@ -404,7 +404,7 @@ namespace OpenRCT2::Ui::Windows
viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget->left, viewportWidget->top };
viewport->width = viewportWidget->width() - 1;
viewport->height = viewportWidget->height();
viewport->height = viewportWidget->height() - 1;
}
// only enable kick button for other players
@@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows
widgetSetEnabled(*this, WIDX_KICK, canKick && !isOwnWindow && !isServer);
}
void onDrawOverview(RenderTarget& rt)
void onDrawOverview(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -533,7 +533,7 @@ namespace OpenRCT2::Ui::Windows
auto playerSetGroupAction = GameActions::PlayerSetGroupAction(playerId, groupId);
playerSetGroupAction.SetCallback(
[windowHandle](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
auto* windowMgr = Ui::GetWindowManager();
windowMgr->InvalidateByNumber(windowHandle.first, windowHandle.second);
@@ -557,8 +557,8 @@ namespace OpenRCT2::Ui::Windows
numItems = Network::GetNumGroups();
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, 0, numItems, widget->right - dropdownWidget->left);
for (i = 0; i < Network::GetNumGroups(); i++)
{
@@ -599,7 +599,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_2);
}
void onDrawStatistics(RenderTarget& rt)
void onDrawStatistics(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
DrawTabImages(rt);
+8 -6
View File
@@ -171,14 +171,14 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
auto& widget = widgets[WIDX_TITLE];
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left, widget.bottom + 1 };
RenderTarget clipDPI;
Drawing::RenderTarget clipDPI;
if (!ClipDrawPixelInfo(clipDPI, rt, screenCoords, width - 3, height - widget.bottom - 3))
return;
@@ -198,9 +198,14 @@ namespace OpenRCT2::Ui::Windows
int16_t vehicleWidth = (vehicle != nullptr) ? vehicle->width : 0;
int32_t position;
if (_totalCount > 0)
position = (-vehicleWidth + 2) + width * _currentProgress / _totalCount;
{
const auto progress = static_cast<double>(_currentProgress) / _totalCount;
position = static_cast<int32_t>((-vehicleWidth + 2) + width * progress);
}
else
{
position = (vehicleWidth + width) / 2;
}
GfxDrawSprite(clipDPI, variant.vehicle, ScreenCoordsXY(position, widget.bottom + 1));
}
@@ -208,9 +213,6 @@ namespace OpenRCT2::Ui::Windows
void setCaption(const std::string& text)
{
_progressTitle = text;
_currentProgress = 0;
_totalCount = 0;
invalidate();
}
@@ -72,7 +72,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
+6 -6
View File
@@ -246,7 +246,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -266,7 +266,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImage(RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
void DrawTabImage(Drawing::RenderTarget& rt, int32_t tabPage, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + tabPage;
@@ -286,7 +286,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawTabImage(rt, WINDOW_RESEARCH_PAGE_DEVELOPMENT, SPR_TAB_FINANCES_RESEARCH_0);
DrawTabImage(rt, WINDOW_RESEARCH_PAGE_FUNDING, SPR_TAB_FINANCES_SUMMARY_0);
@@ -340,7 +340,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void WindowResearchDevelopmentDraw(WindowBase* w, RenderTarget& rt, WidgetIndex baseWidgetIndex)
void WindowResearchDevelopmentDraw(WindowBase* w, Drawing::RenderTarget& rt, WidgetIndex baseWidgetIndex)
{
const auto& gameState = getGameState();
@@ -482,7 +482,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(kResearchFundingLevelNames[i]);
}
WindowDropdownShowTextCustomWidth(
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ w->windowPos.x + dropdownWidget->left, w->windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
w->colours[1], 0, Dropdown::Flag::StayOpen, 4, dropdownWidget->width() - 4);
int32_t currentResearchLevel = gameState.researchFundingLevel;
@@ -573,7 +573,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void WindowResearchFundingDraw(WindowBase* w, RenderTarget& rt)
void WindowResearchFundingDraw(WindowBase* w, Drawing::RenderTarget& rt)
{
const auto& gameState = getGameState();
if (gameState.park.flags & PARK_FLAGS_NO_MONEY)
+115 -115
View File
@@ -542,48 +542,48 @@ namespace OpenRCT2::Ui::Windows
static_assert(std::size(VehicleColourSchemeNames) == kNumVehicleColourSettings);
static constexpr std::array VehicleStatusNames = {
STR_MOVING_TO_END_OF, // Vehicle::Status::MovingToEndOfStation
STR_WAITING_FOR_PASSENGERS_AT, // Vehicle::Status::WaitingForPassengers
STR_WAITING_TO_DEPART, // Vehicle::Status::WaitingToDepart
STR_DEPARTING, // Vehicle::Status::Departing
STR_TRAVELLING_AT_0, // Vehicle::Status::Travelling
STR_ARRIVING_AT, // Vehicle::Status::Arriving
STR_UNLOADING_PASSENGERS_AT, // Vehicle::Status::UnloadingPassengers
STR_TRAVELLING_AT_1, // Vehicle::Status::TravellingBoat
STR_CRASHING, // Vehicle::Status::Crashing
STR_CRASHED_0, // Vehicle::Status::Crashed
STR_TRAVELLING_AT_2, // Vehicle::Status::TravellingDodgems
STR_SWINGING, // Vehicle::Status::Swinging
STR_ROTATING_0, // Vehicle::Status::Rotating
STR_ROTATING_1, // Vehicle::Status::FerrisWheelRotating
STR_OPERATING_0, // Vehicle::Status::SimulatorOperating
STR_SHOWING_FILM, // Vehicle::Status::ShowingFilm
STR_ROTATING_2, // Vehicle::Status::SpaceRingsOperating
STR_OPERATING_1, // Vehicle::Status::TopSpinOperating
STR_OPERATING_2, // Vehicle::Status::HauntedHouseOperating
STR_DOING_CIRCUS_SHOW, // Vehicle::Status::DoingCircusShow
STR_OPERATING_3, // Vehicle::Status::CrookedHouseOperating
STR_WAITING_FOR_CABLE_LIFT, // Vehicle::Status::WaitingForCableLift
STR_TRAVELLING_AT_3, // Vehicle::Status::TravellingCableLift
STR_STOPPING_0, // Vehicle::Status::Stopping
STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::WaitingForPassengers17
STR_WAITING_TO_START, // Vehicle::Status::WaitingToStart
STR_STARTING, // Vehicle::Status::Starting
STR_OPERATING, // Vehicle::Status::Operating1A
STR_STOPPING_1, // Vehicle::Status::Stopping1B
STR_UNLOADING_PASSENGERS, // Vehicle::Status::UnloadingPassengers1C
STR_STOPPED_BY_BLOCK_BRAKES, // Vehicle::Status::StoppedByBlockBrakes
STR_MOVING_TO_END_OF, // Vehicle::Status::movingToEndOfStation
STR_WAITING_FOR_PASSENGERS_AT, // Vehicle::Status::waitingForPassengers
STR_WAITING_TO_DEPART, // Vehicle::Status::waitingToDepart
STR_DEPARTING, // Vehicle::Status::departing
STR_TRAVELLING_AT_0, // Vehicle::Status::travelling
STR_ARRIVING_AT, // Vehicle::Status::arriving
STR_UNLOADING_PASSENGERS_AT, // Vehicle::Status::unloadingPassengers
STR_TRAVELLING_AT_1, // Vehicle::Status::travellingBoat
STR_CRASHING, // Vehicle::Status::crashing
STR_CRASHED_0, // Vehicle::Status::crashed
STR_TRAVELLING_AT_2, // Vehicle::Status::travellingDodgems
STR_SWINGING, // Vehicle::Status::swinging
STR_ROTATING_0, // Vehicle::Status::rotating
STR_ROTATING_1, // Vehicle::Status::ferrisWheelRotating
STR_OPERATING_0, // Vehicle::Status::simulatorOperating
STR_SHOWING_FILM, // Vehicle::Status::showingFilm
STR_ROTATING_2, // Vehicle::Status::spaceRingsOperating
STR_OPERATING_1, // Vehicle::Status::topSpinOperating
STR_OPERATING_2, // Vehicle::Status::hauntedHouseOperating
STR_DOING_CIRCUS_SHOW, // Vehicle::Status::doingCircusShow
STR_OPERATING_3, // Vehicle::Status::crookedHouseOperating
STR_WAITING_FOR_CABLE_LIFT, // Vehicle::Status::waitingForCableLift
STR_TRAVELLING_AT_3, // Vehicle::Status::travellingCableLift
STR_STOPPING_0, // Vehicle::Status::stopping
STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::waitingForPassengers17
STR_WAITING_TO_START, // Vehicle::Status::waitingToStart
STR_STARTING, // Vehicle::Status::starting
STR_OPERATING, // Vehicle::Status::operating1A
STR_STOPPING_1, // Vehicle::Status::stopping1B
STR_UNLOADING_PASSENGERS, // Vehicle::Status::unloadingPassengers1C
STR_STOPPED_BY_BLOCK_BRAKES, // Vehicle::Status::stoppedByBlockBrakes
};
static_assert(std::size(VehicleStatusNames) == 31);
static constexpr std::array SingleSessionVehicleStatusNames = {
STR_STOPPING_0, // Vehicle::Status::MovingToEndOfStation
STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::WaitingForPassengers
STR_WAITING_TO_START, // Vehicle::Status::WaitingToDepart
STR_STARTING, // Vehicle::Status::Departing
STR_OPERATING, // Vehicle::Status::Travelling
STR_STOPPING_1, // Vehicle::Status::Arriving
STR_UNLOADING_PASSENGERS, // Vehicle::Status::UnloadingPassengers
STR_STOPPING_0, // Vehicle::Status::movingToEndOfStation
STR_WAITING_FOR_PASSENGERS, // Vehicle::Status::waitingForPassengers
STR_WAITING_TO_START, // Vehicle::Status::waitingToDepart
STR_STARTING, // Vehicle::Status::departing
STR_OPERATING, // Vehicle::Status::travelling
STR_STOPPING_1, // Vehicle::Status::arriving
STR_UNLOADING_PASSENGERS, // Vehicle::Status::unloadingPassengers
};
static_assert(std::size(SingleSessionVehicleStatusNames) == 7);
@@ -893,7 +893,7 @@ namespace OpenRCT2::Ui::Windows
break;
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -1072,7 +1072,7 @@ namespace OpenRCT2::Ui::Windows
break;
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
switch (page)
{
@@ -1204,7 +1204,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
void drawTabImage(RenderTarget& rt, int32_t tab, int32_t spriteIndex)
void drawTabImage(Drawing::RenderTarget& rt, int32_t tab, int32_t spriteIndex)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + tab;
@@ -1221,7 +1221,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabMain(RenderTarget& rt)
void DrawTabMain(Drawing::RenderTarget& rt)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast<int32_t>(WINDOW_RIDE_PAGE_MAIN);
if (!widgetIsDisabled(*this, widgetIndex))
@@ -1255,7 +1255,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabVehicle(RenderTarget& rt)
void DrawTabVehicle(Drawing::RenderTarget& rt)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast<int32_t>(WINDOW_RIDE_PAGE_VEHICLE);
const auto& widget = widgets[widgetIndex];
@@ -1318,7 +1318,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabCustomer(RenderTarget& rt)
void DrawTabCustomer(Drawing::RenderTarget& rt)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + static_cast<int32_t>(WINDOW_RIDE_PAGE_CUSTOMER);
@@ -1338,7 +1338,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void drawTabImages(RenderTarget& rt)
void drawTabImages(Drawing::RenderTarget& rt)
{
DrawTabVehicle(rt);
drawTabImage(rt, WINDOW_RIDE_PAGE_OPERATING, SPR_TAB_GEARS_0);
@@ -1584,7 +1584,7 @@ namespace OpenRCT2::Ui::Windows
auto screenPos = windowPos + ScreenCoordsXY{ viewWidget.left + 1, viewWidget.top + 1 };
int32_t viewWidth = viewWidget.width() - 2;
int32_t viewHeight = viewWidget.height() - 1;
int32_t viewHeight = viewWidget.height() - 2;
ViewportCreate(*this, screenPos, viewWidth, viewHeight, focus.value());
@@ -1761,8 +1761,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, 0, numItems, widget->right - dropdownWidget->left);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, 0, numItems, widget->right - dropdownWidget->left);
// First item
gDropdown.items[0] = Dropdown::MenuLabel(STR_OVERALL_VIEW);
@@ -1868,7 +1868,7 @@ namespace OpenRCT2::Ui::Windows
SetDropdown(info, RideStatus::testing, STR_TEST_RIDE);
SetDropdown(info, RideStatus::open, STR_OPEN_RIDE);
WindowDropdownShowText(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, info.NumItems);
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0, info.NumItems);
if (info.CheckedIndex != -1)
{
gDropdown.items[info.CheckedIndex].setChecked(true);
@@ -1927,8 +1927,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = widget - 1;
WindowDropdownShowText(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
Dropdown::Flag::StayOpen, RIDE_TYPE_COUNT);
// Find the current ride type in the ordered list.
int32_t pos = 0;
@@ -1956,7 +1956,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_FOLLOW_SUBJECT_TIP);
WindowDropdownShowText(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2);
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0, 2);
gDropdown.defaultIndex = 0;
if (!ride->getRideTypeDescriptor().HasFlag(RtdFlag::hasTrack) || _viewIndex == 0 || _viewIndex > ride->numTrains)
{
@@ -2074,8 +2074,8 @@ namespace OpenRCT2::Ui::Windows
Widget* dropdownWidget = widget - 1;
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 1);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, Dropdown::Flag::StayOpen, numItems, dropdownWidget->width() - 1);
// Find the current vehicle type in the ordered list.
int32_t pos = 0;
@@ -2135,8 +2135,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, Dropdown::Flag::StayOpen, _entranceDropdownData.size(),
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, Dropdown::Flag::StayOpen, _entranceDropdownData.size(),
widgets[WIDX_ENTRANCE_STYLE_DROPDOWN].right - dropdownWidget->left);
}
@@ -2262,10 +2262,10 @@ namespace OpenRCT2::Ui::Windows
{
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[_viewIndex - 1]);
if (vehicle == nullptr
|| (vehicle->status != Vehicle::Status::Travelling
&& vehicle->status != Vehicle::Status::TravellingCableLift
&& vehicle->status != Vehicle::Status::TravellingDodgems
&& vehicle->status != Vehicle::Status::TravellingBoat))
|| (vehicle->status != Vehicle::Status::travelling
&& vehicle->status != Vehicle::Status::travellingCableLift
&& vehicle->status != Vehicle::Status::travellingDodgems
&& vehicle->status != Vehicle::Status::travellingBoat))
{
return;
}
@@ -2459,13 +2459,13 @@ namespace OpenRCT2::Ui::Windows
return kStringIdEmpty;
auto& rtd = ride->getRideTypeDescriptor();
if (vehicle->status != Vehicle::Status::Crashing && vehicle->status != Vehicle::Status::Crashed)
if (vehicle->status != Vehicle::Status::crashing && vehicle->status != Vehicle::Status::crashed)
{
auto trackType = vehicle->GetTrackType();
if (trackType == TrackElemType::BlockBrakes || trackType == TrackElemType::CableLiftHill
|| trackType == TrackElemType::Up25ToFlat || trackType == TrackElemType::Up60ToFlat
|| trackType == TrackElemType::DiagUp25ToFlat || trackType == TrackElemType::DiagUp60ToFlat
|| trackType == TrackElemType::DiagBlockBrakes)
if (trackType == TrackElemType::blockBrakes || trackType == TrackElemType::cableLiftHill
|| trackType == TrackElemType::up25ToFlat || trackType == TrackElemType::up60ToFlat
|| trackType == TrackElemType::diagUp25ToFlat || trackType == TrackElemType::diagUp60ToFlat
|| trackType == TrackElemType::diagBlockBrakes)
{
if (rtd.SupportsTrackGroup(TrackGroup::blockBrakes) && vehicle->velocity == 0)
{
@@ -2480,7 +2480,7 @@ namespace OpenRCT2::Ui::Windows
auto stringId = VehicleStatusNames[EnumValue(vehicle->status)];
if (ride->getRideTypeDescriptor().HasFlag(RtdFlag::singleSession)
&& vehicle->status <= Vehicle::Status::UnloadingPassengers)
&& vehicle->status <= Vehicle::Status::unloadingPassengers)
{
stringId = SingleSessionVehicleStatusNames[EnumValue(vehicle->status)];
}
@@ -2558,7 +2558,7 @@ namespace OpenRCT2::Ui::Windows
return GetStatusStation(ft);
}
void MainOnDraw(RenderTarget& rt)
void MainOnDraw(Drawing::RenderTarget& rt)
{
WindowDrawWidgets(*this, rt);
drawTabImages(rt);
@@ -2847,7 +2847,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void VehicleOnDraw(RenderTarget& rt)
void VehicleOnDraw(Drawing::RenderTarget& rt)
{
WindowDrawWidgets(*this, rt);
drawTabImages(rt);
@@ -2934,7 +2934,7 @@ namespace OpenRCT2::Ui::Windows
ImageId imageId;
};
void VehicleOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
void VehicleOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -2947,7 +2947,7 @@ namespace OpenRCT2::Ui::Windows
Widget* widget = &widgets[WIDX_VEHICLE_TRAINS_PREVIEW];
int32_t startX = std::max(2, (widget->width() - 1 - ((ride->numTrains - 1) * 36)) / 2 - 25);
int32_t startY = widget->height() - 4;
int32_t startY = widget->height() - 5;
bool isReversed = ride->hasLifecycleFlag(RIDE_LIFECYCLE_REVERSED_TRAINS);
int32_t carIndex = (isReversed) ? ride->numCarsPerTrain - 1 : 0;
@@ -3107,8 +3107,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, Dropdown::Flag::StayOpen, numAvailableModes, widget->right - dropdownWidget->left);
if (checkedIndex != -1)
{
@@ -3128,8 +3128,8 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(VehicleLoadNames[i]);
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, Dropdown::Flag::StayOpen, 5, widget->right - dropdownWidget->left);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, Dropdown::Flag::StayOpen, 5, widget->right - dropdownWidget->left);
gDropdown.items[ride->departFlags & RIDE_DEPART_WAIT_FOR_LOAD_MASK].setChecked(true);
}
@@ -3670,7 +3670,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
void OperatingOnDraw(RenderTarget& rt)
void OperatingOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
@@ -3782,10 +3782,10 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[i] = Dropdown::MenuLabel(kRideInspectionIntervalNames[i]);
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 7, widgets[widgetIndex].right - dropdownWidget->left);
gDropdown.items[ride->inspectionInterval].setChecked(true);
gDropdown.items[EnumValue(ride->inspectionInterval)].setChecked(true);
break;
case WIDX_FORCE_BREAKDOWN:
@@ -3817,8 +3817,8 @@ namespace OpenRCT2::Ui::Windows
else
{
WindowDropdownShowText(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top },
dropdownWidget->height() + 1, colours[1], Dropdown::Flag::StayOpen, numItems);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], Dropdown::Flag::StayOpen, numItems);
numItems = 1;
int32_t breakdownReason = ride->breakdownReasonPending;
@@ -3889,7 +3889,7 @@ namespace OpenRCT2::Ui::Windows
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
{
vehicle->ClearFlag(
VehicleFlags::CarIsBroken | VehicleFlags::StoppedOnLift
VehicleFlags::CarIsBroken | VehicleFlags::StoppedBySafetyCutOut
| VehicleFlags::TrainIsBroken);
}
}
@@ -3984,7 +3984,7 @@ namespace OpenRCT2::Ui::Windows
auto ft = Formatter::Common();
ride->formatNameTo(ft);
widgets[WIDX_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames[ride->inspectionInterval];
widgets[WIDX_INSPECTION_INTERVAL].text = kRideInspectionIntervalNames[EnumValue(ride->inspectionInterval)];
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
@@ -4010,7 +4010,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void MaintenanceOnDraw(RenderTarget& rt)
void MaintenanceOnDraw(Drawing::RenderTarget& rt)
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -4079,7 +4079,7 @@ namespace OpenRCT2::Ui::Windows
{
switch (ride->mechanicStatus)
{
case RIDE_MECHANIC_STATUS_CALLING:
case MechanicStatus::calling:
{
stringId = STR_NO_MECHANICS_ARE_HIRED_MESSAGE;
@@ -4093,11 +4093,11 @@ namespace OpenRCT2::Ui::Windows
}
break;
}
case RIDE_MECHANIC_STATUS_HEADING:
case MechanicStatus::heading:
stringId = STR_MECHANIC_IS_HEADING_FOR_THE_RIDE;
break;
case RIDE_MECHANIC_STATUS_FIXING:
case RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES:
case MechanicStatus::fixing:
case MechanicStatus::hasFixedStationBrakes:
stringId = STR_MECHANIC_IS_FIXING_THE_RIDE;
break;
default:
@@ -4315,7 +4315,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left);
gDropdown.items[colourSchemeIndex].setChecked(true);
@@ -4341,7 +4341,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, 4, widgets[widgetIndex].right - dropdownWidget->left);
gDropdown.items[ride->trackColours[colourSchemeIndex].supports].setChecked(true);
@@ -4368,7 +4368,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, numDropdownItems,
widgets[widgetIndex].right - dropdownWidget->left);
@@ -4407,7 +4407,7 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(),
colours[1], 0, Dropdown::Flag::StayOpen, dropdownIndex,
widgets[widgetIndex].right - dropdownWidget->left);
@@ -4483,7 +4483,7 @@ namespace OpenRCT2::Ui::Windows
rideId, GameActions::RideSetAppearanceType::EntranceStyle, objIndex, 0);
rideSetAppearanceAction.SetCallback(
[objIndex](const GameActions::GameAction*, const GameActions::Result* res) {
if (res->Error != GameActions::Status::Ok)
if (res->error != GameActions::Status::ok)
return;
getGameState().lastEntranceStyle = objIndex;
});
@@ -4496,7 +4496,7 @@ namespace OpenRCT2::Ui::Windows
rideId, GameActions::RideSetAppearanceType::VehicleColourScheme, dropdownIndex, 0);
rideSetAppearanceAction.SetCallback(
[this](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
resetVehicleIndex();
}
@@ -4799,7 +4799,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
void ColourOnDraw(RenderTarget& rt)
void ColourOnDraw(Drawing::RenderTarget& rt)
{
// TODO: This should use lists and identified sprites
RenderTarget clippedDpi;
@@ -4879,7 +4879,7 @@ namespace OpenRCT2::Ui::Windows
if (ClipDrawPixelInfo(
clippedDpi, rt,
windowPos + ScreenCoordsXY{ entrancePreviewWidget.left + 1, entrancePreviewWidget.top + 1 },
entrancePreviewWidget.width() - 1, entrancePreviewWidget.height()))
entrancePreviewWidget.width() - 1, entrancePreviewWidget.height() - 1))
{
GfxClear(clippedDpi, PaletteIndex::pi12);
@@ -4908,7 +4908,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void ColourOnScrollDraw(RenderTarget& rt, int32_t scrollIndex) const
void ColourOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex) const
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -4925,7 +4925,7 @@ namespace OpenRCT2::Ui::Windows
Rectangle::fill(rt, { { rt.x, rt.y }, { rt.x + rt.width - 1, rt.y + rt.height - 1 } }, PaletteIndex::pi12);
// ?
auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 15 };
auto screenCoords = ScreenCoordsXY{ vehiclePreviewWidget->width() / 2, vehiclePreviewWidget->height() - 16 };
// ?
auto trainCarIndex = ride->vehicleColourSettings == VehicleColourSettings::perCar ? _vehicleIndex
@@ -5077,8 +5077,8 @@ namespace OpenRCT2::Ui::Windows
}
WindowDropdownShowTextCustomWidth(
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height() + 1,
colours[1], 0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left);
{ windowPos.x + dropdownWidget->left, windowPos.y + dropdownWidget->top }, dropdownWidget->height(), colours[1],
0, Dropdown::Flag::StayOpen, numItems, widgets[widgetIndex].right - dropdownWidget->left);
// Set currently checked item
for (size_t i = 0; i < numItems; i++)
@@ -5125,7 +5125,7 @@ namespace OpenRCT2::Ui::Windows
// Figure out minimum size
ScreenSize size{};
size.height = widgets[WIDX_MUSIC_DATA].height() - 2;
size.height = widgets[WIDX_MUSIC_DATA].height() - 3;
size.width = widgets[WIDX_MUSIC_DATA].width() - 3;
auto ride = GetRide(rideId);
@@ -5215,7 +5215,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
void MusicOnDraw(RenderTarget& rt)
void MusicOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
@@ -5241,7 +5241,7 @@ namespace OpenRCT2::Ui::Windows
// Figure out where the image should go
const auto& previewWidget = widgets[WIDX_MUSIC_IMAGE];
int32_t clipWidth = previewWidget.width() - 2;
int32_t clipHeight = previewWidget.height() - 1;
int32_t clipHeight = previewWidget.height() - 2;
// Draw the preview image
RenderTarget clipDPI;
@@ -5252,7 +5252,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void MusicOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
void MusicOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
auto ride = GetRide(rideId);
if (ride == nullptr)
@@ -5459,7 +5459,7 @@ namespace OpenRCT2::Ui::Windows
WindowDropdownShowText(
{ windowPos.x + widgets[widgetIndex].left, windowPos.y + widgets[widgetIndex].top },
widgets[widgetIndex].height() + 1, colours[1], Dropdown::Flag::StayOpen, 2);
widgets[widgetIndex].height(), colours[1], Dropdown::Flag::StayOpen, 2);
gDropdown.defaultIndex = 0;
if (!ride->getRideTypeDescriptor().HasFlag(RtdFlag::hasTrack))
{
@@ -5594,7 +5594,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
void MeasurementsOnDraw(RenderTarget& rt)
void MeasurementsOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
@@ -6038,13 +6038,13 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
void GraphsOnDraw(RenderTarget& rt)
void GraphsOnDraw(Drawing::RenderTarget& rt)
{
drawWidgets(rt);
drawTabImages(rt);
}
void GraphsOnScrollDraw(RenderTarget& rt, int32_t scrollIndex)
void GraphsOnScrollDraw(Drawing::RenderTarget& rt, int32_t scrollIndex)
{
GfxClear(rt, ColourMapA[COLOUR_SATURATED_GREEN].darker);
@@ -6060,7 +6060,7 @@ namespace OpenRCT2::Ui::Windows
if (measurement == nullptr)
{
// No measurement message
ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() / 2 - 5);
ScreenCoordsXY stringCoords(widget->width() / 2, widget->height() - 1 / 2 - 5);
int32_t txtWidth = widget->width() - 3;
DrawTextWrapped(rt, stringCoords, txtWidth, message.str, message.args, { TextAlignment::centre });
return;
@@ -6099,7 +6099,7 @@ namespace OpenRCT2::Ui::Windows
yUnit -= kMapBaseZ * 3;
}
for (int32_t y = widget->height() - 13; y >= 8; y -= yInterval, yUnit += yUnitInterval)
for (int32_t y = widget->height() - 14; y >= 8; y -= yInterval, yUnit += yUnitInterval)
{
// Minor / major line
int32_t colour = yUnit == 0 ? lightColour : darkColour;
@@ -6170,8 +6170,8 @@ namespace OpenRCT2::Ui::Windows
}
// Adjust line to match graph widget position.
firstPoint = widget->height() - firstPoint - 13;
secondPoint = widget->height() - secondPoint - 13;
firstPoint = widget->height() - firstPoint - 14;
secondPoint = widget->height() - secondPoint - 14;
if (firstPoint > secondPoint)
{
std::swap(firstPoint, secondPoint);
@@ -6180,8 +6180,8 @@ namespace OpenRCT2::Ui::Windows
// Adjust threshold line position as well
if (listType == GRAPH_VERTICAL || listType == GRAPH_LATERAL)
{
intensityThresholdPositive = widget->height() - intensityThresholdPositive - 13;
intensityThresholdNegative = widget->height() - intensityThresholdNegative - 13;
intensityThresholdPositive = widget->height() - intensityThresholdPositive - 14;
intensityThresholdNegative = widget->height() - intensityThresholdNegative - 14;
}
const bool previousMeasurement = x > measurement->current_item;
@@ -6599,7 +6599,7 @@ namespace OpenRCT2::Ui::Windows
WindowAlignTabs(this, WIDX_TAB_1, WIDX_TAB_10);
}
void IncomeOnDraw(RenderTarget& rt)
void IncomeOnDraw(Drawing::RenderTarget& rt)
{
StringId stringId;
money64 profit;
@@ -6798,7 +6798,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void CustomerOnDraw(RenderTarget& rt)
void CustomerOnDraw(Drawing::RenderTarget& rt)
{
ShopItem shopItem;
int16_t popularity, satisfaction, queueTime;
@@ -7033,7 +7033,7 @@ namespace OpenRCT2::Ui::Windows
auto trackElement = tileElement->AsTrack();
auto trackType = trackElement->GetTrackType();
const auto& ted = GetTrackElementDescriptor(trackType);
if (ted.sequences[0].flags & TRACK_SEQUENCE_FLAG_ORIGIN)
if (ted.sequences[0].flags.has(SequenceFlag::trackOrigin))
{
auto stationIndex = trackElement->GetStationIndex();
return WindowRideOpenStation(*ride, stationIndex);
File diff suppressed because it is too large. Load diff
+6 -6
View File
@@ -311,7 +311,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[0] = Dropdown::PlainMenuLabel(STR_CLOSE_ALL);
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_OPEN_ALL);
WindowDropdownShowText(
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height(), colours[1], 0, 2);
{ windowPos.x + widget.left, windowPos.y + widget.top }, widget.height() - 1, colours[1], 0, 2);
}
else if (widgetIndex == WIDX_HEADER_CUSTOMISE)
{
@@ -346,8 +346,8 @@ namespace OpenRCT2::Ui::Windows
auto totalWidth = headerWidget.width() - 1 + customWidget.width() - 1;
WindowDropdownShowTextCustomWidth(
{ windowPos.x + headerWidget.left, windowPos.y + headerWidget.top }, headerWidget.height(), colours[1], 0,
Dropdown::Flag::StayOpen, numItems, totalWidth);
{ windowPos.x + headerWidget.left, windowPos.y + headerWidget.top }, headerWidget.height() - 1, colours[1],
0, Dropdown::Flag::StayOpen, numItems, totalWidth);
}
}
@@ -587,7 +587,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006B3235
*/
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
DrawTabImages(rt);
@@ -624,7 +624,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006B3240
*/
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
@@ -881,7 +881,7 @@ namespace OpenRCT2::Ui::Windows
*
* rct2: 0x006B38EA
*/
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
int32_t sprite_idx;
+1 -1
View File
@@ -190,7 +190,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
}
+4 -4
View File
@@ -267,7 +267,7 @@ namespace OpenRCT2::Ui::Windows
invalidate();
}
ScreenCoordsXY DrawPreview(RenderTarget& rt, ScreenCoordsXY screenPos)
ScreenCoordsXY DrawPreview(Drawing::RenderTarget& rt, ScreenCoordsXY screenPos)
{
auto targetImageType = PreviewImageType::miniMap;
if (Config::Get().interface.scenarioPreviewScreenshots)
@@ -302,7 +302,7 @@ namespace OpenRCT2::Ui::Windows
return frameEndPos;
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -540,7 +540,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light;
GfxClear(rt, paletteIndex);
@@ -636,7 +636,7 @@ namespace OpenRCT2::Ui::Windows
}
private:
void DrawCategoryHeading(RenderTarget& rt, int32_t left, int32_t right, int32_t y, StringId stringId) const
void DrawCategoryHeading(Drawing::RenderTarget& rt, int32_t left, int32_t right, int32_t y, StringId stringId) const
{
auto baseColour = colours[1];
colour_t lightColour = ColourMapA[baseColour.colour].lighter;
+133 -108
View File
@@ -67,6 +67,7 @@
#include <openrct2/world/tile_element/WallElement.h>
using namespace OpenRCT2::Drawing;
using OpenRCT2::GameActions::CommandFlag;
namespace OpenRCT2::Ui::Windows
{
@@ -506,7 +507,7 @@ namespace OpenRCT2::Ui::Windows
else
{
const auto& listWidget = widgets[WIDX_SCENERY_LIST];
const auto nonListHeight = height - listWidget.height() + 2;
const auto nonListHeight = height - listWidget.height() - 1 + 2;
const auto numRows = static_cast<int32_t>(CountRows());
const auto maxContentHeight = numRows * kSceneryButtonHeight;
@@ -553,8 +554,20 @@ namespace OpenRCT2::Ui::Windows
if (!isToolActive(WindowClass::scenery))
{
close();
return;
if (_inDragMode)
{
removeProvisionalTilesFromMap();
_provisionalTiles.clear();
_inDragMode = false;
ToolSet(*this, WIDX_SCENERY_BACKGROUND, Tool::arrow);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
else
{
close();
return;
}
}
if (gWindowSceneryEyedropperEnabled)
@@ -577,23 +590,39 @@ namespace OpenRCT2::Ui::Windows
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE)
{
gCurrentToolId = static_cast<Tool>(
ObjectManager::GetObjectEntry<LargeSceneryEntry>(tabSelectedScenery.EntryIndex)->tool_id);
const auto* sceneryEntry = ObjectManager::GetObjectEntry<LargeSceneryEntry>(
tabSelectedScenery.EntryIndex);
if (sceneryEntry != nullptr)
{
gCurrentToolId = static_cast<Tool>(sceneryEntry->tool_id);
}
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL)
{
gCurrentToolId = static_cast<Tool>(
ObjectManager::GetObjectEntry<WallSceneryEntry>(tabSelectedScenery.EntryIndex)->tool_id);
const auto* sceneryEntry = ObjectManager::GetObjectEntry<WallSceneryEntry>(
tabSelectedScenery.EntryIndex);
if (sceneryEntry != nullptr)
{
gCurrentToolId = static_cast<Tool>(sceneryEntry->tool_id);
}
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_PATH_ITEM)
{
gCurrentToolId = static_cast<Tool>(
ObjectManager::GetObjectEntry<PathAdditionEntry>(tabSelectedScenery.EntryIndex)->tool_id);
const auto* sceneryEntry = ObjectManager::GetObjectEntry<PathAdditionEntry>(
tabSelectedScenery.EntryIndex);
if (sceneryEntry != nullptr)
{
gCurrentToolId = static_cast<Tool>(sceneryEntry->tool_id);
}
}
else
{ // small scenery
gCurrentToolId = static_cast<Tool>(
ObjectManager::GetObjectEntry<SmallSceneryEntry>(tabSelectedScenery.EntryIndex)->tool_id);
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL)
{
const auto* sceneryEntry = ObjectManager::GetObjectEntry<SmallSceneryEntry>(
tabSelectedScenery.EntryIndex);
if (sceneryEntry != nullptr)
{
gCurrentToolId = static_cast<Tool>(sceneryEntry->tool_id);
}
}
}
else
@@ -699,7 +728,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = WidgetType::flatBtn;
auto* sceneryEntry = ObjectManager::GetObjectEntry<SmallSceneryEntry>(tabSelectedScenery.EntryIndex);
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE))
if (sceneryEntry != nullptr && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE))
{
widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WidgetType::flatBtn;
}
@@ -738,7 +767,7 @@ namespace OpenRCT2::Ui::Windows
if (tabSelectedScenery.SceneryType == SCENERY_TYPE_BANNER)
{
auto* bannerEntry = ObjectManager::GetObjectEntry<BannerSceneryEntry>(tabSelectedScenery.EntryIndex);
if (bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)
if (bannerEntry != nullptr && bannerEntry->flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)
{
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
}
@@ -746,20 +775,22 @@ namespace OpenRCT2::Ui::Windows
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE)
{
auto* sceneryEntry = ObjectManager::GetObjectEntry<LargeSceneryEntry>(tabSelectedScenery.EntryIndex);
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR
&& !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_PRIMARY_REMAP_BUTTON))
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR
&& !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_SECONDARY_REMAP_BUTTON))
widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR)
widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
if (sceneryEntry != nullptr)
{
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR
&& !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_PRIMARY_REMAP_BUTTON))
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR
&& !(sceneryEntry->flags & LARGE_SCENERY_FLAG_HIDE_SECONDARY_REMAP_BUTTON))
widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_TERTIARY_COLOUR)
widgets[WIDX_SCENERY_TERTIARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
}
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL)
{
auto* wallEntry = ObjectManager::GetObjectEntry<WallSceneryEntry>(tabSelectedScenery.EntryIndex);
if (wallEntry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS))
if (wallEntry != nullptr && wallEntry->flags & (WALL_SCENERY_HAS_PRIMARY_COLOUR | WALL_SCENERY_HAS_GLASS))
{
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
@@ -778,7 +809,8 @@ namespace OpenRCT2::Ui::Windows
{
auto* sceneryEntry = ObjectManager::GetObjectEntry<SmallSceneryEntry>(tabSelectedScenery.EntryIndex);
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS))
if (sceneryEntry != nullptr
&& sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS))
{
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WidgetType::colourBtn;
@@ -843,7 +875,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = canFit ? WidgetType::flatBtn : WidgetType::empty;
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabs(rt, windowPos);
@@ -1064,7 +1096,7 @@ namespace OpenRCT2::Ui::Windows
int32_t newMinHeight = getTitleBarTargetHeight() + kDescriptionHeight + 2 * kTabMargin;
// Room for the search/filter widget
newMinHeight += widgets[WIDX_FILTER_TEXT_BOX].height() + 2 * kInputMargin;
newMinHeight += widgets[WIDX_FILTER_TEXT_BOX].height() - 1 + 2 * kInputMargin;
// Fit *all* rows of tabs
newMinHeight += static_cast<int32_t>(1 + (_tabEntries.size() / GetMaxTabCountInARow())) * kTabHeight;
@@ -1540,7 +1572,7 @@ namespace OpenRCT2::Ui::Windows
return { name, price };
}
void DrawTabs(RenderTarget& rt, const ScreenCoordsXY& offset)
void DrawTabs(Drawing::RenderTarget& rt, const ScreenCoordsXY& offset)
{
for (size_t tabIndex = 0; tabIndex < _tabEntries.size(); tabIndex++)
{
@@ -1555,11 +1587,14 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawSceneryItem(RenderTarget& rt, ScenerySelection scenerySelection)
void DrawSceneryItem(Drawing::RenderTarget& rt, ScenerySelection scenerySelection)
{
if (scenerySelection.SceneryType == SCENERY_TYPE_BANNER)
{
auto bannerEntry = ObjectManager::GetObjectEntry<BannerSceneryEntry>(scenerySelection.EntryIndex);
if (bannerEntry == nullptr)
return;
auto imageId = ImageId(bannerEntry->image + gWindowSceneryRotation * 2, _sceneryPrimaryColour);
GfxDrawSprite(rt, imageId, { 33, 40 });
GfxDrawSprite(rt, imageId.WithIndexOffset(1), { 33, 40 });
@@ -1567,6 +1602,9 @@ namespace OpenRCT2::Ui::Windows
else if (scenerySelection.SceneryType == SCENERY_TYPE_LARGE)
{
auto sceneryEntry = ObjectManager::GetObjectEntry<LargeSceneryEntry>(scenerySelection.EntryIndex);
if (sceneryEntry == nullptr)
return;
auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation);
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
imageId = imageId.WithPrimary(_sceneryPrimaryColour);
@@ -1579,6 +1617,9 @@ namespace OpenRCT2::Ui::Windows
else if (scenerySelection.SceneryType == SCENERY_TYPE_WALL)
{
auto wallEntry = ObjectManager::GetObjectEntry<WallSceneryEntry>(scenerySelection.EntryIndex);
if (wallEntry == nullptr)
return;
auto imageId = ImageId(wallEntry->image);
auto spriteTop = (wallEntry->height * 2) + 0x32;
if (wallEntry->flags & WALL_SCENERY_HAS_GLASS)
@@ -1615,12 +1656,18 @@ namespace OpenRCT2::Ui::Windows
else if (scenerySelection.SceneryType == SCENERY_TYPE_PATH_ITEM)
{
auto* pathAdditionEntry = ObjectManager::GetObjectEntry<PathAdditionEntry>(scenerySelection.EntryIndex);
if (pathAdditionEntry == nullptr)
return;
auto imageId = ImageId(pathAdditionEntry->image);
GfxDrawSprite(rt, imageId, { 11, 16 });
}
else
{
auto sceneryEntry = ObjectManager::GetObjectEntry<SmallSceneryEntry>(scenerySelection.EntryIndex);
if (sceneryEntry == nullptr)
return;
auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation);
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR))
{
@@ -1658,7 +1705,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
GfxClear(rt, ColourMapA[colours[1].colour].mid_light);
@@ -1761,8 +1808,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectType = getMapSelectQuarter((quadrant ^ 2));
}
MapInvalidateSelectionRect();
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_0) && mapTile == gSceneryGhostPosition && quadrant == _unkF64F0E
&& gSceneryPlaceZ == _unkF64F0A && gSceneryPlaceObject.SceneryType == SCENERY_TYPE_SMALL
@@ -1817,8 +1862,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectPositionB.y = mapTile.y;
gMapSelectType = MapSelectType::full;
MapInvalidateSelectionRect();
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_1) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z)
{
@@ -1856,8 +1899,6 @@ namespace OpenRCT2::Ui::Windows
setMapSelectRange(mapTile);
gMapSelectType = getMapSelectEdge(edge);
MapInvalidateSelectionRect();
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_2) && mapTile == gSceneryGhostPosition
&& edge == gSceneryGhostWallRotation && gSceneryPlaceZ == _unkF64F0A)
@@ -1905,21 +1946,8 @@ namespace OpenRCT2::Ui::Windows
}
auto* sceneryEntry = ObjectManager::GetObjectEntry<LargeSceneryEntry>(selection.EntryIndex);
gMapSelectionTiles.clear();
for (auto& tile : sceneryEntry->tiles)
{
CoordsXY tileLocation = { tile.offset };
auto rotatedTileCoords = tileLocation.Rotate(direction);
rotatedTileCoords.x += mapTile.x;
rotatedTileCoords.y += mapTile.y;
gMapSelectionTiles.push_back(rotatedTileCoords);
}
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
MapInvalidateMapSelectionTiles();
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_3) && mapTile == gSceneryGhostPosition && gSceneryPlaceZ == _unkF64F0A
@@ -1929,6 +1957,12 @@ namespace OpenRCT2::Ui::Windows
return;
}
MapSelection::clearSelectedTiles();
for (auto& tile : sceneryEntry->tiles)
{
MapSelection::addSelectedTile(mapTile + tile.offset.Rotate(direction));
}
SceneryRemoveGhostToolPlacement();
gSceneryPlaceObject.SceneryType = SCENERY_TYPE_LARGE;
@@ -1977,8 +2011,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectPositionB.y = mapTile.y;
gMapSelectType = MapSelectType::full;
MapInvalidateSelectionRect();
// If no change in ghost placement
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_4) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z
&& direction == gSceneryPlaceRotation)
@@ -1999,9 +2031,6 @@ namespace OpenRCT2::Ui::Windows
*/
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenPos) override
{
MapInvalidateSelectionRect();
MapInvalidateMapSelectionTiles();
gMapSelectFlags.unset(MapSelectFlag::enable);
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
@@ -2057,12 +2086,12 @@ namespace OpenRCT2::Ui::Windows
// 6e252b
auto smallSceneryPlaceAction = GameActions::SmallSceneryPlaceAction(
loc, quadrant, entryIndex, primaryColour, secondaryColour, tertiaryColour);
smallSceneryPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
smallSceneryPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
auto res = GameActions::Execute(&smallSceneryPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
const auto placementData = res.GetData<GameActions::SmallSceneryPlaceActionResult>();
const auto placementData = res.getData<GameActions::SmallSceneryPlaceActionResult>();
gSceneryPlaceRotation = loc.direction;
gSceneryPlaceObject.SceneryType = SCENERY_TYPE_SMALL;
@@ -2082,7 +2111,7 @@ namespace OpenRCT2::Ui::Windows
}
gSceneryGhostType |= SCENERY_GHOST_FLAG_0;
return res.Cost;
return res.cost;
}
money64 TryPlaceGhostPathAddition(CoordsXYZ loc, ObjectEntryIndex entryIndex)
@@ -2091,9 +2120,9 @@ namespace OpenRCT2::Ui::Windows
// 6e265b
auto footpathAdditionPlaceAction = GameActions::FootpathAdditionPlaceAction(loc, entryIndex);
footpathAdditionPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
footpathAdditionPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
footpathAdditionPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
{
return;
}
@@ -2101,10 +2130,10 @@ namespace OpenRCT2::Ui::Windows
gSceneryGhostType |= SCENERY_GHOST_FLAG_1;
});
auto res = GameActions::Execute(&footpathAdditionPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
return res.Cost;
return res.cost;
}
money64 TryPlaceGhostWall(
@@ -2116,13 +2145,12 @@ namespace OpenRCT2::Ui::Windows
// 6e26b0
auto wallPlaceAction = GameActions::WallPlaceAction(
entryIndex, loc, edge, primaryColour, secondaryColour, tertiaryColour);
wallPlaceAction.SetFlags(
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
wallPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused, CommandFlag::noSpend });
wallPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
return;
const auto placementData = result->GetData<GameActions::WallPlaceActionResult>();
const auto placementData = result->getData<GameActions::WallPlaceActionResult>();
gSceneryGhostPosition = { loc, placementData.BaseHeight };
gSceneryGhostWallRotation = edge;
@@ -2130,10 +2158,10 @@ namespace OpenRCT2::Ui::Windows
});
auto res = GameActions::Execute(&wallPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
return res.Cost;
return res.cost;
}
money64 TryPlaceGhostLargeScenery(
@@ -2145,13 +2173,12 @@ namespace OpenRCT2::Ui::Windows
// 6e25a7
auto sceneryPlaceAction = GameActions::LargeSceneryPlaceAction(
loc, entryIndex, primaryColour, secondaryColour, tertiaryColour);
sceneryPlaceAction.SetFlags(
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
sceneryPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused, CommandFlag::noSpend });
auto res = GameActions::Execute(&sceneryPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
const auto placementData = res.GetData<GameActions::LargeSceneryPlaceActionResult>();
const auto placementData = res.getData<GameActions::LargeSceneryPlaceActionResult>();
gSceneryPlaceRotation = loc.direction;
@@ -2168,7 +2195,7 @@ namespace OpenRCT2::Ui::Windows
}
gSceneryGhostType |= SCENERY_GHOST_FLAG_3;
return res.Cost;
return res.cost;
}
money64 TryPlaceGhostBanner(CoordsXYZD loc, ObjectEntryIndex entryIndex)
@@ -2178,17 +2205,16 @@ namespace OpenRCT2::Ui::Windows
// 6e2612
auto primaryColour = _sceneryPrimaryColour;
auto bannerPlaceAction = GameActions::BannerPlaceAction(loc, entryIndex, primaryColour);
bannerPlaceAction.SetFlags(
GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND);
bannerPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused, CommandFlag::noSpend });
auto res = GameActions::Execute(&bannerPlaceAction, getGameState());
if (res.Error != GameActions::Status::Ok)
if (res.error != GameActions::Status::ok)
return kMoney64Undefined;
gSceneryGhostPosition = loc;
gSceneryGhostPosition.z += kPathHeightStep;
gSceneryPlaceRotation = loc.direction;
gSceneryGhostType |= SCENERY_GHOST_FLAG_4;
return res.Cost;
return res.cost;
}
/**
@@ -2973,7 +2999,7 @@ namespace OpenRCT2::Ui::Windows
zAttemptRange = 20;
}
auto success = GameActions::Status::Unknown;
auto success = GameActions::Status::unknown;
// Try find a valid z coordinate
for (; zAttemptRange != 0; zAttemptRange--)
{
@@ -2983,13 +3009,13 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto res = GameActions::Query(&smallSceneryPlaceAction, gameState);
success = res.Error;
if (res.Error == GameActions::Status::Ok)
success = res.error;
if (res.error == GameActions::Status::ok)
{
break;
}
if (res.Error == GameActions::Status::InsufficientFunds)
if (res.error == GameActions::Status::insufficientFunds)
{
break;
}
@@ -3000,7 +3026,7 @@ namespace OpenRCT2::Ui::Windows
}
// Actually place
if (success == GameActions::Status::Ok || ((q + 1 == quantity) && forceError))
if (success == GameActions::Status::ok || ((q + 1 == quantity) && forceError))
{
auto smallSceneryPlaceAction = GameActions::SmallSceneryPlaceAction(
{ cur_grid_x, cur_grid_y, gSceneryPlaceZ, gSceneryPlaceRotation }, quadrant, selectedScenery,
@@ -3008,20 +3034,20 @@ namespace OpenRCT2::Ui::Windows
smallSceneryPlaceAction.SetCallback(
[=](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
Audio::Play3D(Audio::SoundId::placeItem, result->Position);
Audio::Play3D(Audio::SoundId::placeItem, result->position);
}
});
auto& gameState = getGameState();
auto res = GameActions::Execute(&smallSceneryPlaceAction, gameState);
if (res.Error == GameActions::Status::Ok)
if (res.error == GameActions::Status::ok)
{
forceError = false;
}
if (res.Error == GameActions::Status::InsufficientFunds)
if (res.error == GameActions::Status::insufficientFunds)
{
break;
}
@@ -3042,11 +3068,11 @@ namespace OpenRCT2::Ui::Windows
auto footpathAdditionPlaceAction = GameActions::FootpathAdditionPlaceAction({ gridPos, z }, selectedScenery);
footpathAdditionPlaceAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
{
return;
}
Audio::Play3D(Audio::SoundId::placeItem, result->Position);
Audio::Play3D(Audio::SoundId::placeItem, result->position);
});
auto& gameState = getGameState();
@@ -3100,12 +3126,12 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto res = GameActions::Query(&wallPlaceAction, gameState);
if (res.Error == GameActions::Status::Ok)
if (res.error == GameActions::Status::ok)
{
break;
}
if (const auto* message = std::get_if<StringId>(&res.ErrorMessage))
if (const auto* message = std::get_if<StringId>(&res.errorMessage))
{
if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER)
{
@@ -3167,8 +3193,7 @@ namespace OpenRCT2::Ui::Windows
auto location = tile.location;
location.z = tile.calculatedZ;
auto wallRemoveAction = GameActions::WallRemoveAction(location);
wallRemoveAction.SetFlags(
GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_NO_SPEND | GAME_COMMAND_FLAG_GHOST);
wallRemoveAction.SetFlags({ CommandFlag::allowDuringPaused, CommandFlag::noSpend, CommandFlag::ghost });
wallRemoveAction.Execute(gameState);
}
}
@@ -3190,12 +3215,12 @@ namespace OpenRCT2::Ui::Windows
auto wallPlaceAction = GameActions::WallPlaceAction(
tabSelection.EntryIndex, { x, y, gSceneryPlaceZ }, _startEdge, _sceneryPrimaryColour,
_scenerySecondaryColour, _sceneryTertiaryColour);
wallPlaceAction.SetFlags(GAME_COMMAND_FLAG_GHOST | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED);
wallPlaceAction.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
auto result = GameActions::Execute(&wallPlaceAction, gameState);
if (result.Error == GameActions::Status::Ok)
if (result.error == GameActions::Status::ok)
{
const auto placementData = result.GetData<GameActions::WallPlaceActionResult>();
const auto placementData = result.getData<GameActions::WallPlaceActionResult>();
_provisionalTiles.push_back({ CoordsXYZD(x, y, gSceneryPlaceZ, _startEdge), placementData.BaseHeight });
}
else
@@ -3242,11 +3267,11 @@ namespace OpenRCT2::Ui::Windows
auto z = gSceneryPlaceZ > 0 ? gSceneryPlaceZ : TileElementHeight(_dragStartPos);
Audio::Play3D(Audio::SoundId::error, { _dragStartPos, z });
if (_lastProvisionalError.Error != GameActions::Status::Ok)
if (_lastProvisionalError.error != GameActions::Status::ok)
{
auto windowManager = Ui::GetWindowManager();
windowManager->ShowError(
_lastProvisionalError.GetErrorTitle(), _lastProvisionalError.GetErrorMessage(), true);
_lastProvisionalError.getErrorTitle(), _lastProvisionalError.getErrorMessage(), true);
}
_inDragMode = false;
@@ -3264,10 +3289,10 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto result = GameActions::Execute(&wallPlaceAction, gameState);
if (result.Error == GameActions::Status::Ok)
if (result.error == GameActions::Status::ok)
{
anySuccessful = true;
lastLocation = result.Position;
lastLocation = result.position;
}
}
@@ -3303,12 +3328,12 @@ namespace OpenRCT2::Ui::Windows
auto& gameState = getGameState();
auto res = GameActions::Query(&sceneryPlaceAction, gameState);
if (res.Error == GameActions::Status::Ok)
if (res.error == GameActions::Status::ok)
{
break;
}
if (const auto* message = std::get_if<StringId>(&res.ErrorMessage))
if (const auto* message = std::get_if<StringId>(&res.errorMessage))
{
if (*message == STR_NOT_ENOUGH_CASH_REQUIRES || *message == STR_CAN_ONLY_BUILD_THIS_ON_WATER)
{
@@ -3327,9 +3352,9 @@ namespace OpenRCT2::Ui::Windows
auto sceneryPlaceAction = GameActions::LargeSceneryPlaceAction(
loc, selectedScenery, _sceneryPrimaryColour, _scenerySecondaryColour, _sceneryTertiaryColour);
sceneryPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
Audio::Play3D(Audio::SoundId::placeItem, result->Position);
Audio::Play3D(Audio::SoundId::placeItem, result->position);
}
else
{
@@ -3354,10 +3379,10 @@ namespace OpenRCT2::Ui::Windows
auto primaryColour = _sceneryPrimaryColour;
auto bannerPlaceAction = GameActions::BannerPlaceAction(loc, selectedScenery, primaryColour);
bannerPlaceAction.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error == GameActions::Status::Ok)
if (result->error == GameActions::Status::ok)
{
auto data = result->GetData<GameActions::BannerPlaceActionResult>();
Audio::Play3D(Audio::SoundId::placeItem, result->Position);
auto data = result->getData<GameActions::BannerPlaceActionResult>();
Audio::Play3D(Audio::SoundId::placeItem, result->position);
ContextOpenDetailWindow(WindowDetail::banner, data.bannerId.ToUnderlying());
}
});
@@ -3515,7 +3540,7 @@ namespace OpenRCT2::Ui::Windows
{
auto* toolWindow = ContextOpenWindow(WindowClass::scenery);
ToolSet(*toolWindow, WIDX_SCENERY_BACKGROUND, Tool::arrow);
gInputFlags.set(InputFlag::unk6);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
}
}
} // namespace OpenRCT2::Ui::Windows
+1 -1
View File
@@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_PREVIEW].image = ImageId(LandTool::SizeToSpriteIndex(gWindowSceneryScatterSize));
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
WindowDrawWidgets(*this, rt);
+2 -2
View File
@@ -305,7 +305,7 @@ namespace OpenRCT2::Ui::Windows
return { fallback, ft };
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -326,7 +326,7 @@ namespace OpenRCT2::Ui::Windows
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 8, height - 15 }, _statusText, ft, { COLOUR_WHITE });
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
uint8_t paletteIndex = ColourMapA[colours[1].colour].mid_light;
GfxClear(rt, paletteIndex);
+1 -1
View File
@@ -229,7 +229,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTextBasic(rt, windowPos + ScreenCoordsXY{ 6, widgets[WIDX_PORT_INPUT].top }, STR_PORT, {}, { colours[1] });
+8 -7
View File
@@ -121,7 +121,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -251,7 +251,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetPressed(static_cast<WidgetIndex>(WIDX_TAB_0 + _currentTabIndex), true);
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -297,7 +297,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onScrollDraw(int32_t scrollIndex, RenderTarget& rt) override
void onScrollDraw(int32_t scrollIndex, Drawing::RenderTarget& rt) override
{
auto rtCoords = ScreenCoordsXY{ rt.x, rt.y };
Rectangle::fill(
@@ -472,7 +472,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImages(RenderTarget& rt) const
void DrawTabImages(Drawing::RenderTarget& rt) const
{
for (size_t i = 0; i < _tabs.size(); i++)
{
@@ -480,7 +480,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawTabImage(RenderTarget& rt, size_t tabIndex) const
void DrawTabImage(Drawing::RenderTarget& rt, size_t tabIndex) const
{
const auto& tabDesc = _tabs[tabIndex];
auto widgetIndex = static_cast<WidgetIndex>(WIDX_TAB_0 + tabIndex);
@@ -501,14 +501,15 @@ namespace OpenRCT2::Ui::Windows
}
}
void DrawSeparator(RenderTarget& rt, int32_t y, int32_t scrollWidth)
void DrawSeparator(Drawing::RenderTarget& rt, int32_t y, int32_t scrollWidth)
{
const int32_t top = y + (kScrollableRowHeight / 2) - 1;
Rectangle::fill(rt, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[1].colour].mid_dark);
Rectangle::fill(rt, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[1].colour].lightest);
}
void DrawItem(RenderTarget& rt, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted)
void DrawItem(
Drawing::RenderTarget& rt, int32_t y, int32_t scrollWidth, const ShortcutStringPair& shortcut, bool isHighlighted)
{
auto format = STR_BLACK_STRING;
if (isHighlighted)
+3 -3
View File
@@ -135,7 +135,7 @@ namespace OpenRCT2::Ui::Windows
Widget& viewportWidget = widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 },
viewportWidget.width() - 2, viewportWidget.height() - 1, Focus(CoordsXYZ{ signViewPosition, viewZ }));
viewportWidget.width() - 2, viewportWidget.height() - 2, Focus(CoordsXYZ{ signViewPosition, viewZ }));
viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
invalidate();
@@ -292,7 +292,7 @@ namespace OpenRCT2::Ui::Windows
text_colour_btn->image = getColourButtonImage(_textColour);
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
@@ -318,7 +318,7 @@ namespace OpenRCT2::Ui::Windows
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
ViewportCreate(
*this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 },
viewportWidget->width() - 2, viewportWidget->height() - 1, Focus(CoordsXYZ{ signViewPos }));
viewportWidget->width() - 2, viewportWidget->height() - 2, Focus(CoordsXYZ{ signViewPos }));
if (viewport != nullptr)
viewport->flags = Config::Get().general.alwaysShowGridlines ? VIEWPORT_FLAG_GRIDLINES : VIEWPORT_FLAG_NONE;
invalidate();
+15 -18
View File
@@ -228,7 +228,7 @@ namespace OpenRCT2::Ui::Windows
CommonPrepareDrawAfter();
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
DrawTabImages(rt);
@@ -388,7 +388,7 @@ namespace OpenRCT2::Ui::Windows
Network::GetCurrentPlayerId() };
pickupAction.SetCallback(
[peepnum = number](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
return;
auto* windowMgr = GetWindowManager();
@@ -435,7 +435,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_CLEAR_PATROL_AREA);
auto ddPos = ScreenCoordsXY{ widget->left + windowPos.x, widget->top + windowPos.y };
int32_t extraHeight = widget->height() + 1;
int32_t extraHeight = widget->height();
WindowDropdownShowText(ddPos, extraHeight, colours[1], 0, 2);
gDropdown.defaultIndex = 0;
@@ -540,7 +540,7 @@ namespace OpenRCT2::Ui::Windows
widgets[WIDX_FIRE].right = width - 2;
}
void OverviewDraw(RenderTarget& rt)
void OverviewDraw(Drawing::RenderTarget& rt)
{
// Draw the viewport no sound sprite
if (viewport != nullptr)
@@ -567,19 +567,19 @@ namespace OpenRCT2::Ui::Windows
DrawTextEllipsised(rt, screenPos, widgetWidth, STR_BLACK_STRING, ft, { TextAlignment::centre });
}
void DrawOverviewTabImage(RenderTarget& rt)
void DrawOverviewTabImage(Drawing::RenderTarget& rt)
{
if (isWidgetDisabled(WIDX_TAB_1))
return;
const auto& widget = widgets[WIDX_TAB_1];
int32_t widgetWidth = widget.width() - 2;
int32_t widgetHeight = widget.height() - 1;
int32_t widgetHeight = widget.height() - 2;
auto screenCoords = windowPos + ScreenCoordsXY{ widget.left + 1, widget.top + 1 };
if (page == WINDOW_STAFF_OVERVIEW)
widgetHeight++;
RenderTarget clippedRT;
Drawing::RenderTarget clippedRT;
if (!ClipDrawPixelInfo(clippedRT, rt, screenCoords, widgetWidth, widgetHeight))
{
return;
@@ -616,7 +616,7 @@ namespace OpenRCT2::Ui::Windows
{
const Widget& viewportWidget = widgets[WIDX_VIEWPORT];
const auto reqViewportWidth = viewportWidget.width() - 2;
const auto reqViewportHeight = viewportWidget.height() - 1;
const auto reqViewportHeight = viewportWidget.height() - 2;
viewport->pos = windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 };
if (viewport->width != reqViewportWidth || viewport->height != reqViewportHeight)
@@ -668,8 +668,6 @@ namespace OpenRCT2::Ui::Windows
if (widgetIndex != WIDX_PICKUP)
return;
MapInvalidateSelectionRect();
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
@@ -679,7 +677,6 @@ namespace OpenRCT2::Ui::Windows
gMapSelectType = MapSelectType::full;
gMapSelectPositionA = mapCoords;
gMapSelectPositionB = mapCoords;
MapInvalidateSelectionRect();
}
gPickupPeepImage = ImageId();
@@ -722,7 +719,7 @@ namespace OpenRCT2::Ui::Windows
{ destCoords, tileElement->GetBaseZ() },
Network::GetCurrentPlayerId() };
pickupAction.SetCallback([](const GameActions::GameAction* ga, const GameActions::Result* result) {
if (result->Error != GameActions::Status::Ok)
if (result->error != GameActions::Status::ok)
return;
ToolCancel();
gPickupPeepImage = ImageId();
@@ -802,7 +799,7 @@ namespace OpenRCT2::Ui::Windows
}
auto ddPos = ScreenCoordsXY{ ddWidget->left + windowPos.x, ddWidget->top + windowPos.y };
int32_t ddHeight = ddWidget->height() + 1;
int32_t ddHeight = ddWidget->height();
int32_t ddWidth = ddWidget->width() - 4;
WindowDropdownShowTextCustomWidth(ddPos, ddHeight, colours[1], 0, Dropdown::Flag::StayOpen, numCostumes, ddWidth);
@@ -931,7 +928,7 @@ namespace OpenRCT2::Ui::Windows
#pragma endregion
#pragma region Statistics tab events
void StatsDraw(RenderTarget& rt)
void StatsDraw(Drawing::RenderTarget& rt)
{
auto staff = GetStaff();
if (staff == nullptr)
@@ -1159,7 +1156,7 @@ namespace OpenRCT2::Ui::Windows
auto screenPos = ScreenCoordsXY{ viewWidget.left + 1 + windowPos.x, viewWidget.top + 1 + windowPos.y };
int32_t viewportWidth = viewWidget.width() - 2;
int32_t viewportHeight = viewWidget.height() - 1;
int32_t viewportHeight = viewWidget.height() - 2;
ViewportCreate(*this, screenPos, viewportWidth, viewportHeight, focus.value());
flags |= WindowFlag::noScrolling;
@@ -1178,7 +1175,7 @@ namespace OpenRCT2::Ui::Windows
gDropdown.items[1] = Dropdown::PlainMenuLabel(STR_FOLLOW_SUBJECT_TIP);
WindowDropdownShowText(
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height() + 1, colours[1], 0, 2);
{ windowPos.x + widget->left, windowPos.y + widget->top }, widget->height(), colours[1], 0, 2);
gDropdown.defaultIndex = 0;
}
@@ -1188,14 +1185,14 @@ namespace OpenRCT2::Ui::Windows
WindowFollowSprite(*main, EntityId::FromUnderlying(number));
}
void DrawTabImages(RenderTarget& rt)
void DrawTabImages(Drawing::RenderTarget& rt)
{
DrawOverviewTabImage(rt);
DrawTabImage(rt, WINDOW_STAFF_OPTIONS, SPR_TAB_STAFF_OPTIONS_0);
DrawTabImage(rt, WINDOW_STAFF_STATISTICS, SPR_TAB_STATS_0);
}
void DrawTabImage(RenderTarget& rt, int32_t p, int32_t baseImageId)
void DrawTabImage(Drawing::RenderTarget& rt, int32_t p, int32_t baseImageId)
{
WidgetIndex widgetIndex = WIDX_TAB_1 + p;
Widget* widget = &widgets[widgetIndex];
+1 -1
View File
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void onDraw(RenderTarget& rt) override
void onDraw(Drawing::RenderTarget& rt) override
{
drawWidgets(rt);
Loaded 100 of 624 files, more files were not shown because too many files have changed in this diff. Show more